@vielzeug/arsenal 26.10.0 → 26.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +2 -2
  2. package/dist/_common/_lruMap.cjs.map +1 -1
  3. package/dist/_common/_lruMap.d.ts +1 -1
  4. package/dist/_common/_lruMap.js.map +1 -1
  5. package/dist/_common/_selectorSet.cjs.map +1 -1
  6. package/dist/_common/_selectorSet.js.map +1 -1
  7. package/dist/_common/unsafePaths.cjs.map +1 -1
  8. package/dist/_common/unsafePaths.d.ts +1 -1
  9. package/dist/_common/unsafePaths.js.map +1 -1
  10. package/dist/array/contains.cjs.map +1 -1
  11. package/dist/array/contains.js.map +1 -1
  12. package/dist/array/sort.cjs.map +1 -1
  13. package/dist/array/sort.d.ts +1 -1
  14. package/dist/array/sort.js.map +1 -1
  15. package/dist/arsenal.cjs.map +1 -1
  16. package/dist/arsenal.iife.js.map +1 -1
  17. package/dist/arsenal.js.map +1 -1
  18. package/dist/async/abortable.cjs.map +1 -1
  19. package/dist/async/abortable.d.ts +1 -1
  20. package/dist/async/abortable.js.map +1 -1
  21. package/dist/async/attempt.cjs.map +1 -1
  22. package/dist/async/attempt.d.ts +1 -1
  23. package/dist/async/attempt.js.map +1 -1
  24. package/dist/async/backoff.cjs.map +1 -1
  25. package/dist/async/backoff.d.ts +1 -1
  26. package/dist/async/backoff.js.map +1 -1
  27. package/dist/async/retry.cjs.map +1 -1
  28. package/dist/async/retry.d.ts +1 -1
  29. package/dist/async/retry.js.map +1 -1
  30. package/dist/cache/memo.cjs.map +1 -1
  31. package/dist/cache/memo.d.ts +1 -1
  32. package/dist/cache/memo.js.map +1 -1
  33. package/dist/encoding/base64url.cjs.map +1 -1
  34. package/dist/encoding/base64url.d.ts +1 -1
  35. package/dist/encoding/base64url.d.ts.map +1 -1
  36. package/dist/encoding/base64url.js.map +1 -1
  37. package/dist/errors.cjs.map +1 -1
  38. package/dist/errors.d.ts +1 -1
  39. package/dist/errors.js.map +1 -1
  40. package/dist/function/assert.cjs.map +1 -1
  41. package/dist/function/assert.d.ts +1 -0
  42. package/dist/function/assert.d.ts.map +1 -1
  43. package/dist/function/assert.js.map +1 -1
  44. package/dist/function/debounce.cjs.map +1 -1
  45. package/dist/function/debounce.d.ts +2 -2
  46. package/dist/function/debounce.js.map +1 -1
  47. package/dist/function/once.cjs.map +1 -1
  48. package/dist/function/once.d.ts +3 -3
  49. package/dist/function/once.js.map +1 -1
  50. package/dist/function/pipe.cjs.map +1 -1
  51. package/dist/function/pipe.d.ts +1 -1
  52. package/dist/function/pipe.js.map +1 -1
  53. package/dist/guards/combinators.cjs.map +1 -1
  54. package/dist/guards/combinators.d.ts +1 -1
  55. package/dist/guards/combinators.js.map +1 -1
  56. package/dist/guards/isAbortError.cjs.map +1 -1
  57. package/dist/guards/isAbortError.d.ts +2 -2
  58. package/dist/guards/isAbortError.js.map +1 -1
  59. package/dist/guards/isEqual.cjs.map +1 -1
  60. package/dist/guards/isEqual.d.ts +1 -1
  61. package/dist/guards/isEqual.js.map +1 -1
  62. package/dist/guards/isMatch.cjs.map +1 -1
  63. package/dist/guards/isMatch.js.map +1 -1
  64. package/dist/guards/isPlainObject.cjs.map +1 -1
  65. package/dist/guards/isPlainObject.d.ts +1 -1
  66. package/dist/guards/isPlainObject.js.map +1 -1
  67. package/dist/guards/shallowEqual.cjs.map +1 -1
  68. package/dist/guards/shallowEqual.d.ts +3 -3
  69. package/dist/guards/shallowEqual.js.map +1 -1
  70. package/dist/math/clamp.cjs.map +1 -1
  71. package/dist/math/clamp.d.ts +6 -6
  72. package/dist/math/clamp.js.map +1 -1
  73. package/dist/math/gcd.cjs.map +1 -1
  74. package/dist/math/gcd.d.ts +1 -1
  75. package/dist/math/gcd.js.map +1 -1
  76. package/dist/math/lerp.cjs.map +1 -1
  77. package/dist/math/lerp.d.ts +1 -1
  78. package/dist/math/lerp.js.map +1 -1
  79. package/dist/math/mod.cjs.map +1 -1
  80. package/dist/math/mod.d.ts +1 -1
  81. package/dist/math/mod.js.map +1 -1
  82. package/dist/object/defaults.cjs.map +1 -1
  83. package/dist/object/defaults.d.ts +1 -1
  84. package/dist/object/defaults.js.map +1 -1
  85. package/dist/object/diff.cjs.map +1 -1
  86. package/dist/object/diff.d.ts +1 -1
  87. package/dist/object/diff.js.map +1 -1
  88. package/dist/object/hash.cjs.map +1 -1
  89. package/dist/object/hash.d.ts +2 -2
  90. package/dist/object/hash.js.map +1 -1
  91. package/dist/object/pick.cjs.map +1 -1
  92. package/dist/object/pick.d.ts +1 -1
  93. package/dist/object/pick.js.map +1 -1
  94. package/dist/string/_caseUtils.cjs.map +1 -1
  95. package/dist/string/_caseUtils.js.map +1 -1
  96. package/dist/types.d.ts +1 -1
  97. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @vielzeug/arsenal
2
2
 
3
- > Non-trivial TypeScript utilities — retry, cancellation, cache, safe-path, serialization, prototype-pollution-guarded collections
3
+ > Non-trivial TypeScript utilities: retry, cancellation, cache, safe-path, serialization, prototype-pollution-guarded collections
4
4
 
5
5
  ## Installation
6
6
 
@@ -44,4 +44,4 @@ pool.dispose();
44
44
 
45
45
  ## License
46
46
 
47
- MIT © [Helmuth Saatkamp](https://github.com/helmuthdu) — part of the [Vielzeug](https://github.com/helmuthdu/vielzeug) monorepo.
47
+ MIT © [Helmuth Saatkamp](https://github.com/helmuthdu): part of the [Vielzeug](https://github.com/helmuthdu/vielzeug) monorepo.
@@ -1 +1 @@
1
- {"version":3,"file":"_lruMap.cjs","names":[],"sources":["../../src/_common/_lruMap.ts"],"sourcesContent":["/**\n * A Map subclass that evicts the oldest non-excluded entry when the map exceeds\n * `maxSize`. Iteration order (insertion order) determines LRU — the first key\n * returned by `keys()` is the oldest.\n *\n * Calling `set` on an existing key refreshes its position (move-to-end).\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n */\nexport class LruMap<K, V> extends Map<K, V> {\n readonly maxSize: number;\n\n constructor(maxSize: number) {\n super();\n this.maxSize = maxSize;\n }\n\n override set(key: K, value: V): this {\n // Move existing entry to the end (most-recently-used position)\n if (this.has(key)) this.delete(key);\n\n super.set(key, value);\n\n // Evict oldest entry if we've exceeded maxSize\n if (this.size > this.maxSize) this.evictOldest();\n\n return this;\n }\n\n /**\n * Evicts the oldest entry for which `canEvict` returns true.\n * Returns `true` if an entry was evicted, `false` if all entries are guarded.\n */\n evictOldest(canEvict: (key: K, value: V) => boolean = () => true): boolean {\n for (const [k, v] of this) {\n if (canEvict(k, v)) {\n this.delete(k);\n\n return true;\n }\n }\n\n return false;\n }\n}\n"],"mappings":"AASA,IAAa,OAAb,cAAkC,GAAU,CAC1C,QAEA,YAAY,EAAiB,CAC3B,MAAM,EACN,KAAK,QAAU,CACjB,CAEA,IAAa,EAAQ,EAAgB,CASnC,OAPI,KAAK,IAAI,CAAG,GAAG,KAAK,OAAO,CAAG,EAElC,MAAM,IAAI,EAAK,CAAK,EAGhB,KAAK,KAAO,KAAK,SAAS,KAAK,YAAY,EAExC,IACT,CAMA,YAAY,MAAgD,GAAe,CACzE,IAAK,GAAM,CAAC,EAAG,KAAM,KACnB,GAAI,EAAS,EAAG,CAAC,EAGf,OAFA,KAAK,OAAO,CAAC,EAEN,GAIX,MAAO,EACT,CACF"}
1
+ {"version":3,"file":"_lruMap.cjs","names":[],"sources":["../../src/_common/_lruMap.ts"],"sourcesContent":["/**\n * A Map subclass that evicts the oldest non-excluded entry when the map exceeds\n * `maxSize`. Iteration order (insertion order) determines LRU: the first key\n * returned by `keys()` is the oldest.\n *\n * Calling `set` on an existing key refreshes its position (move-to-end).\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n */\nexport class LruMap<K, V> extends Map<K, V> {\n readonly maxSize: number;\n\n constructor(maxSize: number) {\n super();\n this.maxSize = maxSize;\n }\n\n override set(key: K, value: V): this {\n // Move existing entry to the end (most-recently-used position)\n if (this.has(key)) this.delete(key);\n\n super.set(key, value);\n\n // Evict oldest entry if we've exceeded maxSize\n if (this.size > this.maxSize) this.evictOldest();\n\n return this;\n }\n\n /**\n * Evicts the oldest entry for which `canEvict` returns true.\n * Returns `true` if an entry was evicted, `false` if all entries are guarded.\n */\n evictOldest(canEvict: (key: K, value: V) => boolean = () => true): boolean {\n for (const [k, v] of this) {\n if (canEvict(k, v)) {\n this.delete(k);\n\n return true;\n }\n }\n\n return false;\n }\n}\n"],"mappings":"AASA,IAAa,OAAb,cAAkC,GAAU,CAC1C,QAEA,YAAY,EAAiB,CAC3B,MAAM,EACN,KAAK,QAAU,CACjB,CAEA,IAAa,EAAQ,EAAgB,CASnC,OAPI,KAAK,IAAI,CAAG,GAAG,KAAK,OAAO,CAAG,EAElC,MAAM,IAAI,EAAK,CAAK,EAGhB,KAAK,KAAO,KAAK,SAAS,KAAK,YAAY,EAExC,IACT,CAMA,YAAY,MAAgD,GAAe,CACzE,IAAK,GAAM,CAAC,EAAG,KAAM,KACnB,GAAI,EAAS,EAAG,CAAC,EAGf,OAFA,KAAK,OAAO,CAAC,EAEN,GAIX,MAAO,EACT,CACF"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * A Map subclass that evicts the oldest non-excluded entry when the map exceeds
3
- * `maxSize`. Iteration order (insertion order) determines LRU — the first key
3
+ * `maxSize`. Iteration order (insertion order) determines LRU: the first key
4
4
  * returned by `keys()` is the oldest.
5
5
  *
6
6
  * Calling `set` on an existing key refreshes its position (move-to-end).
@@ -1 +1 @@
1
- {"version":3,"file":"_lruMap.js","names":[],"sources":["../../src/_common/_lruMap.ts"],"sourcesContent":["/**\n * A Map subclass that evicts the oldest non-excluded entry when the map exceeds\n * `maxSize`. Iteration order (insertion order) determines LRU — the first key\n * returned by `keys()` is the oldest.\n *\n * Calling `set` on an existing key refreshes its position (move-to-end).\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n */\nexport class LruMap<K, V> extends Map<K, V> {\n readonly maxSize: number;\n\n constructor(maxSize: number) {\n super();\n this.maxSize = maxSize;\n }\n\n override set(key: K, value: V): this {\n // Move existing entry to the end (most-recently-used position)\n if (this.has(key)) this.delete(key);\n\n super.set(key, value);\n\n // Evict oldest entry if we've exceeded maxSize\n if (this.size > this.maxSize) this.evictOldest();\n\n return this;\n }\n\n /**\n * Evicts the oldest entry for which `canEvict` returns true.\n * Returns `true` if an entry was evicted, `false` if all entries are guarded.\n */\n evictOldest(canEvict: (key: K, value: V) => boolean = () => true): boolean {\n for (const [k, v] of this) {\n if (canEvict(k, v)) {\n this.delete(k);\n\n return true;\n }\n }\n\n return false;\n }\n}\n"],"mappings":"AASA,IAAa,OAAb,cAAkC,GAAU,CAC1C,QAEA,YAAY,EAAiB,CAC3B,MAAM,EACN,KAAK,QAAU,CACjB,CAEA,IAAa,EAAQ,EAAgB,CASnC,OAPI,KAAK,IAAI,CAAG,GAAG,KAAK,OAAO,CAAG,EAElC,MAAM,IAAI,EAAK,CAAK,EAGhB,KAAK,KAAO,KAAK,SAAS,KAAK,YAAY,EAExC,IACT,CAMA,YAAY,MAAgD,GAAe,CACzE,IAAK,GAAM,CAAC,EAAG,KAAM,KACnB,GAAI,EAAS,EAAG,CAAC,EAGf,OAFA,KAAK,OAAO,CAAC,EAEN,GAIX,MAAO,EACT,CACF"}
1
+ {"version":3,"file":"_lruMap.js","names":[],"sources":["../../src/_common/_lruMap.ts"],"sourcesContent":["/**\n * A Map subclass that evicts the oldest non-excluded entry when the map exceeds\n * `maxSize`. Iteration order (insertion order) determines LRU: the first key\n * returned by `keys()` is the oldest.\n *\n * Calling `set` on an existing key refreshes its position (move-to-end).\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n */\nexport class LruMap<K, V> extends Map<K, V> {\n readonly maxSize: number;\n\n constructor(maxSize: number) {\n super();\n this.maxSize = maxSize;\n }\n\n override set(key: K, value: V): this {\n // Move existing entry to the end (most-recently-used position)\n if (this.has(key)) this.delete(key);\n\n super.set(key, value);\n\n // Evict oldest entry if we've exceeded maxSize\n if (this.size > this.maxSize) this.evictOldest();\n\n return this;\n }\n\n /**\n * Evicts the oldest entry for which `canEvict` returns true.\n * Returns `true` if an entry was evicted, `false` if all entries are guarded.\n */\n evictOldest(canEvict: (key: K, value: V) => boolean = () => true): boolean {\n for (const [k, v] of this) {\n if (canEvict(k, v)) {\n this.delete(k);\n\n return true;\n }\n }\n\n return false;\n }\n}\n"],"mappings":"AASA,IAAa,OAAb,cAAkC,GAAU,CAC1C,QAEA,YAAY,EAAiB,CAC3B,MAAM,EACN,KAAK,QAAU,CACjB,CAEA,IAAa,EAAQ,EAAgB,CASnC,OAPI,KAAK,IAAI,CAAG,GAAG,KAAK,OAAO,CAAG,EAElC,MAAM,IAAI,EAAK,CAAK,EAGhB,KAAK,KAAO,KAAK,SAAS,KAAK,YAAY,EAExC,IACT,CAMA,YAAY,MAAgD,GAAe,CACzE,IAAK,GAAM,CAAC,EAAG,KAAM,KACnB,GAAI,EAAS,EAAG,CAAC,EAGf,OAFA,KAAK,OAAO,CAAC,EAEN,GAIX,MAAO,EACT,CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"_selectorSet.cjs","names":[],"sources":["../../src/_common/_selectorSet.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Builds a `Set` of `selector(item)` results for O(1) membership checks — shared by\n * `intersection()` and `difference()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function toSelectorSet<T>(items: readonly T[], selector: (item: T) => Primitive): Set<Primitive> {\n return new Set(items.map((item) => selector(item)));\n}\n\n/**\n * Returns `items` with duplicate `selector(item)` results removed, preserving the first\n * occurrence of each key — shared by `union()` and `uniq()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function dedupeBySelector<T>(items: readonly T[], selector: (item: T) => Primitive): T[] {\n const seen = new Set<Primitive>();\n const out: T[] = [];\n\n for (const item of items) {\n const key = selector(item);\n\n if (seen.has(key)) continue;\n\n seen.add(key);\n out.push(item);\n }\n\n return out;\n}\n"],"mappings":"AASA,SAAgB,cAAiB,EAAqB,EAAkD,CACtG,OAAO,IAAI,IAAI,EAAM,IAAK,GAAS,EAAS,CAAI,CAAC,CAAC,CACpD,CASA,SAAgB,iBAAoB,EAAqB,EAAuC,CAC9F,IAAM,EAAO,IAAI,IACX,EAAW,CAAC,EAElB,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAS,CAAI,EAErB,EAAK,IAAI,CAAG,IAEhB,EAAK,IAAI,CAAG,EACZ,EAAI,KAAK,CAAI,EACf,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"_selectorSet.cjs","names":[],"sources":["../../src/_common/_selectorSet.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Builds a `Set` of `selector(item)` results for O(1) membership checks: shared by\n * `intersection()` and `difference()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function toSelectorSet<T>(items: readonly T[], selector: (item: T) => Primitive): Set<Primitive> {\n return new Set(items.map((item) => selector(item)));\n}\n\n/**\n * Returns `items` with duplicate `selector(item)` results removed, preserving the first\n * occurrence of each key: shared by `union()` and `uniq()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function dedupeBySelector<T>(items: readonly T[], selector: (item: T) => Primitive): T[] {\n const seen = new Set<Primitive>();\n const out: T[] = [];\n\n for (const item of items) {\n const key = selector(item);\n\n if (seen.has(key)) continue;\n\n seen.add(key);\n out.push(item);\n }\n\n return out;\n}\n"],"mappings":"AASA,SAAgB,cAAiB,EAAqB,EAAkD,CACtG,OAAO,IAAI,IAAI,EAAM,IAAK,GAAS,EAAS,CAAI,CAAC,CAAC,CACpD,CASA,SAAgB,iBAAoB,EAAqB,EAAuC,CAC9F,IAAM,EAAO,IAAI,IACX,EAAW,CAAC,EAElB,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAS,CAAI,EAErB,EAAK,IAAI,CAAG,IAEhB,EAAK,IAAI,CAAG,EACZ,EAAI,KAAK,CAAI,EACf,CAEA,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"_selectorSet.js","names":[],"sources":["../../src/_common/_selectorSet.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Builds a `Set` of `selector(item)` results for O(1) membership checks — shared by\n * `intersection()` and `difference()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function toSelectorSet<T>(items: readonly T[], selector: (item: T) => Primitive): Set<Primitive> {\n return new Set(items.map((item) => selector(item)));\n}\n\n/**\n * Returns `items` with duplicate `selector(item)` results removed, preserving the first\n * occurrence of each key — shared by `union()` and `uniq()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function dedupeBySelector<T>(items: readonly T[], selector: (item: T) => Primitive): T[] {\n const seen = new Set<Primitive>();\n const out: T[] = [];\n\n for (const item of items) {\n const key = selector(item);\n\n if (seen.has(key)) continue;\n\n seen.add(key);\n out.push(item);\n }\n\n return out;\n}\n"],"mappings":"AASA,SAAgB,cAAiB,EAAqB,EAAkD,CACtG,OAAO,IAAI,IAAI,EAAM,IAAK,GAAS,EAAS,CAAI,CAAC,CAAC,CACpD,CASA,SAAgB,iBAAoB,EAAqB,EAAuC,CAC9F,IAAM,EAAO,IAAI,IACX,EAAW,CAAC,EAElB,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAS,CAAI,EAErB,EAAK,IAAI,CAAG,IAEhB,EAAK,IAAI,CAAG,EACZ,EAAI,KAAK,CAAI,EACf,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"_selectorSet.js","names":[],"sources":["../../src/_common/_selectorSet.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\n/**\n * Builds a `Set` of `selector(item)` results for O(1) membership checks: shared by\n * `intersection()` and `difference()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function toSelectorSet<T>(items: readonly T[], selector: (item: T) => Primitive): Set<Primitive> {\n return new Set(items.map((item) => selector(item)));\n}\n\n/**\n * Returns `items` with duplicate `selector(item)` results removed, preserving the first\n * occurrence of each key: shared by `union()` and `uniq()`.\n *\n * Module-private: underscore-prefixed file is excluded from barrel exports.\n * @internal\n */\nexport function dedupeBySelector<T>(items: readonly T[], selector: (item: T) => Primitive): T[] {\n const seen = new Set<Primitive>();\n const out: T[] = [];\n\n for (const item of items) {\n const key = selector(item);\n\n if (seen.has(key)) continue;\n\n seen.add(key);\n out.push(item);\n }\n\n return out;\n}\n"],"mappings":"AASA,SAAgB,cAAiB,EAAqB,EAAkD,CACtG,OAAO,IAAI,IAAI,EAAM,IAAK,GAAS,EAAS,CAAI,CAAC,CAAC,CACpD,CASA,SAAgB,iBAAoB,EAAqB,EAAuC,CAC9F,IAAM,EAAO,IAAI,IACX,EAAW,CAAC,EAElB,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,EAAS,CAAI,EAErB,EAAK,IAAI,CAAG,IAEhB,EAAK,IAAI,CAAG,EACZ,EAAI,KAAK,CAAI,EACf,CAEA,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"unsafePaths.cjs","names":[],"sources":["../../src/_common/unsafePaths.ts"],"sourcesContent":["/**\n * Path segments that must be rejected in any dot-notation traversal or mutation\n * to prevent prototype pollution reads and writes.\n * @internal\n */\nexport const UNSAFE_PATH_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/**\n * Returns `true` if every dot-notation segment in `key` is safe to use as a\n * plain-object property.\n *\n * @example\n * ```ts\n * isSafePath('user.name') // true\n * isSafePath('__proto__.polluted') // false\n * ```\n */\nexport function isSafePath(key: string): boolean {\n return key.split('.').every((s) => !UNSAFE_PATH_SEGMENTS.has(s));\n}\n\n/**\n * Returns `true` if `key` is one of the dangerous own-property names that can be used to\n * pollute `Object.prototype` (`__proto__`, `constructor`, `prototype`). Use this for plain\n * (non-dotted) property keys — e.g. object keys being copied or reassigned. For dotted paths,\n * use `isSafePath` instead.\n *\n * @example\n * ```ts\n * isUnsafeKey('name') // false\n * isUnsafeKey('__proto__') // true\n * ```\n */\nexport function isUnsafeKey(key: PropertyKey): boolean {\n return typeof key === 'string' && UNSAFE_PATH_SEGMENTS.has(key);\n}\n"],"mappings":"AAKA,IAAa,EAAuB,IAAI,IAAI,CAAC,YAAa,cAAe,WAAW,CAAC,EA4BrF,SAAgB,YAAY,EAA2B,CACrD,OAAO,OAAO,GAAQ,UAAY,EAAqB,IAAI,CAAG,CAChE"}
1
+ {"version":3,"file":"unsafePaths.cjs","names":[],"sources":["../../src/_common/unsafePaths.ts"],"sourcesContent":["/**\n * Path segments that must be rejected in any dot-notation traversal or mutation\n * to prevent prototype pollution reads and writes.\n * @internal\n */\nexport const UNSAFE_PATH_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/**\n * Returns `true` if every dot-notation segment in `key` is safe to use as a\n * plain-object property.\n *\n * @example\n * ```ts\n * isSafePath('user.name') // true\n * isSafePath('__proto__.polluted') // false\n * ```\n */\nexport function isSafePath(key: string): boolean {\n return key.split('.').every((s) => !UNSAFE_PATH_SEGMENTS.has(s));\n}\n\n/**\n * Returns `true` if `key` is one of the dangerous own-property names that can be used to\n * pollute `Object.prototype` (`__proto__`, `constructor`, `prototype`). Use this for plain\n * (non-dotted) property keys: e.g. object keys being copied or reassigned. For dotted paths,\n * use `isSafePath` instead.\n *\n * @example\n * ```ts\n * isUnsafeKey('name') // false\n * isUnsafeKey('__proto__') // true\n * ```\n */\nexport function isUnsafeKey(key: PropertyKey): boolean {\n return typeof key === 'string' && UNSAFE_PATH_SEGMENTS.has(key);\n}\n"],"mappings":"AAKA,IAAa,EAAuB,IAAI,IAAI,CAAC,YAAa,cAAe,WAAW,CAAC,EA4BrF,SAAgB,YAAY,EAA2B,CACrD,OAAO,OAAO,GAAQ,UAAY,EAAqB,IAAI,CAAG,CAChE"}
@@ -12,7 +12,7 @@ export declare function isSafePath(key: string): boolean;
12
12
  /**
13
13
  * Returns `true` if `key` is one of the dangerous own-property names that can be used to
14
14
  * pollute `Object.prototype` (`__proto__`, `constructor`, `prototype`). Use this for plain
15
- * (non-dotted) property keys — e.g. object keys being copied or reassigned. For dotted paths,
15
+ * (non-dotted) property keys: e.g. object keys being copied or reassigned. For dotted paths,
16
16
  * use `isSafePath` instead.
17
17
  *
18
18
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"unsafePaths.js","names":[],"sources":["../../src/_common/unsafePaths.ts"],"sourcesContent":["/**\n * Path segments that must be rejected in any dot-notation traversal or mutation\n * to prevent prototype pollution reads and writes.\n * @internal\n */\nexport const UNSAFE_PATH_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/**\n * Returns `true` if every dot-notation segment in `key` is safe to use as a\n * plain-object property.\n *\n * @example\n * ```ts\n * isSafePath('user.name') // true\n * isSafePath('__proto__.polluted') // false\n * ```\n */\nexport function isSafePath(key: string): boolean {\n return key.split('.').every((s) => !UNSAFE_PATH_SEGMENTS.has(s));\n}\n\n/**\n * Returns `true` if `key` is one of the dangerous own-property names that can be used to\n * pollute `Object.prototype` (`__proto__`, `constructor`, `prototype`). Use this for plain\n * (non-dotted) property keys — e.g. object keys being copied or reassigned. For dotted paths,\n * use `isSafePath` instead.\n *\n * @example\n * ```ts\n * isUnsafeKey('name') // false\n * isUnsafeKey('__proto__') // true\n * ```\n */\nexport function isUnsafeKey(key: PropertyKey): boolean {\n return typeof key === 'string' && UNSAFE_PATH_SEGMENTS.has(key);\n}\n"],"mappings":"AAKA,IAAa,EAAuB,IAAI,IAAI,CAAC,YAAa,cAAe,WAAW,CAAC,EA4BrF,SAAgB,YAAY,EAA2B,CACrD,OAAO,OAAO,GAAQ,UAAY,EAAqB,IAAI,CAAG,CAChE"}
1
+ {"version":3,"file":"unsafePaths.js","names":[],"sources":["../../src/_common/unsafePaths.ts"],"sourcesContent":["/**\n * Path segments that must be rejected in any dot-notation traversal or mutation\n * to prevent prototype pollution reads and writes.\n * @internal\n */\nexport const UNSAFE_PATH_SEGMENTS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/**\n * Returns `true` if every dot-notation segment in `key` is safe to use as a\n * plain-object property.\n *\n * @example\n * ```ts\n * isSafePath('user.name') // true\n * isSafePath('__proto__.polluted') // false\n * ```\n */\nexport function isSafePath(key: string): boolean {\n return key.split('.').every((s) => !UNSAFE_PATH_SEGMENTS.has(s));\n}\n\n/**\n * Returns `true` if `key` is one of the dangerous own-property names that can be used to\n * pollute `Object.prototype` (`__proto__`, `constructor`, `prototype`). Use this for plain\n * (non-dotted) property keys: e.g. object keys being copied or reassigned. For dotted paths,\n * use `isSafePath` instead.\n *\n * @example\n * ```ts\n * isUnsafeKey('name') // false\n * isUnsafeKey('__proto__') // true\n * ```\n */\nexport function isUnsafeKey(key: PropertyKey): boolean {\n return typeof key === 'string' && UNSAFE_PATH_SEGMENTS.has(key);\n}\n"],"mappings":"AAKA,IAAa,EAAuB,IAAI,IAAI,CAAC,YAAa,cAAe,WAAW,CAAC,EA4BrF,SAAgB,YAAY,EAA2B,CACrD,OAAO,OAAO,GAAQ,UAAY,EAAqB,IAAI,CAAG,CAChE"}
@@ -1 +1 @@
1
- {"version":3,"file":"contains.cjs","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: readonly T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes — avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":"yCAkBA,SAAgB,SAAY,EAAqB,EAAyB,CAOxE,OAJ6C,OAAO,GAAU,WAA1D,EACK,EAAM,SAAS,CAAU,EAG3B,EAAM,KAAM,GAAQ,EAAA,QAAQ,EAAK,CAAK,CAAC,CAChD"}
1
+ {"version":3,"file":"contains.cjs","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: readonly T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes: avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":"yCAkBA,SAAgB,SAAY,EAAqB,EAAyB,CAOxE,OAJ6C,OAAO,GAAU,WAA1D,EACK,EAAM,SAAS,CAAU,EAG3B,EAAM,KAAM,GAAQ,EAAA,QAAQ,EAAK,CAAK,CAAC,CAChD"}
@@ -1 +1 @@
1
- {"version":3,"file":"contains.js","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: readonly T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes — avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":"+CAkBA,SAAgB,SAAY,EAAqB,EAAyB,CAOxE,OAJ6C,OAAO,GAAU,WAA1D,EACK,EAAM,SAAS,CAAU,EAG3B,EAAM,KAAM,GAAQ,EAAQ,EAAK,CAAK,CAAC,CAChD"}
1
+ {"version":3,"file":"contains.js","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: readonly T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes: avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":"+CAkBA,SAAgB,SAAY,EAAqB,EAAyB,CAOxE,OAJ6C,OAAO,GAAU,WAA1D,EACK,EAAM,SAAS,CAAU,EAG3B,EAAM,KAAM,GAAQ,EAAQ,EAAK,CAAK,CAAC,CAChD"}
@@ -1 +1 @@
1
- {"version":3,"file":"sort.cjs","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: readonly T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"8DA6BA,SAAgB,KACd,EACA,EACA,EAA2B,MACtB,CACL,GAAI,CAAC,MAAM,QAAQ,CAAK,EAAG,MAAU,UAAU,uCAAuC,EAEtF,GAAI,OAAO,GAAwB,WAAY,CAC7C,IAAM,EAAa,IAAc,OAAS,GAAK,EAE/C,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,EAAG,IAAM,EAAA,QAAQ,EAAoB,CAAC,EAAG,EAAoB,CAAC,CAAC,EAAI,CAAU,CACvG,CAEA,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK,EAAA,UAAU,CAAmB,CAAC,CACvD"}
1
+ {"version":3,"file":"sort.cjs","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'`: only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: readonly T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"8DA6BA,SAAgB,KACd,EACA,EACA,EAA2B,MACtB,CACL,GAAI,CAAC,MAAM,QAAQ,CAAK,EAAG,MAAU,UAAU,uCAAuC,EAEtF,GAAI,OAAO,GAAwB,WAAY,CAC7C,IAAM,EAAa,IAAc,OAAS,GAAK,EAE/C,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,EAAG,IAAM,EAAA,QAAQ,EAAoB,CAAC,EAAG,EAAoB,CAAC,CAAC,EAAI,CAAU,CACvG,CAEA,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK,EAAA,UAAU,CAAmB,CAAC,CACvD"}
@@ -16,7 +16,7 @@ export type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;
16
16
  *
17
17
  * @param array - The array to sort.
18
18
  * @param selector - A function extracting the sort key, or a multi-field object.
19
- * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.
19
+ * @param direction - `'asc'` (default) or `'desc'`: only applies to single-field mode.
20
20
  * @returns A new sorted array.
21
21
  *
22
22
  * @throws {TypeError} If the first argument is not an array.
@@ -1 +1 @@
1
- {"version":3,"file":"sort.js","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'` — only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: readonly T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"kFA6BA,SAAgB,KACd,EACA,EACA,EAA2B,MACtB,CACL,GAAI,CAAC,MAAM,QAAQ,CAAK,EAAG,MAAU,UAAU,uCAAuC,EAEtF,GAAI,OAAO,GAAwB,WAAY,CAC7C,IAAM,EAAa,IAAc,OAAS,GAAK,EAE/C,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,EAAG,IAAM,EAAQ,EAAoB,CAAC,EAAG,EAAoB,CAAC,CAAC,EAAI,CAAU,CACvG,CAEA,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK,EAAU,CAAmB,CAAC,CACvD"}
1
+ {"version":3,"file":"sort.js","names":[],"sources":["../../src/array/sort.ts"],"sourcesContent":["import { compare } from './compare';\nimport { compareBy } from './compareBy';\n\nexport type SortDirection = 'asc' | 'desc';\nexport type SortSelectors<T> = Partial<Record<keyof T, SortDirection>>;\n\n/**\n * Sorts an array by a selector function (single-field) or by a multi-field\n * object of `{ key: 'asc' | 'desc' }` entries.\n *\n * @example\n * ```ts\n * // Single field\n * sort([{ a: 2 }, { a: 1 }], item => item.a); // [{ a:1 }, { a:2 }]\n * sort([{ a: 2 }, { a: 1 }], item => item.a, 'desc'); // [{ a:2 }, { a:1 }]\n *\n * // Multi-field\n * sort(users, { name: 'asc', age: 'desc' });\n * ```\n *\n * @param array - The array to sort.\n * @param selector - A function extracting the sort key, or a multi-field object.\n * @param direction - `'asc'` (default) or `'desc'`: only applies to single-field mode.\n * @returns A new sorted array.\n *\n * @throws {TypeError} If the first argument is not an array.\n */\nexport function sort<T>(array: readonly T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: readonly T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: readonly T[],\n selectorOrSelectors: ((item: T) => unknown) | SortSelectors<T>,\n direction: SortDirection = 'asc',\n): T[] {\n if (!Array.isArray(array)) throw new TypeError('sort: first argument must be an array');\n\n if (typeof selectorOrSelectors === 'function') {\n const multiplier = direction === 'desc' ? -1 : 1;\n\n return [...array].sort((a, b) => compare(selectorOrSelectors(a), selectorOrSelectors(b)) * multiplier);\n }\n\n return [...array].sort(compareBy(selectorOrSelectors));\n}\n"],"mappings":"kFA6BA,SAAgB,KACd,EACA,EACA,EAA2B,MACtB,CACL,GAAI,CAAC,MAAM,QAAQ,CAAK,EAAG,MAAU,UAAU,uCAAuC,EAEtF,GAAI,OAAO,GAAwB,WAAY,CAC7C,IAAM,EAAa,IAAc,OAAS,GAAK,EAE/C,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,MAAM,EAAG,IAAM,EAAQ,EAAoB,CAAC,EAAG,EAAoB,CAAC,CAAC,EAAI,CAAU,CACvG,CAEA,MAAO,CAAC,GAAG,CAAK,CAAC,CAAC,KAAK,EAAU,CAAmB,CAAC,CACvD"}