@vielzeug/arsenal 2.0.1 → 2.1.0

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 (113) hide show
  1. package/dist/array/chunk.cjs.map +1 -1
  2. package/dist/array/chunk.js.map +1 -1
  3. package/dist/array/countBy.cjs.map +1 -1
  4. package/dist/array/countBy.d.ts.map +1 -1
  5. package/dist/array/countBy.js.map +1 -1
  6. package/dist/array/difference.cjs.map +1 -1
  7. package/dist/array/difference.d.ts.map +1 -1
  8. package/dist/array/difference.js.map +1 -1
  9. package/dist/array/groupBy.cjs.map +1 -1
  10. package/dist/array/groupBy.d.ts.map +1 -1
  11. package/dist/array/groupBy.js.map +1 -1
  12. package/dist/array/indexBy.cjs.map +1 -1
  13. package/dist/array/indexBy.d.ts.map +1 -1
  14. package/dist/array/indexBy.js.map +1 -1
  15. package/dist/array/intersection.cjs.map +1 -1
  16. package/dist/array/intersection.d.ts.map +1 -1
  17. package/dist/array/intersection.js.map +1 -1
  18. package/dist/array/union.cjs.map +1 -1
  19. package/dist/array/union.d.ts.map +1 -1
  20. package/dist/array/union.js.map +1 -1
  21. package/dist/array/uniq.cjs.map +1 -1
  22. package/dist/array/uniq.d.ts.map +1 -1
  23. package/dist/array/uniq.js.map +1 -1
  24. package/dist/arsenal.cjs +1 -1
  25. package/dist/arsenal.cjs.map +1 -1
  26. package/dist/arsenal.iife.js +1 -1
  27. package/dist/arsenal.iife.js.map +1 -1
  28. package/dist/arsenal.js +1 -1
  29. package/dist/arsenal.js.map +1 -1
  30. package/dist/async/abortable.cjs +2 -0
  31. package/dist/async/abortable.cjs.map +1 -0
  32. package/dist/async/abortable.d.ts +26 -0
  33. package/dist/async/abortable.d.ts.map +1 -0
  34. package/dist/async/abortable.js +12 -0
  35. package/dist/async/abortable.js.map +1 -0
  36. package/dist/async/backoff.cjs +1 -1
  37. package/dist/async/backoff.cjs.map +1 -1
  38. package/dist/async/backoff.js +1 -2
  39. package/dist/async/backoff.js.map +1 -1
  40. package/dist/async/index.cjs +1 -1
  41. package/dist/async/index.d.ts +1 -0
  42. package/dist/async/index.d.ts.map +1 -1
  43. package/dist/async/index.js +9 -8
  44. package/dist/async/taskPool.cjs.map +1 -1
  45. package/dist/async/taskPool.d.ts +4 -4
  46. package/dist/async/taskPool.d.ts.map +1 -1
  47. package/dist/async/taskPool.js.map +1 -1
  48. package/dist/cache/cache.cjs +1 -1
  49. package/dist/cache/cache.cjs.map +1 -1
  50. package/dist/cache/cache.d.ts.map +1 -1
  51. package/dist/cache/cache.js +1 -1
  52. package/dist/cache/cache.js.map +1 -1
  53. package/dist/cache/memo.cjs.map +1 -1
  54. package/dist/cache/memo.d.ts.map +1 -1
  55. package/dist/cache/memo.js.map +1 -1
  56. package/dist/errors.cjs +1 -1
  57. package/dist/errors.cjs.map +1 -1
  58. package/dist/errors.d.ts +0 -1
  59. package/dist/errors.d.ts.map +1 -1
  60. package/dist/errors.js +1 -4
  61. package/dist/errors.js.map +1 -1
  62. package/dist/function/debounce.cjs.map +1 -1
  63. package/dist/function/debounce.d.ts.map +1 -1
  64. package/dist/function/debounce.js.map +1 -1
  65. package/dist/function/pipe.cjs +1 -1
  66. package/dist/function/pipe.cjs.map +1 -1
  67. package/dist/function/pipe.js +1 -1
  68. package/dist/function/pipe.js.map +1 -1
  69. package/dist/function/runAll.cjs +1 -1
  70. package/dist/function/runAll.cjs.map +1 -1
  71. package/dist/function/runAll.js +1 -1
  72. package/dist/function/runAll.js.map +1 -1
  73. package/dist/index.d.ts +1 -1
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/object/defaults.cjs.map +1 -1
  76. package/dist/object/defaults.d.ts.map +1 -1
  77. package/dist/object/defaults.js.map +1 -1
  78. package/dist/object/diff.cjs.map +1 -1
  79. package/dist/object/diff.d.ts.map +1 -1
  80. package/dist/object/diff.js.map +1 -1
  81. package/dist/object/filterValues.cjs.map +1 -1
  82. package/dist/object/filterValues.d.ts.map +1 -1
  83. package/dist/object/filterValues.js.map +1 -1
  84. package/dist/object/getPath.cjs.map +1 -1
  85. package/dist/object/getPath.d.ts.map +1 -1
  86. package/dist/object/getPath.js.map +1 -1
  87. package/dist/object/mapKeys.cjs.map +1 -1
  88. package/dist/object/mapKeys.d.ts.map +1 -1
  89. package/dist/object/mapKeys.js.map +1 -1
  90. package/dist/object/mapValues.cjs.map +1 -1
  91. package/dist/object/mapValues.d.ts.map +1 -1
  92. package/dist/object/mapValues.js.map +1 -1
  93. package/dist/object/merge.cjs.map +1 -1
  94. package/dist/object/merge.d.ts.map +1 -1
  95. package/dist/object/merge.js.map +1 -1
  96. package/dist/object/omit.cjs.map +1 -1
  97. package/dist/object/omit.d.ts.map +1 -1
  98. package/dist/object/omit.js.map +1 -1
  99. package/dist/object/pick.cjs.map +1 -1
  100. package/dist/object/pick.d.ts.map +1 -1
  101. package/dist/object/pick.js.map +1 -1
  102. package/dist/random/draw.cjs.map +1 -1
  103. package/dist/random/draw.d.ts.map +1 -1
  104. package/dist/random/draw.js.map +1 -1
  105. package/dist/random/random.cjs.map +1 -1
  106. package/dist/random/random.d.ts.map +1 -1
  107. package/dist/random/random.js.map +1 -1
  108. package/dist/random/shuffle.cjs.map +1 -1
  109. package/dist/random/shuffle.d.ts.map +1 -1
  110. package/dist/random/shuffle.js.map +1 -1
  111. package/package.json +32 -27
  112. package/dist/_common/_abortable.d.ts +0 -5
  113. package/dist/_common/_abortable.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.cjs","names":[],"sources":["../../src/array/chunk.ts"],"sourcesContent":["/**\n * Splits an array or string into chunks of a specified size.\n *\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * chunk('hello', 2) // ['he', 'll', 'o']\n * ```\n *\n * @param input - The input array or string to be chunked.\n * @param size - The size of each chunk (default 2).\n *\n * @returns An array of chunks.\n *\n * @throws {TypeError} If the input is not an array or string.\n * @throws {RangeError} If the chunk size is not a positive integer.\n */\nexport function chunk(input: string, size?: number): string[];\nexport function chunk<T>(input: T[], size?: number): T[][];\nexport function chunk<T>(input: T[] | string, size = 2): string[] | T[][] {\n if (!Array.isArray(input) && typeof input !== 'string')\n throw new TypeError('chunk: argument must be an array or string');\n\n if (!Number.isInteger(size) || size < 1) throw new RangeError('chunk: size must be a positive integer');\n\n return Array.from({ length: Math.ceil(input.length / size) }, (_, i) => input.slice(i * size, i * size + size)) as\n string[] | T[][];\n}\n"],"mappings":"AAmBA,SAAgB,EAAS,EAAqB,EAAO,EAAqB,CACxE,GAAI,CAAC,MAAM,QAAQ,CAAK,GAAK,OAAO,GAAU,SAC5C,MAAU,UAAU,4CAA4C,EAElE,GAAI,CAAC,OAAO,UAAU,CAAI,GAAK,EAAO,EAAG,MAAU,WAAW,wCAAwC,EAEtG,OAAO,MAAM,KAAK,CAAE,OAAQ,KAAK,KAAK,EAAM,OAAS,CAAI,CAAE,GAAI,EAAG,IAAM,EAAM,MAAM,EAAI,EAAM,EAAI,EAAO,CAAI,CAAC,CAEhH"}
1
+ {"version":3,"file":"chunk.cjs","names":[],"sources":["../../src/array/chunk.ts"],"sourcesContent":["/**\n * Splits an array or string into chunks of a specified size.\n *\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * chunk('hello', 2) // ['he', 'll', 'o']\n * ```\n *\n * @param input - The input array or string to be chunked.\n * @param size - The size of each chunk (default 2).\n *\n * @returns An array of chunks.\n *\n * @throws {TypeError} If the input is not an array or string.\n * @throws {RangeError} If the chunk size is not a positive integer.\n */\nexport function chunk(input: string, size?: number): string[];\nexport function chunk<T>(input: T[], size?: number): T[][];\nexport function chunk<T>(input: T[] | string, size = 2): string[] | T[][] {\n if (!Array.isArray(input) && typeof input !== 'string')\n throw new TypeError('chunk: argument must be an array or string');\n\n if (!Number.isInteger(size) || size < 1) throw new RangeError('chunk: size must be a positive integer');\n\n return Array.from({ length: Math.ceil(input.length / size) }, (_, i) => input.slice(i * size, i * size + size)) as\n | string[]\n | T[][];\n}\n"],"mappings":"AAmBA,SAAgB,EAAS,EAAqB,EAAO,EAAqB,CACxE,GAAI,CAAC,MAAM,QAAQ,CAAK,GAAK,OAAO,GAAU,SAC5C,MAAU,UAAU,4CAA4C,EAElE,GAAI,CAAC,OAAO,UAAU,CAAI,GAAK,EAAO,EAAG,MAAU,WAAW,wCAAwC,EAEtG,OAAO,MAAM,KAAK,CAAE,OAAQ,KAAK,KAAK,EAAM,OAAS,CAAI,CAAE,GAAI,EAAG,IAAM,EAAM,MAAM,EAAI,EAAM,EAAI,EAAO,CAAI,CAAC,CAGhH"}
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.js","names":[],"sources":["../../src/array/chunk.ts"],"sourcesContent":["/**\n * Splits an array or string into chunks of a specified size.\n *\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * chunk('hello', 2) // ['he', 'll', 'o']\n * ```\n *\n * @param input - The input array or string to be chunked.\n * @param size - The size of each chunk (default 2).\n *\n * @returns An array of chunks.\n *\n * @throws {TypeError} If the input is not an array or string.\n * @throws {RangeError} If the chunk size is not a positive integer.\n */\nexport function chunk(input: string, size?: number): string[];\nexport function chunk<T>(input: T[], size?: number): T[][];\nexport function chunk<T>(input: T[] | string, size = 2): string[] | T[][] {\n if (!Array.isArray(input) && typeof input !== 'string')\n throw new TypeError('chunk: argument must be an array or string');\n\n if (!Number.isInteger(size) || size < 1) throw new RangeError('chunk: size must be a positive integer');\n\n return Array.from({ length: Math.ceil(input.length / size) }, (_, i) => input.slice(i * size, i * size + size)) as\n string[] | T[][];\n}\n"],"mappings":";AAmBA,SAAgB,EAAS,GAAqB,IAAO,GAAqB;CACxE,IAAI,CAAC,MAAM,QAAQ,CAAK,KAAK,OAAO,KAAU,UAC5C,MAAU,UAAU,4CAA4C;CAElE,IAAI,CAAC,OAAO,UAAU,CAAI,KAAK,IAAO,GAAG,MAAU,WAAW,wCAAwC;CAEtG,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,KAAK,EAAM,SAAS,CAAI,EAAE,IAAI,GAAG,MAAM,EAAM,MAAM,IAAI,GAAM,IAAI,IAAO,CAAI,CAAC;AAEhH"}
1
+ {"version":3,"file":"chunk.js","names":[],"sources":["../../src/array/chunk.ts"],"sourcesContent":["/**\n * Splits an array or string into chunks of a specified size.\n *\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * chunk('hello', 2) // ['he', 'll', 'o']\n * ```\n *\n * @param input - The input array or string to be chunked.\n * @param size - The size of each chunk (default 2).\n *\n * @returns An array of chunks.\n *\n * @throws {TypeError} If the input is not an array or string.\n * @throws {RangeError} If the chunk size is not a positive integer.\n */\nexport function chunk(input: string, size?: number): string[];\nexport function chunk<T>(input: T[], size?: number): T[][];\nexport function chunk<T>(input: T[] | string, size = 2): string[] | T[][] {\n if (!Array.isArray(input) && typeof input !== 'string')\n throw new TypeError('chunk: argument must be an array or string');\n\n if (!Number.isInteger(size) || size < 1) throw new RangeError('chunk: size must be a positive integer');\n\n return Array.from({ length: Math.ceil(input.length / size) }, (_, i) => input.slice(i * size, i * size + size)) as\n | string[]\n | T[][];\n}\n"],"mappings":";AAmBA,SAAgB,EAAS,GAAqB,IAAO,GAAqB;CACxE,IAAI,CAAC,MAAM,QAAQ,CAAK,KAAK,OAAO,KAAU,UAC5C,MAAU,UAAU,4CAA4C;CAElE,IAAI,CAAC,OAAO,UAAU,CAAI,KAAK,IAAO,GAAG,MAAU,WAAW,wCAAwC;CAEtG,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,KAAK,EAAM,SAAS,CAAI,EAAE,IAAI,GAAG,MAAM,EAAM,MAAM,IAAI,GAAM,IAAI,IAAO,CAAI,CAAC;AAGhH"}
@@ -1 +1 @@
1
- {"version":3,"file":"countBy.cjs","names":[],"sources":["../../src/array/countBy.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Counts elements in an array by selector output. Selector results of `null`/`undefined` are\n * bucketed under the key `'_'`, matching `groupBy`'s convention. Dangerous keys (`__proto__`,\n * `constructor`, `prototype`) are skipped.\n */\nexport function countBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, number> {\n const out: Record<string, number> = {};\n\n for (let index = 0; index < array.length; index++) {\n const rawKey = selector(array[index]);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n out[key] = (out[key] ?? 0) + 1;\n }\n\n return out;\n}\n"],"mappings":"8CASA,SAAgB,EAAW,EAAY,EAA0D,CAC/F,IAAM,EAA8B,CAAC,EAErC,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IAAS,CACjD,IAAM,EAAS,EAAS,EAAM,EAAM,EAC9B,EAAM,GAAmC,KAAO,IAAM,OAAO,CAAM,EAErE,EAAA,YAAY,CAAG,IAEnB,EAAI,IAAQ,EAAI,IAAQ,GAAK,EAC/B,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"countBy.cjs","names":[],"sources":["../../src/array/countBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Counts elements in an array by selector output. Selector results of `null`/`undefined` are\n * bucketed under the key `'_'`, matching `groupBy`'s convention. Dangerous keys (`__proto__`,\n * `constructor`, `prototype`) are skipped.\n */\nexport function countBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, number> {\n const out: Record<string, number> = {};\n\n for (let index = 0; index < array.length; index++) {\n const rawKey = selector(array[index]);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n out[key] = (out[key] ?? 0) + 1;\n }\n\n return out;\n}\n"],"mappings":"8CAQA,SAAgB,EAAW,EAAY,EAA0D,CAC/F,IAAM,EAA8B,CAAC,EAErC,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IAAS,CACjD,IAAM,EAAS,EAAS,EAAM,EAAM,EAC9B,EAAM,GAAmC,KAAO,IAAM,OAAO,CAAM,EAErE,EAAA,YAAY,CAAG,IAEnB,EAAI,IAAQ,EAAI,IAAQ,GAAK,EAC/B,CAEA,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"countBy.d.ts","sourceRoot":"","sources":["../../src/array/countBy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAa/F"}
1
+ {"version":3,"file":"countBy.d.ts","sourceRoot":"","sources":["../../src/array/countBy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAa/F"}
@@ -1 +1 @@
1
- {"version":3,"file":"countBy.js","names":[],"sources":["../../src/array/countBy.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Counts elements in an array by selector output. Selector results of `null`/`undefined` are\n * bucketed under the key `'_'`, matching `groupBy`'s convention. Dangerous keys (`__proto__`,\n * `constructor`, `prototype`) are skipped.\n */\nexport function countBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, number> {\n const out: Record<string, number> = {};\n\n for (let index = 0; index < array.length; index++) {\n const rawKey = selector(array[index]);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n out[key] = (out[key] ?? 0) + 1;\n }\n\n return out;\n}\n"],"mappings":";;AASA,SAAgB,EAAW,GAAY,GAA0D;CAC/F,IAAM,IAA8B,CAAC;CAErC,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KAAS;EACjD,IAAM,IAAS,EAAS,EAAM,EAAM,GAC9B,IAAM,KAAmC,OAAO,MAAM,OAAO,CAAM;EAErE,EAAY,CAAG,MAEnB,EAAI,MAAQ,EAAI,MAAQ,KAAK;CAC/B;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"countBy.js","names":[],"sources":["../../src/array/countBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Counts elements in an array by selector output. Selector results of `null`/`undefined` are\n * bucketed under the key `'_'`, matching `groupBy`'s convention. Dangerous keys (`__proto__`,\n * `constructor`, `prototype`) are skipped.\n */\nexport function countBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, number> {\n const out: Record<string, number> = {};\n\n for (let index = 0; index < array.length; index++) {\n const rawKey = selector(array[index]);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n out[key] = (out[key] ?? 0) + 1;\n }\n\n return out;\n}\n"],"mappings":";;AAQA,SAAgB,EAAW,GAAY,GAA0D;CAC/F,IAAM,IAA8B,CAAC;CAErC,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KAAS;EACjD,IAAM,IAAS,EAAS,EAAM,EAAM,GAC9B,IAAM,KAAmC,OAAO,MAAM,OAAO,CAAM;EAErE,EAAY,CAAG,MAEnB,EAAI,MAAQ,EAAI,MAAQ,KAAK;CAC/B;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"difference.cjs","names":[],"sources":["../../src/array/difference.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { toSelectorSet } from '../_common/_selectorSet';\n\n/**\n * Returns elements that are in source but not in other.\n */\nexport function difference<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const deny = new Set(other);\n\n return source.filter((item) => !deny.has(item));\n }\n\n const deny = toSelectorSet(other, selector);\n\n return source.filter((item) => !deny.has(selector(item)));\n}\n"],"mappings":"+CAOA,SAAgB,EAAc,EAAa,EAAY,EAAwC,CAC7F,GAAI,CAAC,EAAU,CACb,IAAM,EAAO,IAAI,IAAI,CAAK,EAE1B,OAAO,EAAO,OAAQ,GAAS,CAAC,EAAK,IAAI,CAAI,CAAC,CAChD,CAEA,IAAM,EAAO,EAAA,cAAc,EAAO,CAAQ,EAE1C,OAAO,EAAO,OAAQ,GAAS,CAAC,EAAK,IAAI,EAAS,CAAI,CAAC,CAAC,CAC1D"}
1
+ {"version":3,"file":"difference.cjs","names":[],"sources":["../../src/array/difference.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are in source but not in other.\n */\nexport function difference<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const deny = new Set(other);\n\n return source.filter((item) => !deny.has(item));\n }\n\n const deny = toSelectorSet(other, selector);\n\n return source.filter((item) => !deny.has(selector(item)));\n}\n"],"mappings":"+CAMA,SAAgB,EAAc,EAAa,EAAY,EAAwC,CAC7F,GAAI,CAAC,EAAU,CACb,IAAM,EAAO,IAAI,IAAI,CAAK,EAE1B,OAAO,EAAO,OAAQ,GAAS,CAAC,EAAK,IAAI,CAAI,CAAC,CAChD,CAEA,IAAM,EAAO,EAAA,cAAc,EAAO,CAAQ,EAE1C,OAAO,EAAO,OAAQ,GAAS,CAAC,EAAK,IAAI,EAAS,CAAI,CAAC,CAAC,CAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"difference.d.ts","sourceRoot":"","sources":["../../src/array/difference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU7F"}
1
+ {"version":3,"file":"difference.d.ts","sourceRoot":"","sources":["../../src/array/difference.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"difference.js","names":[],"sources":["../../src/array/difference.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { toSelectorSet } from '../_common/_selectorSet';\n\n/**\n * Returns elements that are in source but not in other.\n */\nexport function difference<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const deny = new Set(other);\n\n return source.filter((item) => !deny.has(item));\n }\n\n const deny = toSelectorSet(other, selector);\n\n return source.filter((item) => !deny.has(selector(item)));\n}\n"],"mappings":";;AAOA,SAAgB,EAAc,GAAa,GAAY,GAAwC;CAC7F,IAAI,CAAC,GAAU;EACb,IAAM,IAAO,IAAI,IAAI,CAAK;EAE1B,OAAO,EAAO,QAAQ,MAAS,CAAC,EAAK,IAAI,CAAI,CAAC;CAChD;CAEA,IAAM,IAAO,EAAc,GAAO,CAAQ;CAE1C,OAAO,EAAO,QAAQ,MAAS,CAAC,EAAK,IAAI,EAAS,CAAI,CAAC,CAAC;AAC1D"}
1
+ {"version":3,"file":"difference.js","names":[],"sources":["../../src/array/difference.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are in source but not in other.\n */\nexport function difference<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const deny = new Set(other);\n\n return source.filter((item) => !deny.has(item));\n }\n\n const deny = toSelectorSet(other, selector);\n\n return source.filter((item) => !deny.has(selector(item)));\n}\n"],"mappings":";;AAMA,SAAgB,EAAc,GAAa,GAAY,GAAwC;CAC7F,IAAI,CAAC,GAAU;EACb,IAAM,IAAO,IAAI,IAAI,CAAK;EAE1B,OAAO,EAAO,QAAQ,MAAS,CAAC,EAAK,IAAI,CAAI,CAAC;CAChD;CAEA,IAAM,IAAO,EAAc,GAAO,CAAQ;CAE1C,OAAO,EAAO,QAAQ,MAAS,CAAC,EAAK,IAAI,EAAS,CAAI,CAAC,CAAC;AAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"groupBy.cjs","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":"8CAQA,SAAgB,EAAW,EAAY,EAAuD,CAC5F,IAAM,EAA8B,CAAC,EAErC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAS,EAAS,CAAI,EACtB,EAAM,GAAmC,KAAO,IAAM,OAAO,CAAM,EAErE,EAAA,YAAY,CAAG,IAEd,EAAO,KACV,EAAO,GAAO,CAAC,GAGjB,EAAO,EAAI,CAAC,KAAK,CAAI,EACvB,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"groupBy.cjs","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":"8CAOA,SAAgB,EAAW,EAAY,EAAuD,CAC5F,IAAM,EAA8B,CAAC,EAErC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAS,EAAS,CAAI,EACtB,EAAM,GAAmC,KAAO,IAAM,OAAO,CAAM,EAErE,EAAA,YAAY,CAAG,IAEd,EAAO,KACV,EAAO,GAAO,CAAC,GAGjB,EAAO,EAAI,CAAC,KAAK,CAAI,EACvB,CAEA,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"groupBy.d.ts","sourceRoot":"","sources":["../../src/array/groupBy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAiB5F"}
1
+ {"version":3,"file":"groupBy.d.ts","sourceRoot":"","sources":["../../src/array/groupBy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAiB5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"groupBy.js","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":";;AAQA,SAAgB,EAAW,GAAY,GAAuD;CAC5F,IAAM,IAA8B,CAAC;CAErC,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAM,IAAS,EAAS,CAAI,GACtB,IAAM,KAAmC,OAAO,MAAM,OAAO,CAAM;EAErE,EAAY,CAAG,MAEd,EAAO,OACV,EAAO,KAAO,CAAC,IAGjB,EAAO,EAAI,CAAC,KAAK,CAAI;CACvB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"groupBy.js","names":[],"sources":["../../src/array/groupBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n"],"mappings":";;AAOA,SAAgB,EAAW,GAAY,GAAuD;CAC5F,IAAM,IAA8B,CAAC;CAErC,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAM,IAAS,EAAS,CAAI,GACtB,IAAM,KAAmC,OAAO,MAAM,OAAO,CAAM;EAErE,EAAY,CAAG,MAEd,EAAO,OACV,EAAO,KAAO,CAAC,IAGjB,EAAO,EAAI,CAAC,KAAK,CAAI;CACvB;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"indexBy.cjs","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":"8CAQA,SAAgB,EAAW,EAAY,EAAqD,CAC1F,IAAM,EAA4B,CAAC,EAEnC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,OAAO,EAAS,CAAI,CAAC,EAE7B,EAAA,YAAY,CAAG,IAEnB,EAAO,GAAO,EAChB,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"indexBy.cjs","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":"8CAOA,SAAgB,EAAW,EAAY,EAAqD,CAC1F,IAAM,EAA4B,CAAC,EAEnC,IAAK,IAAM,KAAQ,EAAO,CACxB,IAAM,EAAM,OAAO,EAAS,CAAI,CAAC,EAE7B,EAAA,YAAY,CAAG,IAEnB,EAAO,GAAO,EAChB,CAEA,OAAO,CACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"indexBy.d.ts","sourceRoot":"","sources":["../../src/array/indexBy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAY1F"}
1
+ {"version":3,"file":"indexBy.d.ts","sourceRoot":"","sources":["../../src/array/indexBy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAY1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"indexBy.js","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":";;AAQA,SAAgB,EAAW,GAAY,GAAqD;CAC1F,IAAM,IAA4B,CAAC;CAEnC,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAM,IAAM,OAAO,EAAS,CAAI,CAAC;EAE7B,EAAY,CAAG,MAEnB,EAAO,KAAO;CAChB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"indexBy.js","names":[],"sources":["../../src/array/indexBy.ts"],"sourcesContent":["import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n"],"mappings":";;AAOA,SAAgB,EAAW,GAAY,GAAqD;CAC1F,IAAM,IAA4B,CAAC;CAEnC,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAM,IAAM,OAAO,EAAS,CAAI,CAAC;EAE7B,EAAY,CAAG,MAEnB,EAAO,KAAO;CAChB;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { toSelectorSet } from '../_common/_selectorSet';\n\n/**\n * Returns elements that are present in both arrays.\n */\nexport function intersection<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":"+CAOA,SAAgB,EAAgB,EAAa,EAAY,EAAwC,CAC/F,GAAI,CAAC,EAAU,CACb,IAAM,EAAQ,IAAI,IAAI,CAAK,EAE3B,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,CAAI,CAAC,CAChD,CAEA,IAAM,EAAQ,EAAA,cAAc,EAAO,CAAQ,EAE3C,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,EAAS,CAAI,CAAC,CAAC,CAC1D"}
1
+ {"version":3,"file":"intersection.cjs","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are present in both arrays.\n */\nexport function intersection<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":"+CAMA,SAAgB,EAAgB,EAAa,EAAY,EAAwC,CAC/F,GAAI,CAAC,EAAU,CACb,IAAM,EAAQ,IAAI,IAAI,CAAK,EAE3B,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,CAAI,CAAC,CAChD,CAEA,IAAM,EAAQ,EAAA,cAAc,EAAO,CAAQ,EAE3C,OAAO,EAAO,OAAQ,GAAS,EAAM,IAAI,EAAS,CAAI,CAAC,CAAC,CAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"intersection.d.ts","sourceRoot":"","sources":["../../src/array/intersection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU/F"}
1
+ {"version":3,"file":"intersection.d.ts","sourceRoot":"","sources":["../../src/array/intersection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU/F"}
@@ -1 +1 @@
1
- {"version":3,"file":"intersection.js","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { toSelectorSet } from '../_common/_selectorSet';\n\n/**\n * Returns elements that are present in both arrays.\n */\nexport function intersection<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":";;AAOA,SAAgB,EAAgB,GAAa,GAAY,GAAwC;CAC/F,IAAI,CAAC,GAAU;EACb,IAAM,IAAQ,IAAI,IAAI,CAAK;EAE3B,OAAO,EAAO,QAAQ,MAAS,EAAM,IAAI,CAAI,CAAC;CAChD;CAEA,IAAM,IAAQ,EAAc,GAAO,CAAQ;CAE3C,OAAO,EAAO,QAAQ,MAAS,EAAM,IAAI,EAAS,CAAI,CAAC,CAAC;AAC1D"}
1
+ {"version":3,"file":"intersection.js","names":[],"sources":["../../src/array/intersection.ts"],"sourcesContent":["import { toSelectorSet } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns elements that are present in both arrays.\n */\nexport function intersection<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n const allow = new Set(other);\n\n return source.filter((item) => allow.has(item));\n }\n\n const allow = toSelectorSet(other, selector);\n\n return source.filter((item) => allow.has(selector(item)));\n}\n"],"mappings":";;AAMA,SAAgB,EAAgB,GAAa,GAAY,GAAwC;CAC/F,IAAI,CAAC,GAAU;EACb,IAAM,IAAQ,IAAI,IAAI,CAAK;EAE3B,OAAO,EAAO,QAAQ,MAAS,EAAM,IAAI,CAAI,CAAC;CAChD;CAEA,IAAM,IAAQ,EAAc,GAAO,CAAQ;CAE3C,OAAO,EAAO,QAAQ,MAAS,EAAM,IAAI,EAAS,CAAI,CAAC,CAAC;AAC1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"union.cjs","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { dedupeBySelector } from '../_common/_selectorSet';\n\n/**\n * Returns a deduplicated union of both arrays.\n */\nexport function union<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n return [...new Set([...source, ...other])];\n }\n\n return dedupeBySelector([...source, ...other], selector);\n}\n"],"mappings":"+CAOA,SAAgB,EAAS,EAAa,EAAY,EAAwC,CAKxF,OAJK,EAIE,EAAA,iBAAiB,CAAC,GAAG,EAAQ,GAAG,CAAK,EAAG,CAAQ,EAH9C,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAQ,GAAG,CAAK,CAAC,CAAC,CAI7C"}
1
+ {"version":3,"file":"union.cjs","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns a deduplicated union of both arrays.\n */\nexport function union<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n return [...new Set([...source, ...other])];\n }\n\n return dedupeBySelector([...source, ...other], selector);\n}\n"],"mappings":"+CAMA,SAAgB,EAAS,EAAa,EAAY,EAAwC,CAKxF,OAJK,EAIE,EAAA,iBAAiB,CAAC,GAAG,EAAQ,GAAG,CAAK,EAAG,CAAQ,EAH9C,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAQ,GAAG,CAAK,CAAC,CAAC,CAI7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/array/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAMxF"}
1
+ {"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../src/array/union.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAMxF"}
@@ -1 +1 @@
1
- {"version":3,"file":"union.js","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { dedupeBySelector } from '../_common/_selectorSet';\n\n/**\n * Returns a deduplicated union of both arrays.\n */\nexport function union<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n return [...new Set([...source, ...other])];\n }\n\n return dedupeBySelector([...source, ...other], selector);\n}\n"],"mappings":";;AAOA,SAAgB,EAAS,GAAa,GAAY,GAAwC;CAKxF,OAJK,IAIE,EAAiB,CAAC,GAAG,GAAQ,GAAG,CAAK,GAAG,CAAQ,IAH9C,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,GAAQ,GAAG,CAAK,CAAC,CAAC;AAI7C"}
1
+ {"version":3,"file":"union.js","names":[],"sources":["../../src/array/union.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Returns a deduplicated union of both arrays.\n */\nexport function union<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[] {\n if (!selector) {\n return [...new Set([...source, ...other])];\n }\n\n return dedupeBySelector([...source, ...other], selector);\n}\n"],"mappings":";;AAMA,SAAgB,EAAS,GAAa,GAAY,GAAwC;CAKxF,OAJK,IAIE,EAAiB,CAAC,GAAG,GAAQ,GAAG,CAAK,GAAG,CAAQ,IAH9C,CAAC,mBAAG,IAAI,IAAI,CAAC,GAAG,GAAQ,GAAG,CAAK,CAAC,CAAC;AAI7C"}
@@ -1 +1 @@
1
- {"version":3,"file":"uniq.cjs","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { dedupeBySelector } from '../_common/_selectorSet';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":"+CAmBA,SAAgB,EAAQ,EAAY,EAAwC,CAS1E,OARI,EAAM,QAAU,EACX,CAAC,GAAG,CAAK,EAGb,EAIE,EAAA,iBAAiB,EAAO,CAAQ,EAH9B,CAAC,GAAG,IAAI,IAAI,CAAK,CAAC,CAI7B"}
1
+ {"version":3,"file":"uniq.cjs","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":"+CAkBA,SAAgB,EAAQ,EAAY,EAAwC,CAS1E,OARI,EAAM,QAAU,EACX,CAAC,GAAG,CAAK,EAGb,EAIE,EAAA,iBAAiB,EAAO,CAAQ,EAH9B,CAAC,GAAG,IAAI,IAAI,CAAK,CAAC,CAI7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/array/uniq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAI1C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU1E"}
1
+ {"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/array/uniq.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"uniq.js","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import type { Primitive } from '../types';\n\nimport { dedupeBySelector } from '../_common/_selectorSet';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":";;AAmBA,SAAgB,EAAQ,GAAY,GAAwC;CAS1E,OARI,EAAM,UAAU,IACX,CAAC,GAAG,CAAK,IAGb,IAIE,EAAiB,GAAO,CAAQ,IAH9B,CAAC,GAAG,IAAI,IAAI,CAAK,CAAC;AAI7B"}
1
+ {"version":3,"file":"uniq.js","names":[],"sources":["../../src/array/uniq.ts"],"sourcesContent":["import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n"],"mappings":";;AAkBA,SAAgB,EAAQ,GAAY,GAAwC;CAS1E,OARI,EAAM,UAAU,IACX,CAAC,GAAG,CAAK,IAGb,IAIE,EAAiB,GAAO,CAAQ,IAH9B,CAAC,GAAG,IAAI,IAAI,CAAK,CAAC;AAI7B"}
package/dist/arsenal.cjs CHANGED
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=class e extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}static is(t){return t instanceof e}},t=class extends e{};function n(e,t=2){if(!Array.isArray(e)&&typeof e!=`string`)throw TypeError(`chunk: argument must be an array or string`);if(!Number.isInteger(t)||t<1)throw RangeError(`chunk: size must be a positive integer`);return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))}function r(e,t){let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);i!==void 0&&n.push(i)}return n}var i=new Set([`__proto__`,`constructor`,`prototype`]);function a(e){return typeof e==`string`&&i.has(e)}function o(e,t){let n={};for(let r of e){let e=t(r),i=e==null?`_`:String(e);a(i)||(n[i]||(n[i]=[]),n[i].push(r))}return n}function s(e,t){let n={};for(let r of e){let e=String(t(r));a(e)||(n[e]=r)}return n}function c(e,t){let n=[],r=[];for(let i=0;i<e.length;i++)t(e[i],i,e)?n.push(e[i]):r.push(e[i]);return[n,r]}var l=(e,t)=>{if(e===t)return 0;if(e===void 0)return 1;if(t===void 0)return-1;if(e===null)return t===null?0:-1;if(t===null)return 1;if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`number`&&typeof t==`number`)return e===t?0:e>t?1:-1;if(e instanceof Date&&t instanceof Date){let n=e.getTime(),r=t.getTime();return n===r?0:n>r?1:-1}throw TypeError(`compare: unsupported types "${typeof e}" and "${typeof t}". Supported: number, string, Date, null, undefined.`)},u=e=>{let t=Object.entries(e);return(e,n)=>{for(let[r,i]of t){let t=e[r],a=n[r],o=i===`desc`?-1:1,s=l(t,a);if(s!==0)return s*o}return 0}};function d(e,t,n=`asc`){if(!Array.isArray(e))throw TypeError(`sort: first argument must be an array`);if(typeof t==`function`){let r=n===`desc`?-1:1;return[...e].sort((e,n)=>l(t(e),t(n))*r)}return[...e].sort(u(t))}function f(e,t){let n=new Set,r=[];for(let i of e){let e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}function p(e,t){return e.length<=1?[...e]:t?f(e,t):[...new Set(e)]}function m(e){return e.ok===!0}function h(e){return e.ok===!1}async function g(e){try{return{ok:!0,value:await e()}}catch(e){return{error:e,ok:!1}}}function _(e){return e?.reason??new DOMException(`Aborted`,`AbortError`)}async function v(e,t,n={}){let{abortOnError:r=!1,limit:i=1/0,signal:a}=n;if(i<1)throw RangeError(`parallel: limit must be at least 1, got ${i}`);if(a?.aborted)throw _(a);if(e.length===0)return[];let o=Array(e.length),s=0,c=r?new AbortController:void 0,l=async()=>{for(;;){if(a?.aborted)throw _(a);if(c?.signal.aborted||s>=e.length)return;let n=s++;try{o[n]=await t(e[n],n,e)}catch(e){throw c?.abort(),e}}},u=Math.min(i,e.length),d=Array.from({length:u},()=>l());return await Promise.all(d),o}async function y(e,t){return t?t.aborted?Promise.reject(_(t)):new Promise((n,r)=>{let i=setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),t.removeEventListener(`abort`,a),r(_(t))};t.addEventListener(`abort`,a)}):new Promise(t=>setTimeout(t,e))}function b(e,t){let n=[e===void 0?void 0:AbortSignal.timeout(e),t].filter(e=>e!=null);if(n.length!==0)return n.length===1?n[0]:AbortSignal.any(n)}async function x(e,{delay:t=250,onError:n,shouldRetry:r,signal:i,timeout:a,times:o=3}={}){if(!Number.isInteger(o)||o<1)throw RangeError(`retry: times must be a positive integer, got ${o}`);for(let s=1;s<=o;s++){if(i?.aborted)throw _(i);let c=b(a,i);try{return await e(c)}catch(e){if(s===o||r&&!r(e,s-1))throw n?.(e),e;let a=typeof t==`function`?t(s-1):t;a>0&&await y(a,i)}}}function S(e,t=300,n={leading:!1,trailing:!0}){let r=n.leading??!1,i=n.trailing??!0,a,o,s,c=!1,l=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},u=()=>{if(l(),c=!1,!o)return;let t=o;return o=void 0,s=e(...t),s};return Object.assign((...n)=>(o=n,r&&!c&&(c=!0,s=e(...n),o=void 0,!i)?(a=setTimeout(()=>{a=void 0,c=!1},t),s):r&&!i&&c?s:(l(),a=setTimeout(u,t),s)),{cancel:()=>{l(),o=void 0,c=!1},flush:()=>u(),pending:()=>a!==void 0})}var C=e=>{let t,n=!1,r=((...r)=>(n||=(t=e(...r),!0),t));return r.reset=()=>{t=void 0,n=!1},r};function w(...e){if(e.length===0)return e=>e;let[t,...n]=e;return(...e)=>n.reduce((e,t)=>Reflect.apply(t,void 0,[e]),Reflect.apply(t,void 0,e))}function T(e,t=700,n={leading:!0,trailing:!1}){let r=n.leading??!0,i=n.trailing??!1,a,o=-1/0,s,c,l=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},u=e=>{a=setTimeout(p,e)},d=t=>{if(o=t,l(),!s)return;let n=s;return s=void 0,c=e(...n),c},f=e=>t-(e-o),p=()=>{let e=Date.now();s&&f(e)<=0?d(e):s?u(f(e)):l()};return Object.assign((...e)=>{let t=Date.now();o===-1/0&&!r&&(o=t),s=e;let n=f(t);return n<=0?d(t):(i&&!a&&u(n),c)},{cancel:()=>{l(),s=void 0,o=-1/0},flush:()=>{if(s)return d(Date.now())},pending:()=>s!==void 0||a!==void 0})}function E(...e){return t=>e.every(e=>e(t))}function D(...e){return t=>e.some(e=>e(t))}function O(...e){return t=>e.every(e=>!e(t))}function k(e){return t=>!e(t)}function A(e){return e!==void 0}function j(e,t){return M(e,t,new WeakMap)}function M(e,t,n){if(e===t)return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`||typeof t!=`object`)return!1;if(n.has(e))return n.get(e)===t;if(n.set(e,t),Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,r)=>M(e,t[r],n));if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[r,i]of e)if(!t.has(r)||!M(i,t.get(r),n))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;let r=[...t];for(let i of e)if(typeof i==`string`||typeof i==`number`||typeof i==`boolean`||i==null){if(!t.has(i))return!1}else if(!r.some(e=>M(i,e,n)))return!1;return!0}if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.source===t.source&&e.flags===t.flags;if(e instanceof Map||t instanceof Map||e instanceof Set||t instanceof Set)return!1;let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let i of r)if(!Object.hasOwn(t,i)||!M(e[i],t[i],n))return!1;return!0}function N(e){return e==null}function P(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function F(e,t,n){return t!=null&&e<t?t:n!=null&&e>n?n:e}function I(e,t,n){let[r,i,a]=t===void 0?[0,e,1]:n===void 0?[e,t,1]:[e,t,n];if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))throw RangeError(`range: start, stop, and step must be finite numbers`);if(a===0)throw RangeError(`range: step cannot be 0`);if(r===i)return[];let o=(i-r)/a,s=Math.max(0,Number.isInteger(o)?o:Math.ceil(o+2**-52));if(s>1e7)throw RangeError(`range: exceeds maximum allowed size of 10,000,000`);return Array.from({length:s},(e,t)=>r+t*a)}function L(e){return e.replace(/\[(\d+)\]/g,`.$1`).replace(/^\.|\.$/g,``).split(`.`).filter(Boolean)}function R(e,t){let n=e;for(let e of L(t))if(i.has(e)||typeof n!=`object`||!n||(n=n[e],n===void 0))return;return n}function z(e,t){return R(e,t)}function B(e,t,n){let r=R(e,t);return r===void 0?n:r}function V(e,t){let n=R(e,t);if(n===void 0)throw TypeError(`Path does not exist: '${t}'`);return n}function H(e,n,r){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`bigint`)return`${e}n`;if(typeof e!=`object`)return JSON.stringify(e);if(r.has(e))return`[Circular]`;if(r.add(e),e instanceof Date)return`[Date:${Number.isNaN(e.getTime())?`Invalid`:e.toISOString()}]`;if(e instanceof RegExp)return`[RegExp:${e.source}/${e.flags}]`;if(e instanceof Set)return`[Set:${[...e].map(e=>H(e,n,r)).sort().join(`,`)}]`;if(e instanceof Map)return`[Map:${[...e.entries()].map(([e,t])=>[H(e,n,r),H(t,n,r)]).sort(([e,t],[n,r])=>e===n?t.localeCompare(r):e.localeCompare(n)).map(([e,t])=>`${e}=>${t}`).join(`,`)}]`;if(Array.isArray(e))return`[${e.map(e=>H(e,n,r)).join(`,`)}]`;let i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null){if(n?.onClassInstance===`throw`)throw new t(`hash: unsupported type ${e.constructor?.name??`unknown`}`);return String(e)}let a=e;return`{${Object.keys(a).filter(e=>a[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${H(a[e],n,r)}`).join(`,`)}}`}function U(e,t){return H(e,t,new Set)}function W(e,t){let n=new Set(t),r={};for(let t of Object.keys(e))a(t)||n.has(t)||(r[t]=e[t]);return r}function G(e,t){let n={};for(let r of t)a(r)||Object.hasOwn(e,r)&&(n[r]=e[r]);return n}function K(){return crypto.randomUUID()}var q=/(\p{Ll})(\p{Lu}|\p{N})|(\p{Lu}|\p{N})(\p{Lu}\p{Ll})|(\p{N})(\p{L})/gu;function J(e){return e.replace(/[.*+?^${}()|[\]\\/-]/g,`\\$&`)}function Y(e,t=` `){let n=J(t);return e.trim().replace(q,`$1$3$5${t}$2$4$6`).replace(/[^\p{L}\p{N}]+/gu,t).replace(RegExp(`^(?:${n})+|(?:${n})+$`,`g`),``)}function X(e){return Y(e,` `).replace(/[^\p{L}\p{N}]+(.)/gu,(e,t)=>t.toUpperCase()).replace(/^./,e=>e.toLowerCase())}exports.ArsenalError=e,exports.ArsenalSerializationError=t,exports.allOf=E,exports.anyOf=D,exports.attempt=g,exports.camelCase=X,exports.chunk=n,exports.clamp=F,exports.debounce=S,exports.filterMap=r,exports.getPath=z,exports.getPathOr=B,exports.groupBy=o,exports.hash=U,exports.indexBy=s,exports.isDefined=A,exports.isEqual=j,exports.isFail=h,exports.isNil=N,exports.isOk=m,exports.isPlainObject=P,exports.noneOf=O,exports.not=k,exports.omit=W,exports.once=C,exports.parallel=v,exports.partition=c,exports.pick=G,exports.pipe=w,exports.range=I,exports.requirePath=V,exports.retry=x,exports.sleep=y,exports.sort=d,exports.throttle=T,exports.uniq=p,exports.uuid=K;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t=2){if(!Array.isArray(e)&&typeof e!=`string`)throw TypeError(`chunk: argument must be an array or string`);if(!Number.isInteger(t)||t<1)throw RangeError(`chunk: size must be a positive integer`);return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,r*t+t))}function t(e,t){let n=[];for(let r=0;r<e.length;r++){let i=t(e[r],r,e);i!==void 0&&n.push(i)}return n}var n=new Set([`__proto__`,`constructor`,`prototype`]);function r(e){return typeof e==`string`&&n.has(e)}function i(e,t){let n={};for(let i of e){let e=t(i),a=e==null?`_`:String(e);r(a)||(n[a]||(n[a]=[]),n[a].push(i))}return n}function a(e,t){let n={};for(let i of e){let e=String(t(i));r(e)||(n[e]=i)}return n}function o(e,t){let n=[],r=[];for(let i=0;i<e.length;i++)t(e[i],i,e)?n.push(e[i]):r.push(e[i]);return[n,r]}var s=(e,t)=>{if(e===t)return 0;if(e===void 0)return 1;if(t===void 0)return-1;if(e===null)return t===null?0:-1;if(t===null)return 1;if(typeof e==`string`&&typeof t==`string`)return e.localeCompare(t);if(typeof e==`number`&&typeof t==`number`)return e===t?0:e>t?1:-1;if(e instanceof Date&&t instanceof Date){let n=e.getTime(),r=t.getTime();return n===r?0:n>r?1:-1}throw TypeError(`compare: unsupported types "${typeof e}" and "${typeof t}". Supported: number, string, Date, null, undefined.`)},c=e=>{let t=Object.entries(e);return(e,n)=>{for(let[r,i]of t){let t=e[r],a=n[r],o=i===`desc`?-1:1,c=s(t,a);if(c!==0)return c*o}return 0}};function l(e,t,n=`asc`){if(!Array.isArray(e))throw TypeError(`sort: first argument must be an array`);if(typeof t==`function`){let r=n===`desc`?-1:1;return[...e].sort((e,n)=>s(t(e),t(n))*r)}return[...e].sort(c(t))}function u(e,t){let n=new Set,r=[];for(let i of e){let e=t(i);n.has(e)||(n.add(e),r.push(i))}return r}function d(e,t){return e.length<=1?[...e]:t?u(e,t):[...new Set(e)]}function f(e){return e.ok===!0}function p(e){return e.ok===!1}async function m(e){try{return{ok:!0,value:await e()}}catch(e){return{error:e,ok:!1}}}function h(e){return e?.reason??new DOMException(`Aborted`,`AbortError`)}async function g(e,t,n={}){let{abortOnError:r=!1,limit:i=1/0,signal:a}=n;if(i<1)throw RangeError(`parallel: limit must be at least 1, got ${i}`);if(a?.aborted)throw h(a);if(e.length===0)return[];let o=Array(e.length),s=0,c=r?new AbortController:void 0,l=async()=>{for(;;){if(a?.aborted)throw h(a);if(c?.signal.aborted||s>=e.length)return;let n=s++;try{o[n]=await t(e[n],n,e)}catch(e){throw c?.abort(),e}}},u=Math.min(i,e.length),d=Array.from({length:u},()=>l());return await Promise.all(d),o}async function _(e,t){return t?t.aborted?Promise.reject(h(t)):new Promise((n,r)=>{let i=setTimeout(()=>{t.removeEventListener(`abort`,a),n()},e),a=()=>{clearTimeout(i),t.removeEventListener(`abort`,a),r(h(t))};t.addEventListener(`abort`,a)}):new Promise(t=>setTimeout(t,e))}function v(e,t){let n=[e===void 0?void 0:AbortSignal.timeout(e),t].filter(e=>e!=null);if(n.length!==0)return n.length===1?n[0]:AbortSignal.any(n)}async function y(e,{delay:t=250,onError:n,shouldRetry:r,signal:i,timeout:a,times:o=3}={}){if(!Number.isInteger(o)||o<1)throw RangeError(`retry: times must be a positive integer, got ${o}`);for(let s=1;s<=o;s++){if(i?.aborted)throw h(i);let c=v(a,i);try{return await e(c)}catch(e){if(s===o||r&&!r(e,s-1))throw n?.(e),e;let a=typeof t==`function`?t(s-1):t;a>0&&await _(a,i)}}}var b=class extends Error{constructor(e,t){super(e,t),this.name=new.target.name,Object.setPrototypeOf(this,new.target.prototype)}},x=class extends b{};function S(e,t=300,n={leading:!1,trailing:!0}){let r=n.leading??!1,i=n.trailing??!0,a,o,s,c=!1,l=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},u=()=>{if(l(),c=!1,!o)return;let t=o;return o=void 0,s=e(...t),s};return Object.assign((...n)=>(o=n,r&&!c&&(c=!0,s=e(...n),o=void 0,!i)?(a=setTimeout(()=>{a=void 0,c=!1},t),s):r&&!i&&c?s:(l(),a=setTimeout(u,t),s)),{cancel:()=>{l(),o=void 0,c=!1},flush:()=>u(),pending:()=>a!==void 0})}var C=e=>{let t,n=!1,r=((...r)=>(n||=(t=e(...r),!0),t));return r.reset=()=>{t=void 0,n=!1},r};function w(...e){if(e.length===0)return e=>e;let[t,...n]=e;return(...e)=>n.reduce((e,t)=>t(e),t(...e))}function T(e,t=700,n={leading:!0,trailing:!1}){let r=n.leading??!0,i=n.trailing??!1,a,o=-1/0,s,c,l=()=>{a!==void 0&&(clearTimeout(a),a=void 0)},u=e=>{a=setTimeout(p,e)},d=t=>{if(o=t,l(),!s)return;let n=s;return s=void 0,c=e(...n),c},f=e=>t-(e-o),p=()=>{let e=Date.now();s&&f(e)<=0?d(e):s?u(f(e)):l()};return Object.assign((...e)=>{let t=Date.now();o===-1/0&&!r&&(o=t),s=e;let n=f(t);return n<=0?d(t):(i&&!a&&u(n),c)},{cancel:()=>{l(),s=void 0,o=-1/0},flush:()=>{if(s)return d(Date.now())},pending:()=>s!==void 0||a!==void 0})}function E(...e){return t=>e.every(e=>e(t))}function D(...e){return t=>e.some(e=>e(t))}function O(...e){return t=>e.every(e=>!e(t))}function k(e){return t=>!e(t)}function A(e){return e!==void 0}function j(e,t){return M(e,t,new WeakMap)}function M(e,t,n){if(e===t)return!0;if(e==null||t==null||typeof e!=typeof t||typeof e!=`object`||typeof t!=`object`)return!1;if(n.has(e))return n.get(e)===t;if(n.set(e,t),Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,r)=>M(e,t[r],n));if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[r,i]of e)if(!t.has(r)||!M(i,t.get(r),n))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;let r=[...t];for(let i of e)if(typeof i==`string`||typeof i==`number`||typeof i==`boolean`||i==null){if(!t.has(i))return!1}else if(!r.some(e=>M(i,e,n)))return!1;return!0}if(e instanceof RegExp||t instanceof RegExp)return e instanceof RegExp&&t instanceof RegExp&&e.source===t.source&&e.flags===t.flags;if(e instanceof Map||t instanceof Map||e instanceof Set||t instanceof Set)return!1;let r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(let i of r)if(!Object.hasOwn(t,i)||!M(e[i],t[i],n))return!1;return!0}function N(e){return e==null}function P(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function F(e,t,n){return t!=null&&e<t?t:n!=null&&e>n?n:e}function I(e,t,n){let[r,i,a]=t===void 0?[0,e,1]:n===void 0?[e,t,1]:[e,t,n];if(!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a))throw RangeError(`range: start, stop, and step must be finite numbers`);if(a===0)throw RangeError(`range: step cannot be 0`);if(r===i)return[];let o=(i-r)/a,s=Math.max(0,Number.isInteger(o)?o:Math.ceil(o+2**-52));if(s>1e7)throw RangeError(`range: exceeds maximum allowed size of 10,000,000`);return Array.from({length:s},(e,t)=>r+t*a)}function L(e){return e.replace(/\[(\d+)\]/g,`.$1`).replace(/^\.|\.$/g,``).split(`.`).filter(Boolean)}function R(e,t){let r=e;for(let e of L(t))if(n.has(e)||typeof r!=`object`||!r||(r=r[e],r===void 0))return;return r}function z(e,t){return R(e,t)}function B(e,t,n){let r=R(e,t);return r===void 0?n:r}function V(e,t){let n=R(e,t);if(n===void 0)throw TypeError(`Path does not exist: '${t}'`);return n}function H(e,t,n){if(e===void 0)return`undefined`;if(e===null)return`null`;if(typeof e==`bigint`)return`${e}n`;if(typeof e!=`object`)return JSON.stringify(e);if(n.has(e))return`[Circular]`;if(n.add(e),e instanceof Date)return`[Date:${Number.isNaN(e.getTime())?`Invalid`:e.toISOString()}]`;if(e instanceof RegExp)return`[RegExp:${e.source}/${e.flags}]`;if(e instanceof Set)return`[Set:${[...e].map(e=>H(e,t,n)).sort().join(`,`)}]`;if(e instanceof Map)return`[Map:${[...e.entries()].map(([e,r])=>[H(e,t,n),H(r,t,n)]).sort(([e,t],[n,r])=>e===n?t.localeCompare(r):e.localeCompare(n)).map(([e,t])=>`${e}=>${t}`).join(`,`)}]`;if(Array.isArray(e))return`[${e.map(e=>H(e,t,n)).join(`,`)}]`;let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null){if(t?.onClassInstance===`throw`)throw new x(`hash: unsupported type ${e.constructor?.name??`unknown`}`);return String(e)}let i=e;return`{${Object.keys(i).filter(e=>i[e]!==void 0).sort().map(e=>`${JSON.stringify(e)}:${H(i[e],t,n)}`).join(`,`)}}`}function U(e,t){return H(e,t,new Set)}function W(e,t){let n=new Set(t),i={};for(let t of Object.keys(e))r(t)||n.has(t)||(i[t]=e[t]);return i}function G(e,t){let n={};for(let i of t)r(i)||Object.hasOwn(e,i)&&(n[i]=e[i]);return n}function K(){return crypto.randomUUID()}var q=/(\p{Ll})(\p{Lu}|\p{N})|(\p{Lu}|\p{N})(\p{Lu}\p{Ll})|(\p{N})(\p{L})/gu;function J(e){return e.replace(/[.*+?^${}()|[\]\\/-]/g,`\\$&`)}function Y(e,t=` `){let n=J(t);return e.trim().replace(q,`$1$3$5${t}$2$4$6`).replace(/[^\p{L}\p{N}]+/gu,t).replace(RegExp(`^(?:${n})+|(?:${n})+$`,`g`),``)}function X(e){return Y(e,` `).replace(/[^\p{L}\p{N}]+(.)/gu,(e,t)=>t.toUpperCase()).replace(/^./,e=>e.toLowerCase())}exports.ArsenalError=b,exports.ArsenalSerializationError=x,exports.allOf=E,exports.anyOf=D,exports.attempt=m,exports.camelCase=X,exports.chunk=e,exports.clamp=F,exports.debounce=S,exports.filterMap=t,exports.getPath=z,exports.getPathOr=B,exports.groupBy=i,exports.hash=U,exports.indexBy=a,exports.isDefined=A,exports.isEqual=j,exports.isFail=p,exports.isNil=N,exports.isOk=f,exports.isPlainObject=P,exports.noneOf=O,exports.not=k,exports.omit=W,exports.once=C,exports.parallel=g,exports.partition=o,exports.pick=G,exports.pipe=w,exports.range=I,exports.requirePath=V,exports.retry=y,exports.sleep=_,exports.sort=l,exports.throttle=T,exports.uniq=d,exports.uuid=K;
2
2
  //# sourceMappingURL=arsenal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"arsenal.cjs","names":[],"sources":["../src/errors.ts","../src/array/chunk.ts","../src/array/filterMap.ts","../src/_common/unsafePaths.ts","../src/array/groupBy.ts","../src/array/indexBy.ts","../src/array/partition.ts","../src/array/compare.ts","../src/array/compareBy.ts","../src/array/sort.ts","../src/_common/_selectorSet.ts","../src/array/uniq.ts","../src/async/attempt.ts","../src/async/abortError.ts","../src/async/parallel.ts","../src/async/sleep.ts","../src/async/retry.ts","../src/_dev.ts","../src/function/debounce.ts","../src/function/once.ts","../src/function/pipe.ts","../src/function/throttle.ts","../src/guards/combinators.ts","../src/guards/isDefined.ts","../src/guards/isEqual.ts","../src/guards/isNil.ts","../src/guards/isPlainObject.ts","../src/math/clamp.ts","../src/math/range.ts","../src/object/getPath.ts","../src/object/hash.ts","../src/object/omit.ts","../src/object/pick.ts","../src/random/uuid.ts","../src/string/_caseUtils.ts","../src/string/camelCase.ts"],"sourcesContent":["/** Base class for all arsenal errors. Use `instanceof ArsenalError` to catch any arsenal-originated error. */\nexport class ArsenalError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n\n static is(err: unknown): err is ArsenalError {\n return err instanceof ArsenalError;\n }\n}\n\n/**\n * Thrown when converting a value to or from its serialized form fails — e.g. `memo`'s default\n * cache key (`JSON.stringify`) encountering a circular reference, or `hash` encountering an\n * unsupported class instance with `{ onClassInstance: 'throw' }`.\n */\nexport class ArsenalSerializationError extends ArsenalError {}\n","/**\n * Splits an array or string into chunks of a specified size.\n *\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * chunk('hello', 2) // ['he', 'll', 'o']\n * ```\n *\n * @param input - The input array or string to be chunked.\n * @param size - The size of each chunk (default 2).\n *\n * @returns An array of chunks.\n *\n * @throws {TypeError} If the input is not an array or string.\n * @throws {RangeError} If the chunk size is not a positive integer.\n */\nexport function chunk(input: string, size?: number): string[];\nexport function chunk<T>(input: T[], size?: number): T[][];\nexport function chunk<T>(input: T[] | string, size = 2): string[] | T[][] {\n if (!Array.isArray(input) && typeof input !== 'string')\n throw new TypeError('chunk: argument must be an array or string');\n\n if (!Number.isInteger(size) || size < 1) throw new RangeError('chunk: size must be a positive integer');\n\n return Array.from({ length: Math.ceil(input.length / size) }, (_, i) => input.slice(i * size, i * size + size)) as\n string[] | T[][];\n}\n","/**\n * Maps and filters in one pass. Returning `undefined` drops an item.\n */\nexport function filterMap<T, R>(array: T[], callback: (item: T, index: number, array: T[]) => R | undefined): R[] {\n const result: R[] = [];\n\n for (let index = 0; index < array.length; index++) {\n const value = callback(array[index], index, array);\n\n if (value !== undefined) {\n result.push(value);\n }\n }\n\n return result;\n}\n","/**\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","import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n","import type { Primitive } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n","/**\n * Splits an array into values that match and do not match the predicate.\n */\nexport function partition<T>(array: T[], predicate: (item: T, index: number, array: T[]) => boolean): [T[], T[]] {\n const accepted: T[] = [];\n const rejected: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n accepted.push(array[index]);\n } else {\n rejected.push(array[index]);\n }\n }\n\n return [accepted, rejected];\n}\n","/**\n * Compares two values and returns a number suitable for use as a sort comparator.\n *\n * - Numbers and Dates: returns `0`, `1`, or `-1`.\n * - Strings: delegates to `String.prototype.localeCompare`, which may return any integer\n * (not just `0`, `1`, `-1`) depending on locale and engine.\n * - `null` sorts before all non-null values; `undefined` sorts last.\n *\n * @example\n * ```ts\n * compare('a', 'b'); // negative (locale-dependent)\n * compare(1, 2); // -1\n * compare(new Date('2023-01-01'), new Date('2023-01-02')); // -1\n * compare('a', 'a'); // 0\n * compare(1, 1); // 0\n * compare(new Date('2023-01-01'), new Date('2023-01-01')); // 0\n * ```\n *\n * @param a - The first value to compare.\n * @param b - The second value to compare.\n *\n * @returns A negative number, zero, or a positive number.\n *\n * Pass directly as an `Array.sort` comparator:\n * ```ts\n * [3, 1, 2].sort(compare); // [1, 2, 3]\n * ['banana', 'apple', 'cherry'].sort(compare); // ['apple', 'banana', 'cherry']\n * ```\n */\nexport const compare = (a: unknown, b: unknown): number => {\n if (a === b) return 0;\n\n if (a === undefined) return 1;\n\n if (b === undefined) return -1;\n\n if (a === null) return b === null ? 0 : -1;\n\n if (b === null) return 1;\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a.localeCompare(b);\n }\n\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a > b ? 1 : -1;\n }\n\n if (a instanceof Date && b instanceof Date) {\n const at = a.getTime();\n const bt = b.getTime();\n\n return at === bt ? 0 : at > bt ? 1 : -1;\n }\n\n throw new TypeError(\n `compare: unsupported types \"${typeof a}\" and \"${typeof b}\". Supported: number, string, Date, null, undefined.`,\n );\n};\n","import { compare } from './compare';\n\n/**\n * Compares two objects based on multiple selectors.\n * The comparison is done in the order of the selectors provided.\n * Each selector can be 'asc' for ascending or 'desc' for descending order.\n *\n * @example\n * ```ts\n * const compareByNameAndAge = compareBy<{ name: string; age: number }>({\n * name: 'asc',\n * age: 'desc',\n * });\n *\n * const a = { name: 'Alice', age: 30 };\n * const b = { name: 'Bob', age: 25 };\n *\n * console.log(compareByNameAndAge(a, b)); // -1 (Alice < Bob)\n * ```\n *\n * @param selectors - An object where keys are properties to compare and values are 'asc' or 'desc'.\n *\n * @returns A comparator for use with `Array.sort` or `sort()`.\n */\nexport const compareBy = <T>(selectors: Partial<Record<keyof T, 'asc' | 'desc'>>) => {\n const entries = Object.entries(selectors) as [keyof T, 'asc' | 'desc'][];\n\n return (a: T, b: T) => {\n for (const [key, direction] of entries) {\n const v1 = a[key];\n const v2 = b[key];\n const dir = direction === 'desc' ? -1 : 1;\n\n const cmp = compare(v1, v2);\n\n if (cmp !== 0) return cmp * dir;\n }\n\n return 0;\n };\n};\n","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: T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: 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","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","import type { Primitive } from '../types';\n\nimport { dedupeBySelector } from '../_common/_selectorSet';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n","export type AttemptResult<T> =\n | { ok: true; value: T }\n // eslint-disable-next-line perfectionist/sort-object-types\n | { ok: false; error: unknown };\n\n/**\n * Narrows an `AttemptResult` to the success branch.\n * @example\n * ```ts\n * const result = await attempt(() => fetch('/api').then(r => r.json()));\n * if (isOk(result)) console.log(result.value);\n * ```\n */\n\nexport function isOk<T>(result: AttemptResult<T>): result is { ok: true; value: T } {\n return result.ok === true;\n}\n\n/**\n * Narrows an `AttemptResult` to the failure branch.\n * @example\n * ```ts\n * const result = await attempt(() => fetch('/api').then(r => r.json()));\n * if (isFail(result)) console.error(result.error);\n * ```\n */\n// eslint-disable-next-line perfectionist/sort-object-types\nexport function isFail<T>(result: AttemptResult<T>): result is { ok: false; error: unknown } {\n return result.ok === false;\n}\n\n/**\n * Executes a function — sync or async — and resolves to an `AttemptResult`.\n * Never throws.\n *\n * @example\n * ```ts\n * // Sync\n * const parsed = attempt(() => JSON.parse(rawJson));\n * if (parsed.ok) console.log(parsed.value);\n * else console.error(parsed.error);\n *\n * // Async\n * const result = await attempt(() => fetch('/api').then(r => r.json()));\n * if (result.ok) console.log(result.value);\n * else console.error(result.error);\n *\n * // Combined with retry()\n * const result = await attempt(() => retry(fn, { times: 3 }));\n * ```\n */\nexport async function attempt<T>(fn: () => T | Promise<T>): Promise<AttemptResult<T>> {\n try {\n return { ok: true, value: await fn() };\n } catch (error) {\n return { error, ok: false };\n }\n}\n","/**\n * Returns the abort error for the given signal.\n *\n * If the signal has a `reason`, that is returned directly (preserving the\n * original error thrown by `AbortController.abort(reason)`).\n * Otherwise, returns a `DOMException` with `name === 'AbortError'`.\n *\n * @example\n * ```ts\n * const ac = new AbortController();\n * ac.abort();\n * throw abortError(ac.signal); // DOMException { name: 'AbortError' }\n *\n * const ac2 = new AbortController();\n * ac2.abort(new TypeError('custom'));\n * throw abortError(ac2.signal); // TypeError('custom')\n * ```\n *\n * @param signal - The aborted signal to extract the error from.\n * @returns The abort reason, or a new `DOMException('Aborted', 'AbortError')`.\n */\nexport function abortError(signal?: AbortSignal): unknown {\n return signal?.reason ?? new DOMException('Aborted', 'AbortError');\n}\n","import { abortError } from './abortError';\n\n/**\n * Processes an array with an async callback with controlled parallelism.\n * Similar to Promise.all, but limits how many items are processed concurrently.\n * Returns an ordered array of results.\n *\n * @example\n * ```ts\n * // Process 3 items at a time\n * const results = await parallel([1, 2, 3, 4, 5], async (n) => {\n * await delay(100);\n * return n * 2;\n * }, { limit: 3 });\n * // [2, 4, 6, 8, 10]\n *\n * // With abort signal\n * const controller = new AbortController();\n * const results = await parallel(items, async (item) => {\n * return processItem(item);\n * }, { limit: 2, signal: controller.signal });\n *\n * // Stop other workers as soon as one item fails\n * await parallel(items, riskyOperation, { abortOnError: true, limit: 3 });\n * ```\n *\n * @param array - Array of items to process\n * @param callback - Async function to process each item\n * @param options - Optional options for concurrency and cancellation\n * @param [options.limit=Infinity] - Maximum number of concurrent operations. Defaults to unbounded.\n * @param [options.signal] - Optional AbortSignal to cancel processing\n * @param [options.abortOnError=false] - When `true`, stops other in-flight workers as soon as any\n * callback throws, instead of letting them keep running to completion unobserved. Default\n * preserves the existing best-effort-completion behavior.\n * @returns Promise resolving to an ordered array of results\n * @throws {RangeError} If limit is less than 1\n * @throws {DOMException} If aborted via signal\n */\nexport async function parallel<T, R>(\n array: readonly T[],\n callback: (item: T, index: number, array: readonly T[]) => Promise<R> | R,\n options: { abortOnError?: boolean; limit?: number; signal?: AbortSignal } = {},\n): Promise<R[]> {\n const { abortOnError = false, limit = Infinity, signal } = options;\n\n if (limit < 1) {\n throw new RangeError(`parallel: limit must be at least 1, got ${limit}`);\n }\n\n if (signal?.aborted) {\n throw abortError(signal);\n }\n\n if (array.length === 0) {\n return [];\n }\n\n const results: R[] = new Array(array.length);\n let currentIndex = 0;\n const failFastController = abortOnError ? new AbortController() : undefined;\n\n const worker = async (): Promise<void> => {\n while (true) {\n if (signal?.aborted) {\n throw abortError(signal);\n }\n\n if (failFastController?.signal.aborted) {\n return;\n }\n\n if (currentIndex >= array.length) {\n return;\n }\n\n const index = currentIndex++;\n\n try {\n results[index] = await callback(array[index]!, index, array);\n } catch (err) {\n failFastController?.abort();\n throw err;\n }\n }\n };\n\n const workerCount = Math.min(limit, array.length);\n const workers = Array.from({ length: workerCount }, () => worker());\n\n await Promise.all(workers);\n\n return results;\n}\n","import { abortError } from './abortError';\n\n/**\n * Creates a Promise that resolves after a specified amount of time.\n * If an `AbortSignal` is provided and fires before the delay elapses, the promise rejects with\n * the signal's reason (or a generic `DOMException('Aborted', 'AbortError')`).\n *\n * @example\n * ```ts\n * sleep(1000).then(() => console.log('Hello, world!')); // logs after 1 second\n *\n * // With abort support\n * const controller = new AbortController();\n * await sleep(5000, controller.signal); // rejects immediately when aborted\n * ```\n *\n * @param timeout - The number of milliseconds to wait before resolving the Promise.\n * @param signal - Optional AbortSignal to cancel the sleep early.\n *\n * @returns A Promise that resolves after the specified time.\n */\nexport async function sleep(timeout: number, signal?: AbortSignal): Promise<void> {\n if (!signal) {\n return new Promise((resolve) => setTimeout(resolve, timeout));\n }\n\n if (signal.aborted) {\n return Promise.reject(abortError(signal));\n }\n\n return new Promise<void>((resolve, reject) => {\n const id = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n const onAbort = () => {\n clearTimeout(id);\n signal.removeEventListener('abort', onAbort);\n reject(abortError(signal));\n };\n\n signal.addEventListener('abort', onAbort);\n });\n}\n","import { abortError } from './abortError';\nimport { sleep } from './sleep';\n\nexport type RetryOptions = {\n delay?: number | ((attempt: number) => number);\n onError?: (error: unknown) => void;\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n signal?: AbortSignal;\n timeout?: number;\n times?: number;\n};\n\nfunction buildSignal(timeout: number | undefined, signal: AbortSignal | undefined): AbortSignal | undefined {\n const parts = [timeout !== undefined ? AbortSignal.timeout(timeout) : undefined, signal].filter(\n (s): s is AbortSignal => s != null,\n );\n\n if (parts.length === 0) return undefined;\n\n if (parts.length === 1) return parts[0];\n\n return AbortSignal.any(parts);\n}\n\n/**\n * Retries an async function with optional per-attempt timeout, delay strategy, and abort support.\n * The function receives a merged AbortSignal from the per-attempt timeout and any external signal.\n * On total failure, throws the last error (use `attempt()` to get an `AttemptResult` without throwing).\n *\n * @example\n * ```ts\n * // Basic retry\n * const data = await retry(() => fetch('/api').then(r => r.json()), { times: 3 });\n *\n * // With per-attempt timeout and cancellation\n * const data = await retry(\n * async (signal) => fetch('/api', { signal }).then(r => r.json()),\n * { times: 3, timeout: 5000 },\n * );\n *\n * // As AttemptResult (never throws) — combine with attempt()\n * const result = await attempt(() => retry(fn, { times: 3 }));\n * ```\n *\n * @param fn - Async function to retry. Receives a merged AbortSignal when timeout or signal is set.\n * @param options - Retry configuration.\n * @param [options.times=3] - Total attempts including the first.\n * @param [options.delay=250] - Delay between retries in ms, or a function of (attemptIndex).\n * @param [options.timeout] - Per-attempt timeout in milliseconds.\n * @param [options.signal] - External AbortSignal to cancel all retries.\n * @param [options.shouldRetry] - Predicate called after each non-final failure.\n * Receives the error and the number of failures so far (0-indexed: `0` on the first failure,\n * `1` on the second, etc.). Return `false` to abort immediately. **Not called on the final attempt**\n * (use `onError` to observe the final error unconditionally).\n * @param [options.onError] - Called with the last error before rethrowing — both on final attempt exhaustion\n * and when `shouldRetry` returns `false` to abort early.\n * @returns The resolved value.\n * @throws {RangeError} If `times` is not a positive integer.\n * @throws The last error if all attempts fail.\n */\nexport async function retry<T>(\n fn: (signal?: AbortSignal) => Promise<T>,\n { delay = 250, onError, shouldRetry, signal, timeout, times = 3 }: RetryOptions = {},\n): Promise<T> {\n if (!Number.isInteger(times) || times < 1) {\n throw new RangeError(`retry: times must be a positive integer, got ${times}`);\n }\n\n for (let tryCount = 1; tryCount <= times; tryCount++) {\n if (signal?.aborted) throw abortError(signal);\n\n const callSignal = buildSignal(timeout, signal);\n\n try {\n return await fn(callSignal);\n } catch (err) {\n if (tryCount === times) {\n onError?.(err);\n throw err;\n }\n\n if (shouldRetry && !shouldRetry(err, tryCount - 1)) {\n onError?.(err);\n throw err;\n }\n\n const ms = typeof delay === 'function' ? delay(tryCount - 1) : delay;\n\n if (ms > 0) await sleep(ms, signal);\n }\n }\n\n /* unreachable — the loop always returns or throws before exhausting all attempts */\n return undefined as never;\n}\n","const isDev = !(globalThis as { __ARSENAL_PROD__?: boolean }).__ARSENAL_PROD__;\n\n/** @internal @security Messages may include user data. */\nexport function warn(msg: string): void {\n if (isDev) console.warn(`[@vielzeug/arsenal] ${msg}`);\n}\n","import type { Fn } from '../types';\n\nimport { warn } from '../_dev';\n\nexport type DebounceOptions = {\n /** Invoke on the leading edge of the delay window. Default: `false`. */\n leading?: boolean;\n /** Invoke on the trailing edge of the delay window. Default: `true`. */\n trailing?: boolean;\n};\n\nexport type Debounced<T extends Fn> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n pending(): boolean;\n};\n\n/**\n * Debounces a function. By default only the trailing edge fires (after input settles).\n * Pass `{ leading: true }` to fire immediately on the first call instead.\n * Pass `{ leading: true, trailing: true }` to fire on both edges.\n *\n * Use `flush()` to invoke immediately, `cancel()` to clear, and `pending()` to check\n * whether an invocation is scheduled.\n *\n * @example\n * ```ts\n * // Trailing (default) — fires after input settles\n * const save = debounce(persist, 500);\n *\n * // Leading — fires on the first keystroke, then silences during the window\n * const submit = debounce(sendRequest, 500, { leading: true, trailing: false });\n * ```\n */\nexport function debounce<T extends Fn>(\n fn: T,\n delay = 300,\n options: DebounceOptions = { leading: false, trailing: true },\n): Debounced<T> {\n const leading = options.leading ?? false;\n const trailing = options.trailing ?? true;\n\n if (!leading && !trailing) {\n warn('debounce: both `leading` and `trailing` are false — the wrapped function will never be invoked.');\n }\n\n let timerId: ReturnType<typeof setTimeout> | undefined;\n let lastArgs: Parameters<T> | undefined;\n let lastResult: ReturnType<T> | undefined;\n let leadingFired = false;\n\n const clearTimer = () => {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n timerId = undefined;\n }\n };\n\n const invokeTrailing = () => {\n clearTimer();\n leadingFired = false;\n\n if (!lastArgs) return undefined;\n\n const args = lastArgs;\n\n lastArgs = undefined;\n lastResult = fn(...args) as ReturnType<T>;\n\n return lastResult;\n };\n\n return Object.assign(\n (...args: Parameters<T>): ReturnType<T> | undefined => {\n lastArgs = args;\n\n if (leading && !leadingFired) {\n leadingFired = true;\n lastResult = fn(...args) as ReturnType<T>;\n // Clear args regardless of `trailing` — the leading call already consumed this\n // invocation. The trailing timer below only re-invokes `fn` if a *further* call\n // arrives during the cooldown window and repopulates `lastArgs`.\n lastArgs = undefined;\n\n if (!trailing) {\n // Leading-only: start cooldown — no trailing call needed\n timerId = setTimeout(() => {\n timerId = undefined;\n leadingFired = false;\n }, delay);\n\n return lastResult;\n }\n }\n\n // When leading-only, ignore calls within the cooldown window\n if (leading && !trailing && leadingFired) return lastResult;\n\n clearTimer();\n timerId = setTimeout(invokeTrailing, delay);\n\n return lastResult;\n },\n {\n cancel: () => {\n clearTimer();\n lastArgs = undefined;\n leadingFired = false;\n },\n flush: (): ReturnType<T> | undefined => invokeTrailing(),\n pending: () => timerId !== undefined,\n },\n );\n}\n","import type { Fn } from '../types';\n\n/**\n * A wrapped function that executes `fn` at most once and exposes a `.reset()` method\n * to allow re-invocation.\n */\nexport type Once<T extends Fn> = T & { reset: () => void };\n\n/**\n * Create a function that runs once and returns the first result.\n *\n * If the first call throws, it does not count as \"called\" — the thrown error propagates to\n * that caller, and the next call will invoke `fn` again (rather than caching the failure).\n *\n * @example\n * ```ts\n * const onceRandom = once(() => Math.random())\n * onceRandom() // 0.3\n * onceRandom() // 0.3\n *\n * onceRandom.reset() // clears the cached result — allows one more invocation\n *\n * onceRandom() // 0.2\n * onceRandom() // 0.2\n * ```\n *\n * @param fn - The function to wrap.\n *\n * @returns A `Once<T>` — the wrapped function with a `.reset()` method to clear the cached result.\n */\nexport const once = <T extends Fn>(fn: T): Once<T> => {\n let result: ReturnType<T> | undefined;\n let called = false;\n\n const wrappedFn = ((...args: Parameters<T>): ReturnType<T> => {\n if (!called) {\n result = fn(...args) as ReturnType<T>;\n called = true;\n }\n\n return result as ReturnType<T>;\n }) as Once<T>;\n\n wrappedFn.reset = () => {\n result = undefined;\n called = false;\n };\n\n return wrappedFn;\n};\n","import type { Fn } from '../types';\n\ntype FirstParameters<T extends readonly Fn[]> = T extends [infer First extends Fn, ...unknown[]]\n ? Parameters<First>\n : never;\ntype LastReturnType<T extends readonly Fn[]> = T extends [...unknown[], infer Last extends Fn]\n ? ReturnType<Last>\n : never;\n\n/**\n * Pipes multiple functions into a single function. It starts from the leftmost function and proceeds to the right.\n *\n * The TypeScript overload captures the input type from the first function and the output type from the last.\n * Intermediate steps are typed as `unknown` at the call site — TypeScript cannot infer a safe chain across\n * heterogeneous function signatures without explicit overloads for every arity.\n *\n * `pipe()` with no arguments returns an identity function `<T>(x: T) => T`.\n *\n * @example\n * ```ts\n * const add = (x: number) => x + 2;\n * const multiply = (x: number) => x * 3;\n * const subtract = (x: number) => x - 4;\n * const pipedFn = pipe(subtract, multiply, add);\n *\n * pipedFn(5); // ((5-4) * 3) + 2 = 5\n *\n * // Zero-arg identity\n * pipe()(42); // 42\n * ```\n *\n * @param fns - List of functions to be piped.\n * @returns A new function that is the pipe of the input functions.\n */\nexport function pipe(): <T>(x: T) => T;\nexport function pipe<T extends readonly [Fn, ...Fn[]]>(...fns: T): (...args: FirstParameters<T>) => LastReturnType<T>;\nexport function pipe(...fns: Fn[]): Fn {\n if (fns.length === 0) return <T>(x: T): T => x;\n\n const [firstFn, ...restFns] = fns;\n\n return (...args: never[]) =>\n restFns.reduce(\n (prev: unknown, fn) => Reflect.apply(fn, undefined, [prev]),\n Reflect.apply(firstFn!, undefined, args),\n );\n}\n","import type { Fn } from '../types';\n\nexport type ThrottleOptions = {\n leading?: boolean; // invoke at the start of the window\n trailing?: boolean; // invoke at the end with the last args\n};\n\nexport type Throttled<T extends Fn> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n pending(): boolean; // whether there's a pending call that flush() would execute\n};\n\n/**\n * Throttles a function. By default, only the leading edge fires.\n * Pass `{ trailing: true }` to also invoke at the end of the throttle window.\n *\n * @example\n * ```ts\n * const fn = () => { ... };\n * const t = throttle(fn, 700);\n * const withTrailing = throttle(fn, 700, { trailing: true });\n * ```\n */\nexport function throttle<T extends Fn>(\n fn: T,\n delay = 700,\n options: ThrottleOptions = { leading: true, trailing: false },\n): Throttled<T> {\n const leading = options.leading ?? true;\n const trailing = options.trailing ?? false;\n\n let timerId: ReturnType<typeof setTimeout> | undefined;\n let lastInvokeTime = -Infinity;\n let lastArgs: Parameters<T> | undefined;\n let lastResult: ReturnType<T> | undefined;\n\n const clearTimer = () => {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n timerId = undefined;\n }\n };\n\n const scheduleTimer = (delayMs: number) => {\n timerId = setTimeout(timerExpired, delayMs);\n };\n\n const invoke = (now: number) => {\n lastInvokeTime = now;\n clearTimer();\n\n if (!lastArgs) return undefined;\n\n const args = lastArgs;\n\n lastArgs = undefined;\n lastResult = fn(...args) as ReturnType<T>;\n\n return lastResult;\n };\n\n const remaining = (now: number) => delay - (now - lastInvokeTime);\n\n const timerExpired = () => {\n const now = Date.now();\n\n if (lastArgs && remaining(now) <= 0) {\n // trailing edge invoke\n invoke(now);\n } else if (lastArgs) {\n // reschedule until a window elapses\n scheduleTimer(remaining(now));\n } else {\n clearTimer();\n }\n };\n\n return Object.assign(\n (...args: Parameters<T>): ReturnType<T> | undefined => {\n const now = Date.now();\n\n if (lastInvokeTime === -Infinity && !leading) {\n // If leading is false, start the window now but don't invoke immediately\n lastInvokeTime = now;\n }\n\n lastArgs = args;\n\n const rem = remaining(now);\n\n if (rem <= 0) {\n // Window elapsed: invoke now\n return invoke(now);\n } else if (trailing && !timerId) {\n // Schedule trailing call if not already scheduled\n scheduleTimer(rem);\n }\n\n return lastResult;\n },\n {\n cancel: () => {\n clearTimer();\n lastArgs = undefined;\n lastInvokeTime = -Infinity;\n },\n flush: (): ReturnType<T> | undefined => {\n if (!lastArgs) return undefined;\n\n return invoke(Date.now());\n },\n // Pending if a trailing call is scheduled OR there are queued args.\n pending: () => lastArgs !== undefined || timerId !== undefined,\n },\n );\n}\n","import type { Predicate } from '../types';\n\n/**\n * Returns a predicate that is `true` only when every provided predicate is `true`.\n *\n * With zero predicates, returns `true` for all values (vacuous truth).\n *\n * @example\n * ```ts\n * const isPositiveEven = allOf(\n * (n) => n > 0,\n * (n) => n % 2 === 0,\n * );\n * [1, 2, 3, 4].filter(isPositiveEven); // [2, 4]\n * ```\n */\nexport function allOf<T>(...predicates: Predicate<T>[]): Predicate<T> {\n return (value) => predicates.every((predicate) => predicate(value));\n}\n\n/**\n * Returns a predicate that is `true` when at least one provided predicate is `true`.\n *\n * With zero predicates, returns `false` for all values (vacuous falsity).\n *\n * @example\n * ```ts\n * [1, 2, 3, 4].filter(anyOf((n) => n === 1, (n) => n === 3)); // [1, 3]\n * ```\n */\nexport function anyOf<T>(...predicates: Predicate<T>[]): Predicate<T> {\n return (value) => predicates.some((predicate) => predicate(value));\n}\n\n/**\n * Returns a predicate that is `true` when none of the provided predicates match.\n * With a single predicate this is equivalent to logical NOT.\n *\n * With zero predicates, returns `true` for all values (nothing fails — vacuous truth).\n *\n * @example\n * ```ts\n * [1, 2, 3, 4].filter(noneOf((n) => n % 2 === 0)); // [1, 3]\n * ```\n */\nexport function noneOf<T>(...predicates: Predicate<T>[]): Predicate<T> {\n return (value) => predicates.every((predicate) => !predicate(value));\n}\n\n/**\n * Returns a predicate that negates the given predicate.\n *\n * @example\n * ```ts\n * [1, 2, 3, 4].filter(not((n) => n % 2 === 0)); // [1, 3]\n * ```\n */\nexport function not<T>(predicate: Predicate<T>): Predicate<T> {\n return (value) => !predicate(value);\n}\n","/**\n * Checks if a value is defined (not `undefined`).\n *\n * @example\n * ```ts\n * isDefined(123); // true\n * isDefined(undefined); // false\n * isDefined('hello world'); // true\n * isDefined({}); // true\n * isDefined([]); // true\n * isDefined(null); // true\n * ```\n *\n * @param arg - The value to check.\n *\n * @returns `true` if the value is defined, else `false`.\n */\nexport function isDefined<T>(arg: T | undefined): arg is T {\n return arg !== undefined;\n}\n","/**\n * Recursively compares two values for deep equality.\n * Supports plain objects, arrays, `Date`, `Map`, `Set`, `RegExp`, and circular references.\n *\n * Uses `===` for the primitive comparison, so `isEqual(NaN, NaN)` is `false` and\n * `isEqual(0, -0)` is `true` — the opposite of `shallowEqual`, which uses `Object.is` and\n * treats `NaN` as equal to itself and `-0` as distinct from `0`.\n *\n * For one-level-deep reference equality, use `shallowEqual` instead.\n *\n * @example\n * ```ts\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n * isEqual({ a: { b: 2 } }, { a: { b: 2 } }); // true\n * isEqual(new Date('2023-01-01'), new Date('2023-01-01')); // true\n * isEqual(new Map([['k', 1]]), new Map([['k', 1]])); // true\n * ```\n *\n * @param a - First value to compare.\n * @param b - Second value to compare.\n * @returns `true` if the values are deeply equal.\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n return safeIsEqual(a, b, new WeakMap());\n}\n\nfunction safeIsEqual(a: unknown, b: unknown, visited: WeakMap<object, object>): boolean {\n // Check for strict equality (handles primitives and references)\n if (a === b) return true;\n\n // If either is null or not an object, they're not equal\n if (a == null || b == null || typeof a !== typeof b || typeof a !== 'object' || typeof b !== 'object') return false;\n\n // Check for circular references\n // We only track 'a' because if 'a' is cyclical, 'b' must also be cyclic to be equal\n if (visited.has(a as object)) {\n return visited.get(a as object) === b;\n }\n\n visited.set(a as object, b as object);\n\n // Array comparison\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\n return a.every((item, idx) => safeIsEqual(item, b[idx], visited));\n }\n\n // Date comparison\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n // Map comparison\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n\n for (const [k, v] of a) {\n if (!b.has(k) || !safeIsEqual(v, b.get(k), visited)) return false;\n }\n\n return true;\n }\n\n // Set comparison — fast path for primitive values, deep for objects\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n\n const bItems = [...b];\n\n for (const v of a) {\n // O(1) path for primitives — avoid the O(n) .some() scan\n if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null || v === undefined) {\n if (!b.has(v)) return false;\n } else if (!bItems.some((bv) => safeIsEqual(v, bv, visited))) {\n return false;\n }\n }\n\n return true;\n }\n\n // RegExp comparison\n if (a instanceof RegExp || b instanceof RegExp) {\n return a instanceof RegExp && b instanceof RegExp && a.source === b.source && a.flags === b.flags;\n }\n\n // Cross-type guards: Map/Set vs plain objects are never equal\n if (a instanceof Map || b instanceof Map) return false;\n\n if (a instanceof Set || b instanceof Set) return false;\n\n // Object comparison\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) return false;\n\n for (const key of keysA) {\n if (\n !Object.hasOwn(b, key) ||\n !safeIsEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key], visited)\n )\n return false;\n }\n\n return true;\n}\n","/**\n * Determines if the passed value is null or undefined.\n *\n * @example\n * ```ts\n * isNil(null); // true\n * isNil(undefined); // true\n * isNil(''); // false\n * isNil(0); // false\n * ```\n *\n * @param arg - The argument to be checked.\n *\n * @returns `true` if the value is null or undefined, else `false`.\n */\nexport function isNil(arg: unknown): arg is null | undefined {\n return arg === undefined || arg === null;\n}\n","/**\n * Returns `true` if `value` is a plain object — one with `Object.prototype` or `null` as its\n * prototype. Class instances, `Map`, `Set`, `Array` and other built-ins all return `false`.\n *\n * @example\n * ```ts\n * isPlainObject({}) // true\n * isPlainObject({ a: 1 }) // true\n * isPlainObject(Object.create(null)) // true\n * isPlainObject(new Map()) // false\n * isPlainObject([]) // false\n * isPlainObject(null) // false\n * ```\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value == null || typeof value !== 'object') return false;\n\n const prototype = Object.getPrototypeOf(value);\n\n return prototype === Object.prototype || prototype === null;\n}\n","/**\n * Restricts a number to be within a specified range.\n * Both `min` and `max` are optional — omitting one leaves that end unconstrained.\n *\n * @example\n * ```ts\n * clamp(5, 1, 10) // 5 — within range\n * clamp(0, 1, 10) // 1 — below min\n * clamp(15, 1, 10) // 10 — above max\n * clamp(15, 1) // 15 — no max, above min\n * clamp(-5, undefined, 0) // -5 — no min, below max\n * ```\n *\n * @param n - The number to clamp.\n * @param min - Optional lower bound (inclusive).\n * @param max - Optional upper bound (inclusive).\n *\n * @returns The clamped number.\n */\nexport function clamp(n: number, min?: number, max?: number): number {\n if (min != null && n < min) return min;\n\n if (max != null && n > max) return max;\n\n return n;\n}\n","/**\n * Creates an array of numbers from `0` up to, but not including, `stop` with step `1`.\n *\n * @example\n * ```ts\n * range(5) // [0, 1, 2, 3, 4]\n * ```\n */\nexport function range(stop: number): number[];\n/**\n * Creates an array of numbers from `start` up to, but not including, `stop` with step `1`.\n *\n * @example\n * ```ts\n * range(2, 6) // [2, 3, 4, 5]\n * ```\n */\nexport function range(start: number, stop: number): number[];\n/**\n * Creates an array of numbers progressing from `start` up to, but not including, `stop` with a given `step`.\n *\n * @example\n * ```ts\n * range(0, 10, 2) // [0, 2, 4, 6, 8]\n * range(10, 0, -2) // [10, 8, 6, 4, 2]\n * ```\n *\n * @param start - The start of the range.\n * @param stop - The end of the range (exclusive).\n * @param step - The value to increment or decrement by.\n *\n * @returns The range of numbers.\n *\n * @throws {RangeError} If start, stop, or step are not finite numbers, step is 0, or range exceeds maximum size.\n */\nexport function range(start: number, stop: number, step: number): number[];\nexport function range(startOrStop: number, stop?: number, step?: number): number[] {\n const [resolvedStart, resolvedStop, resolvedStep] =\n stop === undefined ? [0, startOrStop, 1] : step === undefined ? [startOrStop, stop, 1] : [startOrStop, stop, step];\n\n if (!Number.isFinite(resolvedStart) || !Number.isFinite(resolvedStop) || !Number.isFinite(resolvedStep)) {\n throw new RangeError('range: start, stop, and step must be finite numbers');\n }\n\n if (resolvedStep === 0) throw new RangeError('range: step cannot be 0');\n\n if (resolvedStart === resolvedStop) {\n return [];\n }\n\n const raw = (resolvedStop - resolvedStart) / resolvedStep;\n const length = Math.max(0, Number.isInteger(raw) ? raw : Math.ceil(raw + Number.EPSILON));\n\n if (length > 10_000_000) throw new RangeError('range: exceeds maximum allowed size of 10,000,000');\n\n return Array.from({ length }, (_, i) => resolvedStart + i * resolvedStep);\n}\n","import type { Obj } from '../types';\n\nimport { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\n\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : undefined\n : P extends keyof T\n ? T[P]\n : undefined;\n\nfunction pathSegments(path: string): string[] {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .replace(/^\\.|\\.$/g, '')\n .split('.')\n .filter(Boolean);\n}\n\nfunction readPath(item: Obj, path: string): unknown {\n let current: unknown = item;\n\n for (const segment of pathSegments(path)) {\n if (UNSAFE_PATH_SEGMENTS.has(segment) || current == null || typeof current !== 'object') return undefined;\n\n current = (current as Record<string, unknown>)[segment];\n\n if (current === undefined) return undefined;\n }\n\n return current;\n}\n\n/**\n * Retrieves a value at a dot-notation or numeric bracket-notation path.\n * Returns `undefined` when the path is missing or contains an unsafe segment.\n * Use `getPathOr` to supply a fallback or `requirePath` to throw on a missing path.\n */\nexport function getPath<T extends Obj, P extends string>(item: T, path: P): PathValue<T, P> | undefined {\n return readPath(item, path) as PathValue<T, P> | undefined;\n}\n\n/**\n * Retrieves a value at a path or returns `fallback` when the path is missing.\n */\nexport function getPathOr<T extends Obj, P extends string, F>(item: T, path: P, fallback: F): PathValue<T, P> | F {\n const value = readPath(item, path);\n\n return (value === undefined ? fallback : value) as PathValue<T, P> | F;\n}\n\n/**\n * Retrieves a value at a path or throws when the path is missing.\n */\nexport function requirePath<T extends Obj, P extends string>(item: T, path: P): Exclude<PathValue<T, P>, undefined> {\n const value = readPath(item, path);\n\n if (value === undefined) throw new TypeError(`Path does not exist: '${path}'`);\n\n return value as Exclude<PathValue<T, P>, undefined>;\n}\n","import { ArsenalSerializationError } from '../errors';\n\nexport type HashOptions = {\n /**\n * What to do when a class instance is encountered (an object whose prototype is\n * neither `Object.prototype` nor `null`).\n *\n * - `'coerce'` (default) — calls `String(value)`.\n * - `'throw'` — throws an `ArsenalSerializationError`.\n */\n onClassInstance?: 'coerce' | 'throw';\n};\n\n/**\n * Produces a deterministic, order-independent string representation of any value.\n * Object keys are sorted alphabetically, so `{ b: 1, a: 2 }` and `{ a: 2, b: 1 }` produce\n * the same output. Handles `Date`, `RegExp`, `Set`, `Map`, and `bigint` in addition to plain JSON.\n *\n * Useful for generating stable cache keys from arbitrary query parameters or options objects.\n *\n * Class instances fall back to `String(value)` by default.\n * Pass `{ onClassInstance: 'throw' }` to throw an `ArsenalSerializationError` instead.\n *\n * @example\n * ```ts\n * hash({ b: 2, a: 1 }) // '{\"a\":1,\"b\":2}'\n * hash([3, 1, 2]) // '[3,1,2]'\n * hash(new Date('2024-01-01T00:00:00Z')) // '[Date:2024-01-01T00:00:00.000Z]'\n * hash(new Set([3, 1, 2])) // '[Set:1,2,3]'\n * hash(new MyClass(), { onClassInstance: 'throw' }) // throws ArsenalSerializationError\n * ```\n *\n * @throws {ArsenalSerializationError} If `options.onClassInstance` is `'throw'` and a class instance is encountered.\n */\nfunction _hash(value: unknown, options: HashOptions | undefined, visited: Set<object>): string {\n if (value === undefined) return 'undefined';\n\n if (value === null) return 'null';\n\n if (typeof value === 'bigint') return `${value}n`;\n\n if (typeof value !== 'object') return JSON.stringify(value);\n\n if (visited.has(value as object)) return '[Circular]';\n\n visited.add(value as object);\n\n if (value instanceof Date) return `[Date:${Number.isNaN(value.getTime()) ? 'Invalid' : value.toISOString()}]`;\n\n if (value instanceof RegExp) return `[RegExp:${value.source}/${value.flags}]`;\n\n if (value instanceof Set)\n return `[Set:${[...value]\n .map((v) => _hash(v, options, visited))\n .sort()\n .join(',')}]`;\n\n if (value instanceof Map) {\n const entries = [...value.entries()]\n .map(([key, entryValue]) => [_hash(key, options, visited), _hash(entryValue, options, visited)] as const)\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n leftKey === rightKey ? leftValue.localeCompare(rightValue) : leftKey.localeCompare(rightKey),\n );\n\n return `[Map:${entries.map(([key, entryValue]) => `${key}=>${entryValue}`).join(',')}]`;\n }\n\n if (Array.isArray(value)) return `[${value.map((v) => _hash(v, options, visited)).join(',')}]`;\n\n const proto = Object.getPrototypeOf(value) as unknown;\n\n if (proto !== Object.prototype && proto !== null) {\n if (options?.onClassInstance === 'throw') {\n throw new ArsenalSerializationError(\n `hash: unsupported type ${(value as { constructor?: { name?: string } }).constructor?.name ?? 'unknown'}`,\n );\n }\n\n return String(value);\n }\n\n const rec = value as Record<string, unknown>;\n const keys = Object.keys(rec)\n .filter((k) => rec[k] !== undefined)\n .sort();\n\n return `{${keys.map((k) => `${JSON.stringify(k)}:${_hash(rec[k], options, visited)}`).join(',')}}`;\n}\n\nexport function hash(value: unknown, options?: HashOptions): string {\n return _hash(value, options, new Set<object>());\n}\n","import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n","import type { Obj } from '../types';\n\nimport { isUnsafeKey } from '../_common/unsafePaths';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n","/**\n * Generates a unique identifier.\n *\n * @example\n * ```ts\n * uuid(); // a unique identifier, e.g., '22a746d0-08be-4aff-bbc2-4deddf0914e0'\n * ```\n *\n * @returns A unique identifier.\n */\nexport function uuid(): string {\n return crypto.randomUUID();\n}\n","/**\n * Shared regex pattern for splitting words in case conversion utilities.\n * Module-private (underscore-prefixed file is not barrel-exported).\n * Used only with String.prototype.replace — which always resets lastIndex.\n * Uses Unicode property escapes (`\\p{Ll}`/`\\p{Lu}`/`\\p{N}`) instead of `[a-z]`/`[A-Z]` so\n * accented and non-Latin letters (e.g. `café`, `日本語`) are treated as letters, not stripped.\n */\nconst CASE_SPLIT_PATTERN = /(\\p{Ll})(\\p{Lu}|\\p{N})|(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})|(\\p{N})(\\p{L})/gu;\n\n/** Escapes all regex metacharacters in a string (per MDN spec). */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&');\n}\n\n/**\n * Normalizes a string by splitting on word boundaries and removing special characters\n *\n * @param str - The string to normalize\n * @param separator - The separator to use for splitting (default: space)\n * @returns The normalized string\n */\nexport function normalizeCase(str: string, separator = ' '): string {\n const escapedSep = escapeRegex(separator);\n\n return str\n .trim()\n .replace(CASE_SPLIT_PATTERN, `$1$3$5${separator}$2$4$6`)\n .replace(/[^\\p{L}\\p{N}]+/gu, separator)\n .replace(new RegExp(`^(?:${escapedSep})+|(?:${escapedSep})+$`, 'g'), '');\n}\n","import { normalizeCase } from './_caseUtils';\n\n/**\n * Converts a string to camel case.\n *\n * @example\n * ```ts\n * const text = 'hello world';\n * camelCase(text); // 'helloWorld'\n * ```\n *\n * @param str - The string to convert.\n * @returns The converted string.\n */\nexport function camelCase(str: string): string {\n return normalizeCase(str, ' ')\n .replace(/[^\\p{L}\\p{N}]+(.)/gu, (_, char) => char.toUpperCase())\n .replace(/^./, (char) => char.toLowerCase());\n}\n"],"mappings":"mEACA,IAAa,EAAb,MAAa,UAAqB,KAAM,CACtC,YAAY,EAAiB,EAAqB,CAChD,MAAM,EAAS,CAAI,EACnB,KAAK,KAAO,WAAW,KACvB,OAAO,eAAe,KAAM,WAAW,SAAS,CAClD,CAEA,OAAO,GAAG,EAAmC,CAC3C,OAAO,aAAe,CACxB,CACF,EAOa,EAAb,cAA+C,CAAa,CAAC,ECC7D,SAAgB,EAAS,EAAqB,EAAO,EAAqB,CACxE,GAAI,CAAC,MAAM,QAAQ,CAAK,GAAK,OAAO,GAAU,SAC5C,MAAU,UAAU,4CAA4C,EAElE,GAAI,CAAC,OAAO,UAAU,CAAI,GAAK,EAAO,EAAG,MAAU,WAAW,wCAAwC,EAEtG,OAAO,MAAM,KAAK,CAAE,OAAQ,KAAK,KAAK,EAAM,OAAS,CAAI,CAAE,GAAI,EAAG,IAAM,EAAM,MAAM,EAAI,EAAM,EAAI,EAAO,CAAI,CAAC,CAEhH,CCxBA,SAAgB,EAAgB,EAAY,EAAsE,CAChH,IAAM,EAAc,CAAC,EAErB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IAAS,CACjD,IAAM,EAAQ,EAAS,EAAM,GAAQ,EAAO,CAAK,EAE7C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,EAAc,EAAK,GAAG,CAAC,CAC3B,QAAQ,uBAAwB,EAAG,IAAS,EAAK,YAAY,CAAC,CAAC,CAC/D,QAAQ,KAAO,GAAS,EAAK,YAAY,CAAC,CAC/C"}
1
+ {"version":3,"file":"arsenal.cjs","names":[],"sources":["../src/array/chunk.ts","../src/array/filterMap.ts","../src/_common/unsafePaths.ts","../src/array/groupBy.ts","../src/array/indexBy.ts","../src/array/partition.ts","../src/array/compare.ts","../src/array/compareBy.ts","../src/array/sort.ts","../src/_common/_selectorSet.ts","../src/array/uniq.ts","../src/async/attempt.ts","../src/async/abortError.ts","../src/async/parallel.ts","../src/async/sleep.ts","../src/async/retry.ts","../src/errors.ts","../src/_dev.ts","../src/function/debounce.ts","../src/function/once.ts","../src/function/pipe.ts","../src/function/throttle.ts","../src/guards/combinators.ts","../src/guards/isDefined.ts","../src/guards/isEqual.ts","../src/guards/isNil.ts","../src/guards/isPlainObject.ts","../src/math/clamp.ts","../src/math/range.ts","../src/object/getPath.ts","../src/object/hash.ts","../src/object/omit.ts","../src/object/pick.ts","../src/random/uuid.ts","../src/string/_caseUtils.ts","../src/string/camelCase.ts"],"sourcesContent":["/**\n * Splits an array or string into chunks of a specified size.\n *\n * @example\n * ```ts\n * chunk([1, 2, 3, 4, 5], 2) // [[1, 2], [3, 4], [5]]\n * chunk('hello', 2) // ['he', 'll', 'o']\n * ```\n *\n * @param input - The input array or string to be chunked.\n * @param size - The size of each chunk (default 2).\n *\n * @returns An array of chunks.\n *\n * @throws {TypeError} If the input is not an array or string.\n * @throws {RangeError} If the chunk size is not a positive integer.\n */\nexport function chunk(input: string, size?: number): string[];\nexport function chunk<T>(input: T[], size?: number): T[][];\nexport function chunk<T>(input: T[] | string, size = 2): string[] | T[][] {\n if (!Array.isArray(input) && typeof input !== 'string')\n throw new TypeError('chunk: argument must be an array or string');\n\n if (!Number.isInteger(size) || size < 1) throw new RangeError('chunk: size must be a positive integer');\n\n return Array.from({ length: Math.ceil(input.length / size) }, (_, i) => input.slice(i * size, i * size + size)) as\n | string[]\n | T[][];\n}\n","/**\n * Maps and filters in one pass. Returning `undefined` drops an item.\n */\nexport function filterMap<T, R>(array: T[], callback: (item: T, index: number, array: T[]) => R | undefined): R[] {\n const result: R[] = [];\n\n for (let index = 0; index < array.length; index++) {\n const value = callback(array[index], index, array);\n\n if (value !== undefined) {\n result.push(value);\n }\n }\n\n return result;\n}\n","/**\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","import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,\n * `prototype`) are skipped.\n */\nexport function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]> {\n const result: Record<string, T[]> = {};\n\n for (const item of array) {\n const rawKey = selector(item);\n const key = rawKey === undefined || rawKey === null ? '_' : String(rawKey);\n\n if (isUnsafeKey(key)) continue;\n\n if (!result[key]) {\n result[key] = [];\n }\n\n result[key].push(item);\n }\n\n return result;\n}\n","import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Primitive } from '../types';\n\n/**\n * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are skipped.\n */\nexport function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T> {\n const result: Record<string, T> = {};\n\n for (const item of array) {\n const key = String(selector(item));\n\n if (isUnsafeKey(key)) continue;\n\n result[key] = item;\n }\n\n return result;\n}\n","/**\n * Splits an array into values that match and do not match the predicate.\n */\nexport function partition<T>(array: T[], predicate: (item: T, index: number, array: T[]) => boolean): [T[], T[]] {\n const accepted: T[] = [];\n const rejected: T[] = [];\n\n for (let index = 0; index < array.length; index++) {\n if (predicate(array[index], index, array)) {\n accepted.push(array[index]);\n } else {\n rejected.push(array[index]);\n }\n }\n\n return [accepted, rejected];\n}\n","/**\n * Compares two values and returns a number suitable for use as a sort comparator.\n *\n * - Numbers and Dates: returns `0`, `1`, or `-1`.\n * - Strings: delegates to `String.prototype.localeCompare`, which may return any integer\n * (not just `0`, `1`, `-1`) depending on locale and engine.\n * - `null` sorts before all non-null values; `undefined` sorts last.\n *\n * @example\n * ```ts\n * compare('a', 'b'); // negative (locale-dependent)\n * compare(1, 2); // -1\n * compare(new Date('2023-01-01'), new Date('2023-01-02')); // -1\n * compare('a', 'a'); // 0\n * compare(1, 1); // 0\n * compare(new Date('2023-01-01'), new Date('2023-01-01')); // 0\n * ```\n *\n * @param a - The first value to compare.\n * @param b - The second value to compare.\n *\n * @returns A negative number, zero, or a positive number.\n *\n * Pass directly as an `Array.sort` comparator:\n * ```ts\n * [3, 1, 2].sort(compare); // [1, 2, 3]\n * ['banana', 'apple', 'cherry'].sort(compare); // ['apple', 'banana', 'cherry']\n * ```\n */\nexport const compare = (a: unknown, b: unknown): number => {\n if (a === b) return 0;\n\n if (a === undefined) return 1;\n\n if (b === undefined) return -1;\n\n if (a === null) return b === null ? 0 : -1;\n\n if (b === null) return 1;\n\n if (typeof a === 'string' && typeof b === 'string') {\n return a.localeCompare(b);\n }\n\n if (typeof a === 'number' && typeof b === 'number') {\n return a === b ? 0 : a > b ? 1 : -1;\n }\n\n if (a instanceof Date && b instanceof Date) {\n const at = a.getTime();\n const bt = b.getTime();\n\n return at === bt ? 0 : at > bt ? 1 : -1;\n }\n\n throw new TypeError(\n `compare: unsupported types \"${typeof a}\" and \"${typeof b}\". Supported: number, string, Date, null, undefined.`,\n );\n};\n","import { compare } from './compare';\n\n/**\n * Compares two objects based on multiple selectors.\n * The comparison is done in the order of the selectors provided.\n * Each selector can be 'asc' for ascending or 'desc' for descending order.\n *\n * @example\n * ```ts\n * const compareByNameAndAge = compareBy<{ name: string; age: number }>({\n * name: 'asc',\n * age: 'desc',\n * });\n *\n * const a = { name: 'Alice', age: 30 };\n * const b = { name: 'Bob', age: 25 };\n *\n * console.log(compareByNameAndAge(a, b)); // -1 (Alice < Bob)\n * ```\n *\n * @param selectors - An object where keys are properties to compare and values are 'asc' or 'desc'.\n *\n * @returns A comparator for use with `Array.sort` or `sort()`.\n */\nexport const compareBy = <T>(selectors: Partial<Record<keyof T, 'asc' | 'desc'>>) => {\n const entries = Object.entries(selectors) as [keyof T, 'asc' | 'desc'][];\n\n return (a: T, b: T) => {\n for (const [key, direction] of entries) {\n const v1 = a[key];\n const v2 = b[key];\n const dir = direction === 'desc' ? -1 : 1;\n\n const cmp = compare(v1, v2);\n\n if (cmp !== 0) return cmp * dir;\n }\n\n return 0;\n };\n};\n","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: T[], selector: (item: T) => unknown, direction?: SortDirection): T[];\nexport function sort<T>(array: T[], selectors: SortSelectors<T>): T[];\nexport function sort<T>(\n array: 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","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","import { dedupeBySelector } from '../_common/_selectorSet';\nimport type { Primitive } from '../types';\n\n/**\n * Creates a new array with duplicate values removed.\n *\n * @example\n * ```ts\n * uniq([1, 2, 2, 3, 3, 3]); // [1, 2, 3]\n * const arrObj = [{ id: 1 }, { id: 2 }, { id: 2 }, { id: 3 }, { id: 3 }, { id: 3 }];\n * uniq(arrObj, item => item.id); // [{ id: 1 }, { id: 2 }, { id: 3 }]\n * ```\n *\n * @param array - The array to process.\n * @param [selector] - Function used to generate comparison values for each item.\n\n * @returns A new duplicate-free array.\n */\nexport function uniq<T>(array: T[], selector?: (item: T) => Primitive): T[] {\n if (array.length <= 1) {\n return [...array];\n }\n\n if (!selector) {\n return [...new Set(array)];\n }\n\n return dedupeBySelector(array, selector);\n}\n","export type AttemptResult<T> =\n | { ok: true; value: T }\n // eslint-disable-next-line perfectionist/sort-object-types\n | { ok: false; error: unknown };\n\n/**\n * Narrows an `AttemptResult` to the success branch.\n * @example\n * ```ts\n * const result = await attempt(() => fetch('/api').then(r => r.json()));\n * if (isOk(result)) console.log(result.value);\n * ```\n */\n\nexport function isOk<T>(result: AttemptResult<T>): result is { ok: true; value: T } {\n return result.ok === true;\n}\n\n/**\n * Narrows an `AttemptResult` to the failure branch.\n * @example\n * ```ts\n * const result = await attempt(() => fetch('/api').then(r => r.json()));\n * if (isFail(result)) console.error(result.error);\n * ```\n */\n// eslint-disable-next-line perfectionist/sort-object-types\nexport function isFail<T>(result: AttemptResult<T>): result is { ok: false; error: unknown } {\n return result.ok === false;\n}\n\n/**\n * Executes a function — sync or async — and resolves to an `AttemptResult`.\n * Never throws.\n *\n * @example\n * ```ts\n * // Sync\n * const parsed = attempt(() => JSON.parse(rawJson));\n * if (parsed.ok) console.log(parsed.value);\n * else console.error(parsed.error);\n *\n * // Async\n * const result = await attempt(() => fetch('/api').then(r => r.json()));\n * if (result.ok) console.log(result.value);\n * else console.error(result.error);\n *\n * // Combined with retry()\n * const result = await attempt(() => retry(fn, { times: 3 }));\n * ```\n */\nexport async function attempt<T>(fn: () => T | Promise<T>): Promise<AttemptResult<T>> {\n try {\n return { ok: true, value: await fn() };\n } catch (error) {\n return { error, ok: false };\n }\n}\n","/**\n * Returns the abort error for the given signal.\n *\n * If the signal has a `reason`, that is returned directly (preserving the\n * original error thrown by `AbortController.abort(reason)`).\n * Otherwise, returns a `DOMException` with `name === 'AbortError'`.\n *\n * @example\n * ```ts\n * const ac = new AbortController();\n * ac.abort();\n * throw abortError(ac.signal); // DOMException { name: 'AbortError' }\n *\n * const ac2 = new AbortController();\n * ac2.abort(new TypeError('custom'));\n * throw abortError(ac2.signal); // TypeError('custom')\n * ```\n *\n * @param signal - The aborted signal to extract the error from.\n * @returns The abort reason, or a new `DOMException('Aborted', 'AbortError')`.\n */\nexport function abortError(signal?: AbortSignal): unknown {\n return signal?.reason ?? new DOMException('Aborted', 'AbortError');\n}\n","import { abortError } from './abortError';\n\n/**\n * Processes an array with an async callback with controlled parallelism.\n * Similar to Promise.all, but limits how many items are processed concurrently.\n * Returns an ordered array of results.\n *\n * @example\n * ```ts\n * // Process 3 items at a time\n * const results = await parallel([1, 2, 3, 4, 5], async (n) => {\n * await delay(100);\n * return n * 2;\n * }, { limit: 3 });\n * // [2, 4, 6, 8, 10]\n *\n * // With abort signal\n * const controller = new AbortController();\n * const results = await parallel(items, async (item) => {\n * return processItem(item);\n * }, { limit: 2, signal: controller.signal });\n *\n * // Stop other workers as soon as one item fails\n * await parallel(items, riskyOperation, { abortOnError: true, limit: 3 });\n * ```\n *\n * @param array - Array of items to process\n * @param callback - Async function to process each item\n * @param options - Optional options for concurrency and cancellation\n * @param [options.limit=Infinity] - Maximum number of concurrent operations. Defaults to unbounded.\n * @param [options.signal] - Optional AbortSignal to cancel processing\n * @param [options.abortOnError=false] - When `true`, stops other in-flight workers as soon as any\n * callback throws, instead of letting them keep running to completion unobserved. Default\n * preserves the existing best-effort-completion behavior.\n * @returns Promise resolving to an ordered array of results\n * @throws {RangeError} If limit is less than 1\n * @throws {DOMException} If aborted via signal\n */\nexport async function parallel<T, R>(\n array: readonly T[],\n callback: (item: T, index: number, array: readonly T[]) => Promise<R> | R,\n options: { abortOnError?: boolean; limit?: number; signal?: AbortSignal } = {},\n): Promise<R[]> {\n const { abortOnError = false, limit = Infinity, signal } = options;\n\n if (limit < 1) {\n throw new RangeError(`parallel: limit must be at least 1, got ${limit}`);\n }\n\n if (signal?.aborted) {\n throw abortError(signal);\n }\n\n if (array.length === 0) {\n return [];\n }\n\n const results: R[] = new Array(array.length);\n let currentIndex = 0;\n const failFastController = abortOnError ? new AbortController() : undefined;\n\n const worker = async (): Promise<void> => {\n while (true) {\n if (signal?.aborted) {\n throw abortError(signal);\n }\n\n if (failFastController?.signal.aborted) {\n return;\n }\n\n if (currentIndex >= array.length) {\n return;\n }\n\n const index = currentIndex++;\n\n try {\n results[index] = await callback(array[index]!, index, array);\n } catch (err) {\n failFastController?.abort();\n throw err;\n }\n }\n };\n\n const workerCount = Math.min(limit, array.length);\n const workers = Array.from({ length: workerCount }, () => worker());\n\n await Promise.all(workers);\n\n return results;\n}\n","import { abortError } from './abortError';\n\n/**\n * Creates a Promise that resolves after a specified amount of time.\n * If an `AbortSignal` is provided and fires before the delay elapses, the promise rejects with\n * the signal's reason (or a generic `DOMException('Aborted', 'AbortError')`).\n *\n * @example\n * ```ts\n * sleep(1000).then(() => console.log('Hello, world!')); // logs after 1 second\n *\n * // With abort support\n * const controller = new AbortController();\n * await sleep(5000, controller.signal); // rejects immediately when aborted\n * ```\n *\n * @param timeout - The number of milliseconds to wait before resolving the Promise.\n * @param signal - Optional AbortSignal to cancel the sleep early.\n *\n * @returns A Promise that resolves after the specified time.\n */\nexport async function sleep(timeout: number, signal?: AbortSignal): Promise<void> {\n if (!signal) {\n return new Promise((resolve) => setTimeout(resolve, timeout));\n }\n\n if (signal.aborted) {\n return Promise.reject(abortError(signal));\n }\n\n return new Promise<void>((resolve, reject) => {\n const id = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, timeout);\n\n const onAbort = () => {\n clearTimeout(id);\n signal.removeEventListener('abort', onAbort);\n reject(abortError(signal));\n };\n\n signal.addEventListener('abort', onAbort);\n });\n}\n","import { abortError } from './abortError';\nimport { sleep } from './sleep';\n\nexport type RetryOptions = {\n delay?: number | ((attempt: number) => number);\n onError?: (error: unknown) => void;\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n signal?: AbortSignal;\n timeout?: number;\n times?: number;\n};\n\nfunction buildSignal(timeout: number | undefined, signal: AbortSignal | undefined): AbortSignal | undefined {\n const parts = [timeout !== undefined ? AbortSignal.timeout(timeout) : undefined, signal].filter(\n (s): s is AbortSignal => s != null,\n );\n\n if (parts.length === 0) return undefined;\n\n if (parts.length === 1) return parts[0];\n\n return AbortSignal.any(parts);\n}\n\n/**\n * Retries an async function with optional per-attempt timeout, delay strategy, and abort support.\n * The function receives a merged AbortSignal from the per-attempt timeout and any external signal.\n * On total failure, throws the last error (use `attempt()` to get an `AttemptResult` without throwing).\n *\n * @example\n * ```ts\n * // Basic retry\n * const data = await retry(() => fetch('/api').then(r => r.json()), { times: 3 });\n *\n * // With per-attempt timeout and cancellation\n * const data = await retry(\n * async (signal) => fetch('/api', { signal }).then(r => r.json()),\n * { times: 3, timeout: 5000 },\n * );\n *\n * // As AttemptResult (never throws) — combine with attempt()\n * const result = await attempt(() => retry(fn, { times: 3 }));\n * ```\n *\n * @param fn - Async function to retry. Receives a merged AbortSignal when timeout or signal is set.\n * @param options - Retry configuration.\n * @param [options.times=3] - Total attempts including the first.\n * @param [options.delay=250] - Delay between retries in ms, or a function of (attemptIndex).\n * @param [options.timeout] - Per-attempt timeout in milliseconds.\n * @param [options.signal] - External AbortSignal to cancel all retries.\n * @param [options.shouldRetry] - Predicate called after each non-final failure.\n * Receives the error and the number of failures so far (0-indexed: `0` on the first failure,\n * `1` on the second, etc.). Return `false` to abort immediately. **Not called on the final attempt**\n * (use `onError` to observe the final error unconditionally).\n * @param [options.onError] - Called with the last error before rethrowing — both on final attempt exhaustion\n * and when `shouldRetry` returns `false` to abort early.\n * @returns The resolved value.\n * @throws {RangeError} If `times` is not a positive integer.\n * @throws The last error if all attempts fail.\n */\nexport async function retry<T>(\n fn: (signal?: AbortSignal) => Promise<T>,\n { delay = 250, onError, shouldRetry, signal, timeout, times = 3 }: RetryOptions = {},\n): Promise<T> {\n if (!Number.isInteger(times) || times < 1) {\n throw new RangeError(`retry: times must be a positive integer, got ${times}`);\n }\n\n for (let tryCount = 1; tryCount <= times; tryCount++) {\n if (signal?.aborted) throw abortError(signal);\n\n const callSignal = buildSignal(timeout, signal);\n\n try {\n return await fn(callSignal);\n } catch (err) {\n if (tryCount === times) {\n onError?.(err);\n throw err;\n }\n\n if (shouldRetry && !shouldRetry(err, tryCount - 1)) {\n onError?.(err);\n throw err;\n }\n\n const ms = typeof delay === 'function' ? delay(tryCount - 1) : delay;\n\n if (ms > 0) await sleep(ms, signal);\n }\n }\n\n /* unreachable — the loop always returns or throws before exhausting all attempts */\n return undefined as never;\n}\n","/** Base class for all arsenal errors. Use `instanceof ArsenalError` to catch any arsenal-originated error. */\nexport class ArsenalError extends Error {\n constructor(message: string, opts?: ErrorOptions) {\n super(message, opts);\n this.name = new.target.name;\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\n/**\n * Thrown when converting a value to or from its serialized form fails — e.g. `memo`'s default\n * cache key (`JSON.stringify`) encountering a circular reference, or `hash` encountering an\n * unsupported class instance with `{ onClassInstance: 'throw' }`.\n */\nexport class ArsenalSerializationError extends ArsenalError {}\n","const isDev = !(globalThis as { __ARSENAL_PROD__?: boolean }).__ARSENAL_PROD__;\n\n/** @internal @security Messages may include user data. */\nexport function warn(msg: string): void {\n if (isDev) console.warn(`[@vielzeug/arsenal] ${msg}`);\n}\n","import { warn } from '../_dev';\nimport type { Fn } from '../types';\n\nexport type DebounceOptions = {\n /** Invoke on the leading edge of the delay window. Default: `false`. */\n leading?: boolean;\n /** Invoke on the trailing edge of the delay window. Default: `true`. */\n trailing?: boolean;\n};\n\nexport type Debounced<T extends Fn> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n pending(): boolean;\n};\n\n/**\n * Debounces a function. By default only the trailing edge fires (after input settles).\n * Pass `{ leading: true }` to fire immediately on the first call instead.\n * Pass `{ leading: true, trailing: true }` to fire on both edges.\n *\n * Use `flush()` to invoke immediately, `cancel()` to clear, and `pending()` to check\n * whether an invocation is scheduled.\n *\n * @example\n * ```ts\n * // Trailing (default) — fires after input settles\n * const save = debounce(persist, 500);\n *\n * // Leading — fires on the first keystroke, then silences during the window\n * const submit = debounce(sendRequest, 500, { leading: true, trailing: false });\n * ```\n */\nexport function debounce<T extends Fn>(\n fn: T,\n delay = 300,\n options: DebounceOptions = { leading: false, trailing: true },\n): Debounced<T> {\n const leading = options.leading ?? false;\n const trailing = options.trailing ?? true;\n\n if (!leading && !trailing) {\n warn('debounce: both `leading` and `trailing` are false — the wrapped function will never be invoked.');\n }\n\n let timerId: ReturnType<typeof setTimeout> | undefined;\n let lastArgs: Parameters<T> | undefined;\n let lastResult: ReturnType<T> | undefined;\n let leadingFired = false;\n\n const clearTimer = () => {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n timerId = undefined;\n }\n };\n\n const invokeTrailing = () => {\n clearTimer();\n leadingFired = false;\n\n if (!lastArgs) return undefined;\n\n const args = lastArgs;\n\n lastArgs = undefined;\n lastResult = fn(...args) as ReturnType<T>;\n\n return lastResult;\n };\n\n return Object.assign(\n (...args: Parameters<T>): ReturnType<T> | undefined => {\n lastArgs = args;\n\n if (leading && !leadingFired) {\n leadingFired = true;\n lastResult = fn(...args) as ReturnType<T>;\n // Clear args regardless of `trailing` — the leading call already consumed this\n // invocation. The trailing timer below only re-invokes `fn` if a *further* call\n // arrives during the cooldown window and repopulates `lastArgs`.\n lastArgs = undefined;\n\n if (!trailing) {\n // Leading-only: start cooldown — no trailing call needed\n timerId = setTimeout(() => {\n timerId = undefined;\n leadingFired = false;\n }, delay);\n\n return lastResult;\n }\n }\n\n // When leading-only, ignore calls within the cooldown window\n if (leading && !trailing && leadingFired) return lastResult;\n\n clearTimer();\n timerId = setTimeout(invokeTrailing, delay);\n\n return lastResult;\n },\n {\n cancel: () => {\n clearTimer();\n lastArgs = undefined;\n leadingFired = false;\n },\n flush: (): ReturnType<T> | undefined => invokeTrailing(),\n pending: () => timerId !== undefined,\n },\n );\n}\n","import type { Fn } from '../types';\n\n/**\n * A wrapped function that executes `fn` at most once and exposes a `.reset()` method\n * to allow re-invocation.\n */\nexport type Once<T extends Fn> = T & { reset: () => void };\n\n/**\n * Create a function that runs once and returns the first result.\n *\n * If the first call throws, it does not count as \"called\" — the thrown error propagates to\n * that caller, and the next call will invoke `fn` again (rather than caching the failure).\n *\n * @example\n * ```ts\n * const onceRandom = once(() => Math.random())\n * onceRandom() // 0.3\n * onceRandom() // 0.3\n *\n * onceRandom.reset() // clears the cached result — allows one more invocation\n *\n * onceRandom() // 0.2\n * onceRandom() // 0.2\n * ```\n *\n * @param fn - The function to wrap.\n *\n * @returns A `Once<T>` — the wrapped function with a `.reset()` method to clear the cached result.\n */\nexport const once = <T extends Fn>(fn: T): Once<T> => {\n let result: ReturnType<T> | undefined;\n let called = false;\n\n const wrappedFn = ((...args: Parameters<T>): ReturnType<T> => {\n if (!called) {\n result = fn(...args) as ReturnType<T>;\n called = true;\n }\n\n return result as ReturnType<T>;\n }) as Once<T>;\n\n wrappedFn.reset = () => {\n result = undefined;\n called = false;\n };\n\n return wrappedFn;\n};\n","import type { Fn } from '../types';\n\ntype FirstParameters<T extends readonly Fn[]> = T extends [infer First extends Fn, ...unknown[]]\n ? Parameters<First>\n : never;\ntype LastReturnType<T extends readonly Fn[]> = T extends [...unknown[], infer Last extends Fn]\n ? ReturnType<Last>\n : never;\n\n/**\n * Pipes multiple functions into a single function. It starts from the leftmost function and proceeds to the right.\n *\n * The TypeScript overload captures the input type from the first function and the output type from the last.\n * Intermediate steps are typed as `unknown` at the call site — TypeScript cannot infer a safe chain across\n * heterogeneous function signatures without explicit overloads for every arity.\n *\n * `pipe()` with no arguments returns an identity function `<T>(x: T) => T`.\n *\n * @example\n * ```ts\n * const add = (x: number) => x + 2;\n * const multiply = (x: number) => x * 3;\n * const subtract = (x: number) => x - 4;\n * const pipedFn = pipe(subtract, multiply, add);\n *\n * pipedFn(5); // ((5-4) * 3) + 2 = 5\n *\n * // Zero-arg identity\n * pipe()(42); // 42\n * ```\n *\n * @param fns - List of functions to be piped.\n * @returns A new function that is the pipe of the input functions.\n */\nexport function pipe(): <T>(x: T) => T;\nexport function pipe<T extends readonly [Fn, ...Fn[]]>(...fns: T): (...args: FirstParameters<T>) => LastReturnType<T>;\nexport function pipe(...fns: Fn[]): Fn {\n if (fns.length === 0) return <T>(x: T): T => x;\n\n const [firstFn, ...restFns] = fns;\n\n return (...args: never[]) =>\n restFns.reduce<unknown>((prev, fn) => (fn as (x: unknown) => unknown)(prev), firstFn(...args));\n}\n","import type { Fn } from '../types';\n\nexport type ThrottleOptions = {\n leading?: boolean; // invoke at the start of the window\n trailing?: boolean; // invoke at the end with the last args\n};\n\nexport type Throttled<T extends Fn> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {\n cancel(): void;\n flush(): ReturnType<T> | undefined;\n pending(): boolean; // whether there's a pending call that flush() would execute\n};\n\n/**\n * Throttles a function. By default, only the leading edge fires.\n * Pass `{ trailing: true }` to also invoke at the end of the throttle window.\n *\n * @example\n * ```ts\n * const fn = () => { ... };\n * const t = throttle(fn, 700);\n * const withTrailing = throttle(fn, 700, { trailing: true });\n * ```\n */\nexport function throttle<T extends Fn>(\n fn: T,\n delay = 700,\n options: ThrottleOptions = { leading: true, trailing: false },\n): Throttled<T> {\n const leading = options.leading ?? true;\n const trailing = options.trailing ?? false;\n\n let timerId: ReturnType<typeof setTimeout> | undefined;\n let lastInvokeTime = -Infinity;\n let lastArgs: Parameters<T> | undefined;\n let lastResult: ReturnType<T> | undefined;\n\n const clearTimer = () => {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n timerId = undefined;\n }\n };\n\n const scheduleTimer = (delayMs: number) => {\n timerId = setTimeout(timerExpired, delayMs);\n };\n\n const invoke = (now: number) => {\n lastInvokeTime = now;\n clearTimer();\n\n if (!lastArgs) return undefined;\n\n const args = lastArgs;\n\n lastArgs = undefined;\n lastResult = fn(...args) as ReturnType<T>;\n\n return lastResult;\n };\n\n const remaining = (now: number) => delay - (now - lastInvokeTime);\n\n const timerExpired = () => {\n const now = Date.now();\n\n if (lastArgs && remaining(now) <= 0) {\n // trailing edge invoke\n invoke(now);\n } else if (lastArgs) {\n // reschedule until a window elapses\n scheduleTimer(remaining(now));\n } else {\n clearTimer();\n }\n };\n\n return Object.assign(\n (...args: Parameters<T>): ReturnType<T> | undefined => {\n const now = Date.now();\n\n if (lastInvokeTime === -Infinity && !leading) {\n // If leading is false, start the window now but don't invoke immediately\n lastInvokeTime = now;\n }\n\n lastArgs = args;\n\n const rem = remaining(now);\n\n if (rem <= 0) {\n // Window elapsed: invoke now\n return invoke(now);\n } else if (trailing && !timerId) {\n // Schedule trailing call if not already scheduled\n scheduleTimer(rem);\n }\n\n return lastResult;\n },\n {\n cancel: () => {\n clearTimer();\n lastArgs = undefined;\n lastInvokeTime = -Infinity;\n },\n flush: (): ReturnType<T> | undefined => {\n if (!lastArgs) return undefined;\n\n return invoke(Date.now());\n },\n // Pending if a trailing call is scheduled OR there are queued args.\n pending: () => lastArgs !== undefined || timerId !== undefined,\n },\n );\n}\n","import type { Predicate } from '../types';\n\n/**\n * Returns a predicate that is `true` only when every provided predicate is `true`.\n *\n * With zero predicates, returns `true` for all values (vacuous truth).\n *\n * @example\n * ```ts\n * const isPositiveEven = allOf(\n * (n) => n > 0,\n * (n) => n % 2 === 0,\n * );\n * [1, 2, 3, 4].filter(isPositiveEven); // [2, 4]\n * ```\n */\nexport function allOf<T>(...predicates: Predicate<T>[]): Predicate<T> {\n return (value) => predicates.every((predicate) => predicate(value));\n}\n\n/**\n * Returns a predicate that is `true` when at least one provided predicate is `true`.\n *\n * With zero predicates, returns `false` for all values (vacuous falsity).\n *\n * @example\n * ```ts\n * [1, 2, 3, 4].filter(anyOf((n) => n === 1, (n) => n === 3)); // [1, 3]\n * ```\n */\nexport function anyOf<T>(...predicates: Predicate<T>[]): Predicate<T> {\n return (value) => predicates.some((predicate) => predicate(value));\n}\n\n/**\n * Returns a predicate that is `true` when none of the provided predicates match.\n * With a single predicate this is equivalent to logical NOT.\n *\n * With zero predicates, returns `true` for all values (nothing fails — vacuous truth).\n *\n * @example\n * ```ts\n * [1, 2, 3, 4].filter(noneOf((n) => n % 2 === 0)); // [1, 3]\n * ```\n */\nexport function noneOf<T>(...predicates: Predicate<T>[]): Predicate<T> {\n return (value) => predicates.every((predicate) => !predicate(value));\n}\n\n/**\n * Returns a predicate that negates the given predicate.\n *\n * @example\n * ```ts\n * [1, 2, 3, 4].filter(not((n) => n % 2 === 0)); // [1, 3]\n * ```\n */\nexport function not<T>(predicate: Predicate<T>): Predicate<T> {\n return (value) => !predicate(value);\n}\n","/**\n * Checks if a value is defined (not `undefined`).\n *\n * @example\n * ```ts\n * isDefined(123); // true\n * isDefined(undefined); // false\n * isDefined('hello world'); // true\n * isDefined({}); // true\n * isDefined([]); // true\n * isDefined(null); // true\n * ```\n *\n * @param arg - The value to check.\n *\n * @returns `true` if the value is defined, else `false`.\n */\nexport function isDefined<T>(arg: T | undefined): arg is T {\n return arg !== undefined;\n}\n","/**\n * Recursively compares two values for deep equality.\n * Supports plain objects, arrays, `Date`, `Map`, `Set`, `RegExp`, and circular references.\n *\n * Uses `===` for the primitive comparison, so `isEqual(NaN, NaN)` is `false` and\n * `isEqual(0, -0)` is `true` — the opposite of `shallowEqual`, which uses `Object.is` and\n * treats `NaN` as equal to itself and `-0` as distinct from `0`.\n *\n * For one-level-deep reference equality, use `shallowEqual` instead.\n *\n * @example\n * ```ts\n * isEqual([1, 2, 3], [1, 2, 3]); // true\n * isEqual({ a: { b: 2 } }, { a: { b: 2 } }); // true\n * isEqual(new Date('2023-01-01'), new Date('2023-01-01')); // true\n * isEqual(new Map([['k', 1]]), new Map([['k', 1]])); // true\n * ```\n *\n * @param a - First value to compare.\n * @param b - Second value to compare.\n * @returns `true` if the values are deeply equal.\n */\nexport function isEqual(a: unknown, b: unknown): boolean {\n return safeIsEqual(a, b, new WeakMap());\n}\n\nfunction safeIsEqual(a: unknown, b: unknown, visited: WeakMap<object, object>): boolean {\n // Check for strict equality (handles primitives and references)\n if (a === b) return true;\n\n // If either is null or not an object, they're not equal\n if (a == null || b == null || typeof a !== typeof b || typeof a !== 'object' || typeof b !== 'object') return false;\n\n // Check for circular references\n // We only track 'a' because if 'a' is cyclical, 'b' must also be cyclic to be equal\n if (visited.has(a as object)) {\n return visited.get(a as object) === b;\n }\n\n visited.set(a as object, b as object);\n\n // Array comparison\n if (Array.isArray(a) || Array.isArray(b)) {\n if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;\n\n return a.every((item, idx) => safeIsEqual(item, b[idx], visited));\n }\n\n // Date comparison\n if (a instanceof Date && b instanceof Date) {\n return a.getTime() === b.getTime();\n }\n\n // Map comparison\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n\n for (const [k, v] of a) {\n if (!b.has(k) || !safeIsEqual(v, b.get(k), visited)) return false;\n }\n\n return true;\n }\n\n // Set comparison — fast path for primitive values, deep for objects\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n\n const bItems = [...b];\n\n for (const v of a) {\n // O(1) path for primitives — avoid the O(n) .some() scan\n if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean' || v === null || v === undefined) {\n if (!b.has(v)) return false;\n } else if (!bItems.some((bv) => safeIsEqual(v, bv, visited))) {\n return false;\n }\n }\n\n return true;\n }\n\n // RegExp comparison\n if (a instanceof RegExp || b instanceof RegExp) {\n return a instanceof RegExp && b instanceof RegExp && a.source === b.source && a.flags === b.flags;\n }\n\n // Cross-type guards: Map/Set vs plain objects are never equal\n if (a instanceof Map || b instanceof Map) return false;\n\n if (a instanceof Set || b instanceof Set) return false;\n\n // Object comparison\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n\n if (keysA.length !== keysB.length) return false;\n\n for (const key of keysA) {\n if (\n !Object.hasOwn(b, key) ||\n !safeIsEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key], visited)\n )\n return false;\n }\n\n return true;\n}\n","/**\n * Determines if the passed value is null or undefined.\n *\n * @example\n * ```ts\n * isNil(null); // true\n * isNil(undefined); // true\n * isNil(''); // false\n * isNil(0); // false\n * ```\n *\n * @param arg - The argument to be checked.\n *\n * @returns `true` if the value is null or undefined, else `false`.\n */\nexport function isNil(arg: unknown): arg is null | undefined {\n return arg === undefined || arg === null;\n}\n","/**\n * Returns `true` if `value` is a plain object — one with `Object.prototype` or `null` as its\n * prototype. Class instances, `Map`, `Set`, `Array` and other built-ins all return `false`.\n *\n * @example\n * ```ts\n * isPlainObject({}) // true\n * isPlainObject({ a: 1 }) // true\n * isPlainObject(Object.create(null)) // true\n * isPlainObject(new Map()) // false\n * isPlainObject([]) // false\n * isPlainObject(null) // false\n * ```\n */\nexport function isPlainObject(value: unknown): value is Record<string, unknown> {\n if (value == null || typeof value !== 'object') return false;\n\n const prototype = Object.getPrototypeOf(value);\n\n return prototype === Object.prototype || prototype === null;\n}\n","/**\n * Restricts a number to be within a specified range.\n * Both `min` and `max` are optional — omitting one leaves that end unconstrained.\n *\n * @example\n * ```ts\n * clamp(5, 1, 10) // 5 — within range\n * clamp(0, 1, 10) // 1 — below min\n * clamp(15, 1, 10) // 10 — above max\n * clamp(15, 1) // 15 — no max, above min\n * clamp(-5, undefined, 0) // -5 — no min, below max\n * ```\n *\n * @param n - The number to clamp.\n * @param min - Optional lower bound (inclusive).\n * @param max - Optional upper bound (inclusive).\n *\n * @returns The clamped number.\n */\nexport function clamp(n: number, min?: number, max?: number): number {\n if (min != null && n < min) return min;\n\n if (max != null && n > max) return max;\n\n return n;\n}\n","/**\n * Creates an array of numbers from `0` up to, but not including, `stop` with step `1`.\n *\n * @example\n * ```ts\n * range(5) // [0, 1, 2, 3, 4]\n * ```\n */\nexport function range(stop: number): number[];\n/**\n * Creates an array of numbers from `start` up to, but not including, `stop` with step `1`.\n *\n * @example\n * ```ts\n * range(2, 6) // [2, 3, 4, 5]\n * ```\n */\nexport function range(start: number, stop: number): number[];\n/**\n * Creates an array of numbers progressing from `start` up to, but not including, `stop` with a given `step`.\n *\n * @example\n * ```ts\n * range(0, 10, 2) // [0, 2, 4, 6, 8]\n * range(10, 0, -2) // [10, 8, 6, 4, 2]\n * ```\n *\n * @param start - The start of the range.\n * @param stop - The end of the range (exclusive).\n * @param step - The value to increment or decrement by.\n *\n * @returns The range of numbers.\n *\n * @throws {RangeError} If start, stop, or step are not finite numbers, step is 0, or range exceeds maximum size.\n */\nexport function range(start: number, stop: number, step: number): number[];\nexport function range(startOrStop: number, stop?: number, step?: number): number[] {\n const [resolvedStart, resolvedStop, resolvedStep] =\n stop === undefined ? [0, startOrStop, 1] : step === undefined ? [startOrStop, stop, 1] : [startOrStop, stop, step];\n\n if (!Number.isFinite(resolvedStart) || !Number.isFinite(resolvedStop) || !Number.isFinite(resolvedStep)) {\n throw new RangeError('range: start, stop, and step must be finite numbers');\n }\n\n if (resolvedStep === 0) throw new RangeError('range: step cannot be 0');\n\n if (resolvedStart === resolvedStop) {\n return [];\n }\n\n const raw = (resolvedStop - resolvedStart) / resolvedStep;\n const length = Math.max(0, Number.isInteger(raw) ? raw : Math.ceil(raw + Number.EPSILON));\n\n if (length > 10_000_000) throw new RangeError('range: exceeds maximum allowed size of 10,000,000');\n\n return Array.from({ length }, (_, i) => resolvedStart + i * resolvedStep);\n}\n","import { UNSAFE_PATH_SEGMENTS } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\ntype PathValue<T, P extends string> = P extends `${infer Key}.${infer Rest}`\n ? Key extends keyof T\n ? PathValue<T[Key], Rest>\n : undefined\n : P extends keyof T\n ? T[P]\n : undefined;\n\nfunction pathSegments(path: string): string[] {\n return path\n .replace(/\\[(\\d+)\\]/g, '.$1')\n .replace(/^\\.|\\.$/g, '')\n .split('.')\n .filter(Boolean);\n}\n\nfunction readPath(item: Obj, path: string): unknown {\n let current: unknown = item;\n\n for (const segment of pathSegments(path)) {\n if (UNSAFE_PATH_SEGMENTS.has(segment) || current == null || typeof current !== 'object') return undefined;\n\n current = (current as Record<string, unknown>)[segment];\n\n if (current === undefined) return undefined;\n }\n\n return current;\n}\n\n/**\n * Retrieves a value at a dot-notation or numeric bracket-notation path.\n * Returns `undefined` when the path is missing or contains an unsafe segment.\n * Use `getPathOr` to supply a fallback or `requirePath` to throw on a missing path.\n */\nexport function getPath<T extends Obj, P extends string>(item: T, path: P): PathValue<T, P> | undefined {\n return readPath(item, path) as PathValue<T, P> | undefined;\n}\n\n/**\n * Retrieves a value at a path or returns `fallback` when the path is missing.\n */\nexport function getPathOr<T extends Obj, P extends string, F>(item: T, path: P, fallback: F): PathValue<T, P> | F {\n const value = readPath(item, path);\n\n return (value === undefined ? fallback : value) as PathValue<T, P> | F;\n}\n\n/**\n * Retrieves a value at a path or throws when the path is missing.\n */\nexport function requirePath<T extends Obj, P extends string>(item: T, path: P): Exclude<PathValue<T, P>, undefined> {\n const value = readPath(item, path);\n\n if (value === undefined) throw new TypeError(`Path does not exist: '${path}'`);\n\n return value as Exclude<PathValue<T, P>, undefined>;\n}\n","import { ArsenalSerializationError } from '../errors';\n\nexport type HashOptions = {\n /**\n * What to do when a class instance is encountered (an object whose prototype is\n * neither `Object.prototype` nor `null`).\n *\n * - `'coerce'` (default) — calls `String(value)`.\n * - `'throw'` — throws an `ArsenalSerializationError`.\n */\n onClassInstance?: 'coerce' | 'throw';\n};\n\n/**\n * Produces a deterministic, order-independent string representation of any value.\n * Object keys are sorted alphabetically, so `{ b: 1, a: 2 }` and `{ a: 2, b: 1 }` produce\n * the same output. Handles `Date`, `RegExp`, `Set`, `Map`, and `bigint` in addition to plain JSON.\n *\n * Useful for generating stable cache keys from arbitrary query parameters or options objects.\n *\n * Class instances fall back to `String(value)` by default.\n * Pass `{ onClassInstance: 'throw' }` to throw an `ArsenalSerializationError` instead.\n *\n * @example\n * ```ts\n * hash({ b: 2, a: 1 }) // '{\"a\":1,\"b\":2}'\n * hash([3, 1, 2]) // '[3,1,2]'\n * hash(new Date('2024-01-01T00:00:00Z')) // '[Date:2024-01-01T00:00:00.000Z]'\n * hash(new Set([3, 1, 2])) // '[Set:1,2,3]'\n * hash(new MyClass(), { onClassInstance: 'throw' }) // throws ArsenalSerializationError\n * ```\n *\n * @throws {ArsenalSerializationError} If `options.onClassInstance` is `'throw'` and a class instance is encountered.\n */\nfunction _hash(value: unknown, options: HashOptions | undefined, visited: Set<object>): string {\n if (value === undefined) return 'undefined';\n\n if (value === null) return 'null';\n\n if (typeof value === 'bigint') return `${value}n`;\n\n if (typeof value !== 'object') return JSON.stringify(value);\n\n if (visited.has(value as object)) return '[Circular]';\n\n visited.add(value as object);\n\n if (value instanceof Date) return `[Date:${Number.isNaN(value.getTime()) ? 'Invalid' : value.toISOString()}]`;\n\n if (value instanceof RegExp) return `[RegExp:${value.source}/${value.flags}]`;\n\n if (value instanceof Set)\n return `[Set:${[...value]\n .map((v) => _hash(v, options, visited))\n .sort()\n .join(',')}]`;\n\n if (value instanceof Map) {\n const entries = [...value.entries()]\n .map(([key, entryValue]) => [_hash(key, options, visited), _hash(entryValue, options, visited)] as const)\n .sort(([leftKey, leftValue], [rightKey, rightValue]) =>\n leftKey === rightKey ? leftValue.localeCompare(rightValue) : leftKey.localeCompare(rightKey),\n );\n\n return `[Map:${entries.map(([key, entryValue]) => `${key}=>${entryValue}`).join(',')}]`;\n }\n\n if (Array.isArray(value)) return `[${value.map((v) => _hash(v, options, visited)).join(',')}]`;\n\n const proto = Object.getPrototypeOf(value) as unknown;\n\n if (proto !== Object.prototype && proto !== null) {\n if (options?.onClassInstance === 'throw') {\n throw new ArsenalSerializationError(\n `hash: unsupported type ${(value as { constructor?: { name?: string } }).constructor?.name ?? 'unknown'}`,\n );\n }\n\n return String(value);\n }\n\n const rec = value as Record<string, unknown>;\n const keys = Object.keys(rec)\n .filter((k) => rec[k] !== undefined)\n .sort();\n\n return `{${keys.map((k) => `${JSON.stringify(k)}:${_hash(rec[k], options, visited)}`).join(',')}}`;\n}\n\nexport function hash(value: unknown, options?: HashOptions): string {\n return _hash(value, options, new Set<object>());\n}\n","import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object without the selected keys. Only `obj`'s own enumerable keys are\n * considered; dangerous keys (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param omittedKeys - The keys to exclude.\n * @returns A new object with `omittedKeys` removed.\n */\nexport function omit<T extends Obj, K extends keyof T>(obj: T, omittedKeys: readonly K[]): Omit<T, K> {\n const blacklist = new Set<PropertyKey>(omittedKeys as readonly PropertyKey[]);\n const out = {} as Omit<T, K>;\n\n for (const key of Object.keys(obj) as Array<keyof T>) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (!blacklist.has(key)) {\n (out as T)[key] = obj[key];\n }\n }\n\n return out;\n}\n","import { isUnsafeKey } from '../_common/unsafePaths';\nimport type { Obj } from '../types';\n\n/**\n * Creates a new object containing only selected keys. Only `obj`'s own enumerable keys are\n * considered — inherited properties (e.g. `toString`) are never picked, and dangerous keys\n * (`__proto__`, `constructor`, `prototype`) are always skipped.\n *\n * @example\n * ```ts\n * pick({ a: 1, b: 2, c: 3 }, ['a', 'c']); // { a: 1, c: 3 }\n * ```\n *\n * @param obj - The source object.\n * @param selectedKeys - The keys to keep.\n * @returns A new object containing only `selectedKeys` that exist as own properties of `obj`.\n */\nexport function pick<T extends Obj, K extends keyof T>(obj: T, selectedKeys: readonly K[]): Pick<T, K> {\n const out = {} as Pick<T, K>;\n\n for (const key of selectedKeys) {\n if (isUnsafeKey(key as PropertyKey)) continue;\n\n if (Object.hasOwn(obj, key)) {\n out[key] = obj[key];\n }\n }\n\n return out;\n}\n","/**\n * Generates a unique identifier.\n *\n * @example\n * ```ts\n * uuid(); // a unique identifier, e.g., '22a746d0-08be-4aff-bbc2-4deddf0914e0'\n * ```\n *\n * @returns A unique identifier.\n */\nexport function uuid(): string {\n return crypto.randomUUID();\n}\n","/**\n * Shared regex pattern for splitting words in case conversion utilities.\n * Module-private (underscore-prefixed file is not barrel-exported).\n * Used only with String.prototype.replace — which always resets lastIndex.\n * Uses Unicode property escapes (`\\p{Ll}`/`\\p{Lu}`/`\\p{N}`) instead of `[a-z]`/`[A-Z]` so\n * accented and non-Latin letters (e.g. `café`, `日本語`) are treated as letters, not stripped.\n */\nconst CASE_SPLIT_PATTERN = /(\\p{Ll})(\\p{Lu}|\\p{N})|(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})|(\\p{N})(\\p{L})/gu;\n\n/** Escapes all regex metacharacters in a string (per MDN spec). */\nfunction escapeRegex(str: string): string {\n return str.replace(/[.*+?^${}()|[\\]\\\\/-]/g, '\\\\$&');\n}\n\n/**\n * Normalizes a string by splitting on word boundaries and removing special characters\n *\n * @param str - The string to normalize\n * @param separator - The separator to use for splitting (default: space)\n * @returns The normalized string\n */\nexport function normalizeCase(str: string, separator = ' '): string {\n const escapedSep = escapeRegex(separator);\n\n return str\n .trim()\n .replace(CASE_SPLIT_PATTERN, `$1$3$5${separator}$2$4$6`)\n .replace(/[^\\p{L}\\p{N}]+/gu, separator)\n .replace(new RegExp(`^(?:${escapedSep})+|(?:${escapedSep})+$`, 'g'), '');\n}\n","import { normalizeCase } from './_caseUtils';\n\n/**\n * Converts a string to camel case.\n *\n * @example\n * ```ts\n * const text = 'hello world';\n * camelCase(text); // 'helloWorld'\n * ```\n *\n * @param str - The string to convert.\n * @returns The converted string.\n */\nexport function camelCase(str: string): string {\n return normalizeCase(str, ' ')\n .replace(/[^\\p{L}\\p{N}]+(.)/gu, (_, char) => char.toUpperCase())\n .replace(/^./, (char) => char.toLowerCase());\n}\n"],"mappings":"mEAmBA,SAAgB,EAAS,EAA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