@mybricks/sandbox
v1.0.0
Published
sandbox
Downloads
12
Maintainers
Keywords
Readme
@mybricks/sandbox
a simple sandbox for expression execution which support template.
Install
$ npm install @mybricks/sandbox --save
Usage
import Sandbox from '@mybricks/sandbox';
const context = { a: 1 };
const expression = '{a}';
const sandbox = new ExpressionSandbox({context});
const ret = sandbox.executeWithTemplate(expression); //execute expression with template, ret: 1
//or
const expression = 'a'
const ret = sandbox.execute(expression); //execute expression without template, ret: 1
Template Support
{expression}
{expression}-{expression}
LICENSE
MIT