Marked

Build Status codecov npm version downloads

:tennis: JavaScript code runner in marked territory, synchronized

Install

yarn add @sudoo/marked
# Or
npm install @sudoo/marked --save

Usage

For more examples, see JavaScript files under docs folder.

High level client

import { Marked } from '@sudoo/marked'

Marked(`import print from 'print'; print(1)`, {
    options: // options
    injects: // inject variable
    provides: // provide importable variable
})
    .then((result)=>/*handle result*/)
    .catch((err)=>/*handle error*/);

Low level client

import { Sandbox } from '@sudoo/marked'

const sandbox = Sandbox.create();

// use evaluator
// provide internal function

sandbox.evaluate(`import print from 'print'; print(1)`)
    .then((result)=>/*handle result*/)
    .catch((err)=>/*handle error*/);