| 423 | |
| 424 | // The `index` array format collects the items in an object keyed by the index. The keys are sorted as strings first, so that two spellings of the same index, like `01` and `1`, always come out in the same order, and then numerically. The empty key is the item of a scalar seen before the indexed entries, and it sorts before any index. |
| 425 | function arrayFromIndexes(object) { |
| 426 | return Object.keys(object) |
| 427 | // eslint-disable-next-line unicorn/require-array-sort-compare -- The default string sort is what puts `01` and `1` in the same order. |
| 428 | .toSorted() |
| 429 | .toSorted((a, b) => Number(a) - Number(b)) |
| 430 | .map(key => object[key]); |
| 431 | } |
| 432 | |
| 433 | function removeHash(input) { |
| 434 | const hashStart = input.indexOf('#'); |