var code = 'var n = a; x = y; status.show();\n// todo: \nconsole.log(xyz, "todo: // tests.", params);'; function parse (c) { var myfunc = new function("myfunc", c); }
i'm using v8 nodejs environment. maybe possible information declared variables , scope of existing function?
in fact need missing variable names a
, x
, y
, status
, xyz
, params
.
can point me right direction?
best regards.
i suggest using parser uglifyjs or esprima parse code, extract variables , test them in current environment. don't think that's difficult since i've built quite javascript code analysis or compilation/evaluation.
but if need easier , faster solution, can try jslint. can use library, disable other rules , leave "undefined variable". can test each of errors in current environment see whether they're provided or not.
Comments
Post a Comment