MCPcopy
hub / github.com/CacheControl/json-rules-engine / constructor

Method constructor

src/engine.js:21–34  ·  view source on GitHub ↗

* Returns a new Engine instance * @param {Rule[]} rules - array of rules to initialize with

(rules = [], options = {})

Source from the content-addressed store, hash-verified

19 * @param {Rule[]} rules - array of rules to initialize with
20 */
21 constructor (rules = [], options = {}) {
22 super()
23 this.rules = []
24 this.allowUndefinedFacts = options.allowUndefinedFacts || false
25 this.allowUndefinedConditions = options.allowUndefinedConditions || false
26 this.replaceFactsInEventParams = options.replaceFactsInEventParams || false
27 this.pathResolver = options.pathResolver
28 this.operators = new Map()
29 this.facts = new Map()
30 this.conditions = new Map()
31 this.status = READY
32 rules.map(r => this.addRule(r))
33 defaultOperators.map(o => this.addOperator(o))
34 }
35
36 /**
37 * Add a rule definition to the engine

Callers

nothing calls this directly

Calls 2

addRuleMethod · 0.95
addOperatorMethod · 0.95

Tested by

no test coverage detected