expression service

Provides safe, Esprima-based expression evaluation. This service is provided via the flobot plugin and isn't offered by any of the other core plugins.

Boot config

  • This service doesn’t require any configuration to boot.

Service methods/properties

parse

Parses a string expression and returns an object for subsequent evaluation

Parameters

  • expression string The expression that needs evaluating.

Examples

var exp = expressionService.parse('a > b')
console.log(exp.evaluate({a: 10, b: 5})) // true
console.log(exp.evaluate({a: 5, b: 10})) // false

Returns Object Use the evaluate function (uses the static-eval package)