Skip to content

Instantly share code, notes, and snippets.

@serby
Created October 16, 2013 22:12
Show Gist options
  • Select an option

  • Save serby/7015853 to your computer and use it in GitHub Desktop.

Select an option

Save serby/7015853 to your computer and use it in GitHub Desktop.
console.log finder
function countLines(text) {
var count = 1
, pos = 0
, found = 0
while ((found = text.indexOf('\n', pos)) !== -1) {
count++
pos = found + 1
}
return count
}
function badFunctions(file) {
var src = fs.readFileSync(file).toString()
falafel(src, function (node) {
if ((node.type === 'MemberExpression') && (node.object.name === 'console')) {
console.log(file, node.object.name, node.source(), countLines(src.substring(0, node.property.range[0])))
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment