Created
April 11, 2012 17:08
-
-
Save jbclements/2360597 to your computer and use it in GitHub Desktop.
Feeney
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 jsp = require("uglify-js").parser; | |
var pro = require("uglify-js").uglify; | |
var file = process.argv.splice(2).toString(); | |
var fs = require( 'fs'); | |
var output; | |
fs.readFile(file, | |
function(err, data){ | |
if(err){ | |
console.error("could not open file: %s", err); | |
process.exit(1); | |
} | |
console.log(data.toString('ascii')); | |
console.log("Reduces:"); | |
var out = jsp.parse(data.toString('ascii') ); | |
var walker = pro.ast_walker(); | |
//walker.with_walker('var'); | |
walker.with_walkers( | |
{"var": function(defs) | |
{ console.log("Vars: " + defs[0][0]);}}, | |
function () {walker.walk(out)}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment