(a: string | number, b: string | number)
| 183 | * Handles mixed types by ordering strings before numbers. |
| 184 | */ |
| 185 | export function compareKeys(a: string | number, b: string | number): number { |
| 186 | // Same type: compare directly |
| 187 | if (typeof a === typeof b) { |
| 188 | if (a < b) return -1 |
| 189 | if (a > b) return 1 |
| 190 | return 0 |
| 191 | } |
| 192 | // Different types: strings come before numbers |
| 193 | return typeof a === `string` ? -1 : 1 |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * Serializes a value for use as a key, handling BigInt and Date values that JSON.stringify cannot handle. |
no outgoing calls
no test coverage detected
searching dependent graphs…