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

Method setConditions

src/rule.js:73–86  ·  view source on GitHub ↗

* Sets the conditions to run when evaluating the rule. * @param {object} conditions - conditions, root element must be a boolean operator

(conditions)

Source from the content-addressed store, hash-verified

71 * @param {object} conditions - conditions, root element must be a boolean operator
72 */
73 setConditions (conditions) {
74 if (
75 !Object.prototype.hasOwnProperty.call(conditions, 'all') &&
76 !Object.prototype.hasOwnProperty.call(conditions, 'any') &&
77 !Object.prototype.hasOwnProperty.call(conditions, 'not') &&
78 !Object.prototype.hasOwnProperty.call(conditions, 'condition')
79 ) {
80 throw new Error(
81 '"conditions" root must contain a single instance of "all", "any", "not", or "condition"'
82 )
83 }
84 this.conditions = new Condition(conditions)
85 return this
86 }
87
88 /**
89 * Sets the event to emit when the conditions evaluate truthy

Callers 5

setupFunction · 0.95
constructorMethod · 0.95
index.test-d.tsFile · 0.80
rule.test.jsFile · 0.80

Calls

no outgoing calls

Tested by 1

setupFunction · 0.76