virdo

1.2.0 • Public • Published

virdo

Virtually run JS scripts

What?

What this is:

  • An actual, honest to God, JS sandbox.

What this is not:

  • eval
  • A subprocess running node with low priviliges.
  • A find-and-replace blackbox.
  • An actual, honest to God, JS sandbox with 100% language spec compliance.
    • Some minor features are not supported yet (such as classes and this).

Usage

const js = require('virdo');
console.log(
  js(`
  let a = 4;
  if (false) {
    a++;
  }
  a;
`)
); // this prints out 4
 
js(`print(4)`, { print: console.log }); // prints 4

Readme

Keywords

Package Sidebar

Install

npm i virdo

Weekly Downloads

1

Version

1.2.0

License

MIT

Unpacked Size

26.3 kB

Total Files

21

Last publish

Collaborators

  • oakfang