Installation & Setup

First, add the module to your application through your preferred package manager,

npm install json-logic-engine
-- or --
yarn add json-logic-engine
Then import the module, and try to set up a "Hello, World!"
import { LogicEngine } from 'json-logic-engine'
const engine = new LogicEngine()
// we can make use of the modules function compilation
const f = engine.build({
'cat': ["Hello, ", { var: '' }, "!"]
})
console.log(f("World")) // prints "Hello, World!"
Or alternatively, make use of the interpreter using:
import { LogicEngine } from 'json-logic-engine'
const engine = new LogicEngine()
// we can make use of the modules function compilation
console.log(engine.run({ 'cat': ["Hello, ", { var: '' }, "!"] }, "World"))