@mybricks/sandbox
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@mybricks/sandbox

NPM version NPM downloads

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

Readme

Keywords

Package Sidebar

Install

npm i @mybricks/sandbox

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

10.3 kB

Total Files

14

Last publish

Collaborators

  • moyukai
  • zhuba-ahhh
  • tangxiaoxin
  • cocolbell
  • yingpengsha
  • z35635
  • letterletter
  • zeeker
  • jidan.wd
  • stuzhaoxing
  • leo306
  • godstream
  • leon_js
  • mybricks-group