Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kudzu

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kudzu

Fast evaluation on ESTree-compatible ASTs

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

kudzu

Fast evaluation on ESTree-compatible ASTs

Features

  • Comprehensive tests
  • Fully asynchronous API and internals
  • Esprima and Cherow compatible
  • ECMA 3 and IE8 compatible
  • ESNext support

Install

npm install esprima-eval

Usage

var esEval   = require('esprima-eval'),
    esprima  = require('esprima');

var ast   = esprima.parseScript(' ... '),
    scope = new esEval.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
});

Support

Runtime

  • Strict mode
  • Error handling
  • Error skipping/resolution
  • Protected global objects/prototypes

Globals

  • Array
  • Function
  • Object
  • Date
  • Number
  • RegExp
  • String
  • Proxy
  • Symbol
  • Math

Scope

  • Scope chain
  • Function scope (var)
  • Block scope (let)

Operations

  • Binary (&, |, ^)
  • Mathematical (+, -, /, *, %)
  • Increment before (++i, --i)
  • Increment after (i++, i--)
  • Add assignment
  • Subtract assignment
  • Multiply assignment
  • Divide assignment
  • typeof

Conditionals

  • And/or
  • Strict/non-strict equality
  • <, >, <=, >=
  • instanceof
  • If statements

Loops

  • For loops
  • While loops
  • break
  • continue
  • return

Functions

  • Function declarations
  • Anonymous closures
  • Arrow functions
  • Async functions
  • Spread operator
  • Object identity

Proxies

  • Proxy constructor
  • Has/get/set/delete property
  • Get/set property descriptor
  • Get/set prototype
  • Apply

Promises

  • Promise constructor
  • Promise.then
  • Promise.catch

Symbols

Errors

  • Error constructor
  • Stack traces
  • Try/catch

Prior Art

https://www.npmjs.com/package/esper.js https://www.npmjs.com/package/sandboxr https://github.com/NeilFraser/JS-Interpreter https://github.com/mozilla/narcissus/

Keywords

FAQs

Package last updated on 28 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc