MCPcopy Create free account
hub / github.com/sindresorhus/query-string / arrayFromIndexes

Function arrayFromIndexes

base.js:425–431  ·  view source on GitHub ↗
(object)

Source from the content-addressed store, hash-verified

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.
425function 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
433function removeHash(input) {
434 const hashStart = input.indexOf('#');

Callers 1

parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected