Fast evaluation on ESTree-compatible ASTs
- Comprehensive tests
- Fully asynchronous API and internals
- Esprima and Cherow compatible
- ECMA 3 and IE8 compatible
- ESNext support
npm install kudzu
var kudzu = require('kudzu'),
esprima = require('esprima');
var ast = esprima.parseScript(' ... '),
scope = new kudzu.Scope(globals);
scope.on('get', function () {
// supports custom scope data handlers
});
scope.on('ConditionalExpression', function () {
// supports custom lexical node handlers
});
scope.walk(ast, function (returnValue) {
// done
});
- Strict mode
- Error handling
- Error skipping/resolution
- Protected global objects/prototypes
-
Array
-
Function
-
Object
-
Date
-
Number
-
RegExp
-
String
-
Proxy
-
Symbol
-
Math
- Scope chain
- Function scope (
var
) - Block scope (
let
)
- Binary (&, |, ^)
- Mathematical (+, -, /, *, %)
- Increment before (++i, --i)
- Increment after (i++, i--)
- Add assignment
- Subtract assignment
- Multiply assignment
- Divide assignment
- typeof
- And/or
- Strict/non-strict equality
- <, >, <=, >=
- instanceof
- If statements
- For loops
- While loops
-
break
-
continue
-
return
- Function declarations
- Anonymous closures
- Arrow functions
- Async functions
- Spread operator
- Object identity
- Proxy constructor
- Has/get/set/delete property
- Get/set property descriptor
- Get/set prototype
- Apply
- Promise constructor
- Promise.then
- Promise.catch
- Error constructor
- Stack traces
- Try/catch
https://www.npmjs.com/package/esper.js https://www.npmjs.com/package/sandboxr https://github.com/NeilFraser/JS-Interpreter https://github.com/mozilla/narcissus/