| 190 | } |
| 191 | |
| 192 | class FilterEqualityComparator implements FilterComparator { |
| 193 | private _isEQ: boolean; |
| 194 | private _rval: unknown; |
| 195 | private _rvalTypeof: string; |
| 196 | private _rvalFloat: number; |
| 197 | constructor(isEq: boolean, rval: unknown) { |
| 198 | this._rval = rval; |
| 199 | this._isEQ = isEq; |
| 200 | this._rvalTypeof = typeof rval; |
| 201 | this._rvalFloat = numericToNumber(rval); |
| 202 | } |
| 203 | // Performance sensitive. |
| 204 | evaluate(lval: unknown): boolean { |
| 205 | let eqResult = lval === this._rval; |
| 206 | if (!eqResult) { |
| 207 | const lvalTypeof = typeof lval; |
| 208 | if (lvalTypeof !== this._rvalTypeof && (lvalTypeof === 'number' || this._rvalTypeof === 'number')) { |
| 209 | eqResult = numericToNumber(lval) === this._rvalFloat; |
| 210 | } |
| 211 | } |
| 212 | return this._isEQ ? eqResult : !eqResult; |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | type OrderRelationOperator = 'lt' | 'lte' | 'gt' | 'gte'; |
| 217 | export type RelationalOperator = OrderRelationOperator | 'eq' | 'ne'; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…