(options)
| 410 | |
| 411 | // An option that is explicitly `undefined` uses its default, like an omitted option. That is what a caller passes through with an optional setting, like `{decode: config.decode}`. Spreading it over the defaults would instead override the default with `undefined`, so `{encode: undefined}` would write the values unencoded. |
| 412 | function definedOptions(options) { |
| 413 | const result = {}; |
| 414 | |
| 415 | for (const [key, value] of Object.entries(options ?? {})) { |
| 416 | if (value !== undefined) { |
| 417 | result[key] = value; |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | return result; |
| 422 | } |
| 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) { |
no outgoing calls
no test coverage detected