(a: unknown, b: unknown)
| 97 | |
| 98 | // Create a multi-property comparator that respects the order and direction of each property |
| 99 | const compare = (a: unknown, b: unknown) => { |
| 100 | // If we're comparing arrays (multiple properties), compare each property in order |
| 101 | if (orderByClause.length > 1) { |
| 102 | const arrayA = a as Array<unknown> |
| 103 | const arrayB = b as Array<unknown> |
| 104 | for (let i = 0; i < orderByClause.length; i++) { |
| 105 | const clause = compiledOrderBy[i]! |
| 106 | const compareFn = makeComparator(clause.compareOptions) |
| 107 | const result = compareFn(arrayA[i], arrayB[i]) |
| 108 | if (result !== 0) { |
| 109 | return result |
| 110 | } |
| 111 | } |
| 112 | return arrayA.length - arrayB.length |
| 113 | } |
| 114 | |
| 115 | // Single property comparison |
| 116 | if (orderByClause.length === 1) { |
| 117 | const clause = compiledOrderBy[0]! |
| 118 | const compareFn = makeComparator(clause.compareOptions) |
| 119 | return compareFn(a, b) |
| 120 | } |
| 121 | |
| 122 | return defaultComparator(a, b) |
| 123 | } |
| 124 | |
| 125 | let setSizeCallback: ((getSize: () => number) => void) | undefined |
| 126 |
no test coverage detected