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

Method addOperator

src/engine.js:129–138  ·  view source on GitHub ↗

* Add a custom operator definition * @param {string} operatorOrName - operator identifier within the condition; i.e. instead of 'equals', 'greaterThan', etc * @param {function(factValue, jsonValue)} callback - the method to execute when the operator is encountered.

(operatorOrName, cb)

Source from the content-addressed store, hash-verified

127 * @param {function(factValue, jsonValue)} callback - the method to execute when the operator is encountered.
128 */
129 addOperator (operatorOrName, cb) {
130 let operator
131 if (operatorOrName instanceof Operator) {
132 operator = operatorOrName
133 } else {
134 operator = new Operator(operatorOrName, cb)
135 }
136 debug(`engine::addOperator name:${operator.name}`)
137 this.operators.set(operator.name, operator)
138 }
139
140 /**
141 * Remove a custom operator definition

Callers 6

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

Calls 1

debugFunction · 0.85

Tested by 1

setupFunction · 0.64