Created
October 16, 2013 22:12
-
-
Save serby/7015853 to your computer and use it in GitHub Desktop.
console.log finder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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