| 118 | }; |
| 119 | |
| 120 | class FilterOrderComparator implements FilterComparator { |
| 121 | private _rvalFloat: number; |
| 122 | private _opFn: (lval: unknown, rval: unknown) => boolean; |
| 123 | constructor(op: OrderRelationOperator, rval: unknown) { |
| 124 | if (!isNumber(rval)) { |
| 125 | let errMsg = ''; |
| 126 | if (__DEV__) { |
| 127 | errMsg = 'rvalue of "<", ">", "<=", ">=" can only be number in filter.'; |
| 128 | } |
| 129 | throwError(errMsg); |
| 130 | } |
| 131 | this._opFn = ORDER_COMPARISON_OP_MAP[op]; |
| 132 | this._rvalFloat = numericToNumber(rval); |
| 133 | } |
| 134 | // Performance sensitive. |
| 135 | evaluate(lval: unknown): boolean { |
| 136 | // Most cases is 'number', and typeof maybe 10 times faseter than parseFloat. |
| 137 | return isNumber(lval) |
| 138 | ? this._opFn(lval, this._rvalFloat) |
| 139 | : this._opFn(numericToNumber(lval), this._rvalFloat); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | export class SortOrderComparator { |
| 144 | private _incomparable: number; |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…