Created
November 13, 2012 11:38
-
-
Save dunkfordyce/4065345 to your computer and use it in GitHub Desktop.
Convert single line comments in javascript to console.log statements with esprima/falafel/javascript
This file contains 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
var falafel = require('falafel'); | |
var src = require('fs').readFileSync(process.argv[2]).toString(); | |
var output = falafel(src, {comment: true}, function (node) { | |
if (node.type === 'Line') { | |
node.update('console.log("COMMENT:' + node.value + '");'); | |
} | |
}); | |
console.log(output); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment