Last active
January 13, 2017 14:44
-
-
Save fokusferit/fab904d51ef6c23f5888388743b59858 to your computer and use it in GitHub Desktop.
Just a basic node script which saves the AST of JS code in a file.
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
var espree = require('espree'); | |
var fs = require('fs'); | |
var code = `let array = [1,2,'b']; | |
`; | |
var ast = espree.parse(code, { | |
ecmaVersion: 6 | |
}); | |
console.log("writing ast to ast.json") | |
fs.writeFile("ast.json", JSON.stringify(ast, null, 4), function(err) { | |
if(err) return err; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment