* 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)
| 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 |