@vielzeug/arsenal 2.1.0 → 3.0.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 (240) hide show
  1. package/README.md +5 -18
  2. package/dist/array/chunk.cjs.map +1 -1
  3. package/dist/array/chunk.d.ts +1 -1
  4. package/dist/array/chunk.d.ts.map +1 -1
  5. package/dist/array/chunk.js.map +1 -1
  6. package/dist/array/compact.cjs.map +1 -1
  7. package/dist/array/compact.d.ts +1 -1
  8. package/dist/array/compact.d.ts.map +1 -1
  9. package/dist/array/compact.js.map +1 -1
  10. package/dist/array/contains.cjs.map +1 -1
  11. package/dist/array/contains.d.ts +1 -1
  12. package/dist/array/contains.d.ts.map +1 -1
  13. package/dist/array/contains.js.map +1 -1
  14. package/dist/array/countBy.cjs.map +1 -1
  15. package/dist/array/countBy.d.ts +1 -1
  16. package/dist/array/countBy.d.ts.map +1 -1
  17. package/dist/array/countBy.js.map +1 -1
  18. package/dist/array/difference.cjs.map +1 -1
  19. package/dist/array/difference.d.ts +4 -2
  20. package/dist/array/difference.d.ts.map +1 -1
  21. package/dist/array/difference.js.map +1 -1
  22. package/dist/array/drop.cjs.map +1 -1
  23. package/dist/array/drop.d.ts +1 -1
  24. package/dist/array/drop.d.ts.map +1 -1
  25. package/dist/array/drop.js.map +1 -1
  26. package/dist/array/dropLast.cjs.map +1 -1
  27. package/dist/array/dropLast.d.ts +1 -1
  28. package/dist/array/dropLast.d.ts.map +1 -1
  29. package/dist/array/dropLast.js.map +1 -1
  30. package/dist/array/filterMap.cjs.map +1 -1
  31. package/dist/array/filterMap.d.ts +3 -1
  32. package/dist/array/filterMap.d.ts.map +1 -1
  33. package/dist/array/filterMap.js.map +1 -1
  34. package/dist/array/first.cjs.map +1 -1
  35. package/dist/array/first.d.ts +1 -1
  36. package/dist/array/first.d.ts.map +1 -1
  37. package/dist/array/first.js.map +1 -1
  38. package/dist/array/groupBy.cjs.map +1 -1
  39. package/dist/array/groupBy.d.ts +1 -1
  40. package/dist/array/groupBy.d.ts.map +1 -1
  41. package/dist/array/groupBy.js.map +1 -1
  42. package/dist/array/index.cjs +1 -1
  43. package/dist/array/index.d.ts +0 -1
  44. package/dist/array/index.d.ts.map +1 -1
  45. package/dist/array/index.js +17 -18
  46. package/dist/array/indexBy.cjs.map +1 -1
  47. package/dist/array/indexBy.d.ts +1 -1
  48. package/dist/array/indexBy.d.ts.map +1 -1
  49. package/dist/array/indexBy.js.map +1 -1
  50. package/dist/array/intersection.cjs.map +1 -1
  51. package/dist/array/intersection.d.ts +4 -2
  52. package/dist/array/intersection.d.ts.map +1 -1
  53. package/dist/array/intersection.js.map +1 -1
  54. package/dist/array/last.cjs.map +1 -1
  55. package/dist/array/last.d.ts +1 -1
  56. package/dist/array/last.d.ts.map +1 -1
  57. package/dist/array/last.js.map +1 -1
  58. package/dist/array/partition.cjs.map +1 -1
  59. package/dist/array/partition.d.ts +3 -1
  60. package/dist/array/partition.d.ts.map +1 -1
  61. package/dist/array/partition.js.map +1 -1
  62. package/dist/array/replace.cjs.map +1 -1
  63. package/dist/array/replace.d.ts +2 -15
  64. package/dist/array/replace.d.ts.map +1 -1
  65. package/dist/array/replace.js.map +1 -1
  66. package/dist/array/rotate.cjs.map +1 -1
  67. package/dist/array/rotate.d.ts +5 -17
  68. package/dist/array/rotate.d.ts.map +1 -1
  69. package/dist/array/rotate.js.map +1 -1
  70. package/dist/array/sort.cjs.map +1 -1
  71. package/dist/array/sort.d.ts +2 -2
  72. package/dist/array/sort.d.ts.map +1 -1
  73. package/dist/array/sort.js.map +1 -1
  74. package/dist/array/take.cjs.map +1 -1
  75. package/dist/array/take.d.ts +1 -1
  76. package/dist/array/take.d.ts.map +1 -1
  77. package/dist/array/take.js.map +1 -1
  78. package/dist/array/takeLast.cjs.map +1 -1
  79. package/dist/array/takeLast.d.ts +1 -1
  80. package/dist/array/takeLast.d.ts.map +1 -1
  81. package/dist/array/takeLast.js.map +1 -1
  82. package/dist/array/toggle.cjs.map +1 -1
  83. package/dist/array/toggle.d.ts +1 -1
  84. package/dist/array/toggle.d.ts.map +1 -1
  85. package/dist/array/toggle.js.map +1 -1
  86. package/dist/array/union.cjs.map +1 -1
  87. package/dist/array/union.d.ts +4 -2
  88. package/dist/array/union.d.ts.map +1 -1
  89. package/dist/array/union.js.map +1 -1
  90. package/dist/array/uniq.cjs.map +1 -1
  91. package/dist/array/uniq.d.ts +1 -1
  92. package/dist/array/uniq.d.ts.map +1 -1
  93. package/dist/array/uniq.js.map +1 -1
  94. package/dist/array/zip.cjs.map +1 -1
  95. package/dist/array/zip.d.ts +1 -1
  96. package/dist/array/zip.d.ts.map +1 -1
  97. package/dist/array/zip.js.map +1 -1
  98. package/dist/arsenal.cjs +1 -1
  99. package/dist/arsenal.cjs.map +1 -1
  100. package/dist/arsenal.iife.js +1 -1
  101. package/dist/arsenal.iife.js.map +1 -1
  102. package/dist/arsenal.js +1 -1
  103. package/dist/arsenal.js.map +1 -1
  104. package/dist/async/abortError.cjs +1 -1
  105. package/dist/async/abortError.cjs.map +1 -1
  106. package/dist/async/abortError.d.ts +3 -2
  107. package/dist/async/abortError.d.ts.map +1 -1
  108. package/dist/async/abortError.js +2 -2
  109. package/dist/async/abortError.js.map +1 -1
  110. package/dist/cache/cache.cjs +1 -1
  111. package/dist/cache/cache.cjs.map +1 -1
  112. package/dist/cache/cache.d.ts +1 -0
  113. package/dist/cache/cache.d.ts.map +1 -1
  114. package/dist/cache/cache.js +1 -0
  115. package/dist/cache/cache.js.map +1 -1
  116. package/dist/function/assert.cjs.map +1 -1
  117. package/dist/function/assert.d.ts +1 -1
  118. package/dist/function/assert.js.map +1 -1
  119. package/dist/guards/index.cjs +1 -1
  120. package/dist/guards/index.js +7 -7
  121. package/dist/guards/isEmpty.cjs +1 -1
  122. package/dist/guards/isEmpty.cjs.map +1 -1
  123. package/dist/guards/isEmpty.d.ts.map +1 -1
  124. package/dist/guards/isEmpty.js +4 -5
  125. package/dist/guards/isEmpty.js.map +1 -1
  126. package/dist/guards/isFunction.cjs.map +1 -1
  127. package/dist/guards/isFunction.d.ts +1 -1
  128. package/dist/guards/isFunction.d.ts.map +1 -1
  129. package/dist/guards/isFunction.js.map +1 -1
  130. package/dist/guards/isPrimitive.cjs +1 -1
  131. package/dist/guards/isPrimitive.cjs.map +1 -1
  132. package/dist/guards/isPrimitive.d.ts +4 -17
  133. package/dist/guards/isPrimitive.d.ts.map +1 -1
  134. package/dist/guards/isPrimitive.js +1 -2
  135. package/dist/guards/isPrimitive.js.map +1 -1
  136. package/dist/index.cjs +1 -1
  137. package/dist/index.d.ts +6 -1
  138. package/dist/index.d.ts.map +1 -1
  139. package/dist/index.js +27 -22
  140. package/dist/math/average.cjs +1 -1
  141. package/dist/math/average.cjs.map +1 -1
  142. package/dist/math/average.d.ts +3 -2
  143. package/dist/math/average.d.ts.map +1 -1
  144. package/dist/math/average.js +1 -6
  145. package/dist/math/average.js.map +1 -1
  146. package/dist/math/gcd.cjs +1 -1
  147. package/dist/math/gcd.cjs.map +1 -1
  148. package/dist/math/gcd.d.ts.map +1 -1
  149. package/dist/math/gcd.js +1 -0
  150. package/dist/math/gcd.js.map +1 -1
  151. package/dist/math/index.cjs +1 -1
  152. package/dist/math/index.d.ts +0 -1
  153. package/dist/math/index.d.ts.map +1 -1
  154. package/dist/math/index.js +7 -8
  155. package/dist/math/lcm.cjs +1 -1
  156. package/dist/math/lcm.cjs.map +1 -1
  157. package/dist/math/lcm.d.ts.map +1 -1
  158. package/dist/math/lcm.js +5 -1
  159. package/dist/math/lcm.js.map +1 -1
  160. package/dist/math/linspace.cjs +1 -1
  161. package/dist/math/linspace.cjs.map +1 -1
  162. package/dist/math/linspace.d.ts.map +1 -1
  163. package/dist/math/linspace.js +2 -1
  164. package/dist/math/linspace.js.map +1 -1
  165. package/dist/math/median.cjs.map +1 -1
  166. package/dist/math/median.d.ts +1 -1
  167. package/dist/math/median.d.ts.map +1 -1
  168. package/dist/math/median.js.map +1 -1
  169. package/dist/math/standardDeviation.cjs.map +1 -1
  170. package/dist/math/standardDeviation.d.ts +1 -1
  171. package/dist/math/standardDeviation.d.ts.map +1 -1
  172. package/dist/math/standardDeviation.js.map +1 -1
  173. package/dist/math/sum.cjs +1 -1
  174. package/dist/math/sum.cjs.map +1 -1
  175. package/dist/math/sum.d.ts +1 -1
  176. package/dist/math/sum.d.ts.map +1 -1
  177. package/dist/math/sum.js +1 -1
  178. package/dist/math/sum.js.map +1 -1
  179. package/dist/math/variance.cjs.map +1 -1
  180. package/dist/math/variance.d.ts +1 -1
  181. package/dist/math/variance.d.ts.map +1 -1
  182. package/dist/math/variance.js.map +1 -1
  183. package/dist/object/diff.cjs.map +1 -1
  184. package/dist/object/diff.d.ts +1 -1
  185. package/dist/object/diff.d.ts.map +1 -1
  186. package/dist/object/diff.js.map +1 -1
  187. package/dist/object/prune.cjs +1 -1
  188. package/dist/object/prune.cjs.map +1 -1
  189. package/dist/object/prune.d.ts.map +1 -1
  190. package/dist/object/prune.js +16 -17
  191. package/dist/object/prune.js.map +1 -1
  192. package/dist/random/_index.cjs +1 -1
  193. package/dist/random/_index.cjs.map +1 -1
  194. package/dist/random/_index.d.ts +1 -1
  195. package/dist/random/_index.d.ts.map +1 -1
  196. package/dist/random/_index.js +4 -5
  197. package/dist/random/_index.js.map +1 -1
  198. package/dist/random/index.cjs +1 -1
  199. package/dist/random/index.d.ts +0 -1
  200. package/dist/random/index.d.ts.map +1 -1
  201. package/dist/random/index.js +2 -2
  202. package/dist/random/source.cjs +2 -0
  203. package/dist/random/source.cjs.map +1 -0
  204. package/dist/random/source.d.ts +2 -0
  205. package/dist/random/source.d.ts.map +1 -1
  206. package/dist/random/source.js +10 -0
  207. package/dist/random/source.js.map +1 -0
  208. package/dist/string/index.cjs +1 -1
  209. package/dist/string/index.d.ts +1 -1
  210. package/dist/string/index.d.ts.map +1 -1
  211. package/dist/string/index.js +2 -2
  212. package/dist/string/{pad.cjs → padCenter.cjs} +2 -2
  213. package/dist/string/padCenter.cjs.map +1 -0
  214. package/dist/string/padCenter.d.ts +3 -0
  215. package/dist/string/padCenter.d.ts.map +1 -0
  216. package/dist/string/{pad.js → padCenter.js} +3 -3
  217. package/dist/string/padCenter.js.map +1 -0
  218. package/package.json +7 -7
  219. package/dist/array/flatten.cjs +0 -2
  220. package/dist/array/flatten.cjs.map +0 -1
  221. package/dist/array/flatten.d.ts +0 -5
  222. package/dist/array/flatten.d.ts.map +0 -1
  223. package/dist/array/flatten.js +0 -11
  224. package/dist/array/flatten.js.map +0 -1
  225. package/dist/math/percent.cjs +0 -2
  226. package/dist/math/percent.cjs.map +0 -1
  227. package/dist/math/percent.d.ts +0 -19
  228. package/dist/math/percent.d.ts.map +0 -1
  229. package/dist/math/percent.js +0 -8
  230. package/dist/math/percent.js.map +0 -1
  231. package/dist/random/uuid.cjs +0 -2
  232. package/dist/random/uuid.cjs.map +0 -1
  233. package/dist/random/uuid.d.ts +0 -12
  234. package/dist/random/uuid.d.ts.map +0 -1
  235. package/dist/random/uuid.js +0 -8
  236. package/dist/random/uuid.js.map +0 -1
  237. package/dist/string/pad.cjs.map +0 -1
  238. package/dist/string/pad.d.ts +0 -5
  239. package/dist/string/pad.d.ts.map +0 -1
  240. package/dist/string/pad.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # @vielzeug/arsenal
2
2
 
3
- > Tree-shakeable, zero-dependency TypeScript utilities with focused category entry points.
4
-
5
- [![npm version](https://img.shields.io/npm/v/@vielzeug/arsenal)](https://www.npmjs.com/package/@vielzeug/arsenal) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
3
+ > Non-trivial TypeScript utilities — retry, cancellation, cache, safe-path, serialization, prototype-pollution-guarded collections
6
4
 
7
5
  ## Installation
8
6
 
@@ -15,7 +13,7 @@ yarn add @vielzeug/arsenal
15
13
  ## Quick Start
16
14
 
17
15
  ```ts
18
- import { chunk, groupBy, retry } from '@vielzeug/arsenal';
16
+ import { groupBy, retry } from '@vielzeug/arsenal';
19
17
  import { fuzzyFilter } from '@vielzeug/arsenal/array';
20
18
  import { taskPool } from '@vielzeug/arsenal/async';
21
19
  import { cache } from '@vielzeug/arsenal/cache';
@@ -30,30 +28,19 @@ const data = await pool.run((signal) => retry(() => fetch('/api', { signal }).th
30
28
 
31
29
  const responses = cache<string, unknown>({ ttlMs: 60_000 });
32
30
  const profile = await responses.getOrLoad('/profile', () => fetch('/profile').then((response) => response.json()));
31
+ const cachedResponses = responses.entries();
33
32
 
34
- console.log(chunk([1, 2, 3], 2), groupBy(matches, (user) => user.name), data, profile);
33
+ console.log(groupBy(matches, (user) => user.name), data, profile, cachedResponses);
35
34
  pool.dispose();
36
35
  ```
37
36
 
38
- ## Entry Points
39
-
40
- - `@vielzeug/arsenal` — curated common utilities
41
- - `@vielzeug/arsenal/array` — array transforms and fuzzy search
42
- - `@vielzeug/arsenal/async` — cancellation, retry, task pools, timing
43
- - `@vielzeug/arsenal/cache` — in-memory cache and memoization
44
- - `@vielzeug/arsenal/function` — function composition and timing
45
- - `@vielzeug/arsenal/guards` — type guards and predicates
46
- - `@vielzeug/arsenal/math` — numeric and statistical helpers
47
- - `@vielzeug/arsenal/object` — object transforms, paths, hash, JSON parsing result
48
- - `@vielzeug/arsenal/random` — cryptographic random helpers
49
- - `@vielzeug/arsenal/string` — text transforms and similarity
50
-
51
37
  ## Documentation
52
38
 
53
39
  - [Overview](https://vielzeug.dev/arsenal/)
54
40
  - [Usage Guide](https://vielzeug.dev/arsenal/usage)
55
41
  - [API Reference](https://vielzeug.dev/arsenal/api)
56
42
  - [Examples](https://vielzeug.dev/arsenal/examples)
43
+ - [Migration Guide](https://vielzeug.dev/arsenal/migration)
57
44
 
58
45
  ## License
59
46
 
@@ -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[]\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
+ {"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: readonly T[], size?: number): T[][];\nexport function chunk<T>(input: readonly 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,EAA8B,EAAO,EAAqB,CACjF,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"}
@@ -16,5 +16,5 @@
16
16
  * @throws {RangeError} If the chunk size is not a positive integer.
17
17
  */
18
18
  export declare function chunk(input: string, size?: number): string[];
19
- export declare function chunk<T>(input: T[], size?: number): T[][];
19
+ export declare function chunk<T>(input: readonly T[], size?: number): T[][];
20
20
  //# sourceMappingURL=chunk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../src/array/chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;AAC9D,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC"}
1
+ {"version":3,"file":"chunk.d.ts","sourceRoot":"","sources":["../../src/array/chunk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;AAC9D,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC"}
@@ -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[]\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
+ {"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: readonly T[], size?: number): T[][];\nexport function chunk<T>(input: readonly 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,GAA8B,IAAO,GAAqB;CACjF,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":"compact.cjs","names":[],"sources":["../../src/array/compact.ts"],"sourcesContent":["type Falsy = false | '' | 0 | 0n | null | undefined;\n\n/**\n * Creates a new array with all falsy values removed.\n */\nexport function compact<T>(array: T[]): Array<Exclude<T, Falsy>> {\n return array.filter(Boolean) as Array<Exclude<T, Falsy>>;\n}\n"],"mappings":"AAKA,SAAgB,EAAW,EAAsC,CAC/D,OAAO,EAAM,OAAO,OAAO,CAC7B"}
1
+ {"version":3,"file":"compact.cjs","names":[],"sources":["../../src/array/compact.ts"],"sourcesContent":["type Falsy = false | '' | 0 | 0n | null | undefined;\n\n/**\n * Creates a new array with all falsy values removed.\n */\nexport function compact<T>(array: readonly T[]): Array<Exclude<T, Falsy>> {\n return array.filter(Boolean) as Array<Exclude<T, Falsy>>;\n}\n"],"mappings":"AAKA,SAAgB,EAAW,EAA+C,CACxE,OAAO,EAAM,OAAO,OAAO,CAC7B"}
@@ -2,6 +2,6 @@ type Falsy = false | '' | 0 | 0n | null | undefined;
2
2
  /**
3
3
  * Creates a new array with all falsy values removed.
4
4
  */
5
- export declare function compact<T>(array: T[]): Array<Exclude<T, Falsy>>;
5
+ export declare function compact<T>(array: readonly T[]): Array<Exclude<T, Falsy>>;
6
6
  export {};
7
7
  //# sourceMappingURL=compact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/array/compact.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,KAAK,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAEpD;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAE/D"}
1
+ {"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../src/array/compact.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG,KAAK,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,SAAS,CAAC;AAEpD;;GAEG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAExE"}
@@ -1 +1 @@
1
- {"version":3,"file":"compact.js","names":[],"sources":["../../src/array/compact.ts"],"sourcesContent":["type Falsy = false | '' | 0 | 0n | null | undefined;\n\n/**\n * Creates a new array with all falsy values removed.\n */\nexport function compact<T>(array: T[]): Array<Exclude<T, Falsy>> {\n return array.filter(Boolean) as Array<Exclude<T, Falsy>>;\n}\n"],"mappings":";AAKA,SAAgB,EAAW,GAAsC;CAC/D,OAAO,EAAM,OAAO,OAAO;AAC7B"}
1
+ {"version":3,"file":"compact.js","names":[],"sources":["../../src/array/compact.ts"],"sourcesContent":["type Falsy = false | '' | 0 | 0n | null | undefined;\n\n/**\n * Creates a new array with all falsy values removed.\n */\nexport function compact<T>(array: readonly T[]): Array<Exclude<T, Falsy>> {\n return array.filter(Boolean) as Array<Exclude<T, Falsy>>;\n}\n"],"mappings":";AAKA,SAAgB,EAAW,GAA+C;CACxE,OAAO,EAAM,OAAO,OAAO;AAC7B"}
@@ -1 +1 @@
1
- {"version":3,"file":"contains.cjs","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes — avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":"yCAkBA,SAAgB,EAAY,EAAY,EAAyB,CAO/D,OAJ6C,OAAO,GAAU,WAA1D,EACK,EAAM,SAAS,CAAU,EAG3B,EAAM,KAAM,GAAQ,EAAA,QAAQ,EAAK,CAAK,CAAC,CAChD"}
1
+ {"version":3,"file":"contains.cjs","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: readonly T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes — avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":"yCAkBA,SAAgB,EAAY,EAAqB,EAAyB,CAOxE,OAJ6C,OAAO,GAAU,WAA1D,EACK,EAAM,SAAS,CAAU,EAG3B,EAAM,KAAM,GAAQ,EAAA,QAAQ,EAAK,CAAK,CAAC,CAChD"}
@@ -13,5 +13,5 @@
13
13
  *
14
14
  * @returns true if the value is present in the array, else false.
15
15
  */
16
- export declare function contains<T>(array: T[], value: unknown): boolean;
16
+ export declare function contains<T>(array: readonly T[], value: unknown): boolean;
17
17
  //# sourceMappingURL=contains.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contains.d.ts","sourceRoot":"","sources":["../../src/array/contains.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAQ/D"}
1
+ {"version":3,"file":"contains.d.ts","sourceRoot":"","sources":["../../src/array/contains.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAQxE"}
@@ -1 +1 @@
1
- {"version":3,"file":"contains.js","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes — avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":";;AAkBA,SAAgB,EAAY,GAAY,GAAyB;CAO/D,OAJ6C,OAAO,KAAU,aAA1D,IACK,EAAM,SAAS,CAAU,IAG3B,EAAM,MAAM,MAAQ,EAAQ,GAAK,CAAK,CAAC;AAChD"}
1
+ {"version":3,"file":"contains.js","names":[],"sources":["../../src/array/contains.ts"],"sourcesContent":["import { isEqual } from '../guards/isEqual';\n\n/**\n * Checks if a value is present in an array.\n *\n * @example\n * ```ts\n * const arr = [1, 2, 3, { a: 1 }, 'hello'];\n * const value = { a: 1 };\n * contains(arr, value) // true;\n * ```\n *\n * @param array - The array to check.\n * @param value - The value to search for.\n *\n * @returns true if the value is present in the array, else false.\n */\n\nexport function contains<T>(array: readonly T[], value: unknown): boolean {\n // Fast path: reference / primitive equality via Array.includes — avoids\n // deep-equal traversal for the common case of searching for a scalar.\n if (value === null || value === undefined || typeof value !== 'object') {\n return array.includes(value as T);\n }\n\n return array.some((val) => isEqual(val, value));\n}\n"],"mappings":";;AAkBA,SAAgB,EAAY,GAAqB,GAAyB;CAOxE,OAJ6C,OAAO,KAAU,aAA1D,IACK,EAAM,SAAS,CAAU,IAG3B,EAAM,MAAM,MAAQ,EAAQ,GAAK,CAAK,CAAC;AAChD"}
@@ -1 +1 @@
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
+ {"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: readonly 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,EAAqB,EAA0D,CACxG,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"}
@@ -4,5 +4,5 @@ import type { Primitive } from '../types';
4
4
  * bucketed under the key `'_'`, matching `groupBy`'s convention. Dangerous keys (`__proto__`,
5
5
  * `constructor`, `prototype`) are skipped.
6
6
  */
7
- export declare function countBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, number>;
7
+ export declare function countBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, number>;
8
8
  //# sourceMappingURL=countBy.d.ts.map
@@ -1 +1 @@
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
+ {"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,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAaxG"}
@@ -1 +1 @@
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
+ {"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: readonly 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,GAAqB,GAA0D;CACxG,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 { 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
+ {"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 *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function difference<T>(source: readonly T[], other: readonly 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":"+CAQA,SAAgB,EAAc,EAAsB,EAAqB,EAAwC,CAC/G,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,6 +1,8 @@
1
1
  import type { Primitive } from '../types';
2
2
  /**
3
- * Returns elements that are in source but not in other.
3
+ * Returns elements that are in `source` but not in `other`.
4
+ *
5
+ * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.
4
6
  */
5
- export declare function difference<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[];
7
+ export declare function difference<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[];
6
8
  //# sourceMappingURL=difference.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"difference.d.ts","sourceRoot":"","sources":["../../src/array/difference.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAU/G"}
@@ -1 +1 @@
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
+ {"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 *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function difference<T>(source: readonly T[], other: readonly 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":";;AAQA,SAAgB,EAAc,GAAsB,GAAqB,GAAwC;CAC/G,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":"drop.cjs","names":[],"sources":["../../src/array/drop.ts"],"sourcesContent":["/**\n * Drops the first n elements from an array.\n */\nexport function drop<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(count);\n}\n"],"mappings":"AAGA,SAAgB,EAAQ,EAAY,EAAI,EAAQ,CAC9C,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAEvC,OAAO,EAAM,MAAM,CAAK,CAC1B"}
1
+ {"version":3,"file":"drop.cjs","names":[],"sources":["../../src/array/drop.ts"],"sourcesContent":["/**\n * Drops the first n elements from an array.\n */\nexport function drop<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(count);\n}\n"],"mappings":"AAGA,SAAgB,EAAQ,EAAqB,EAAI,EAAQ,CACvD,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAEvC,OAAO,EAAM,MAAM,CAAK,CAC1B"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Drops the first n elements from an array.
3
3
  */
4
- export declare function drop<T>(array: T[], n?: number): T[];
4
+ export declare function drop<T>(array: readonly T[], n?: number): T[];
5
5
  //# sourceMappingURL=drop.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../src/array/drop.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,CAI9C"}
1
+ {"version":3,"file":"drop.d.ts","sourceRoot":"","sources":["../../src/array/drop.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,CAIvD"}
@@ -1 +1 @@
1
- {"version":3,"file":"drop.js","names":[],"sources":["../../src/array/drop.ts"],"sourcesContent":["/**\n * Drops the first n elements from an array.\n */\nexport function drop<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(count);\n}\n"],"mappings":";AAGA,SAAgB,EAAQ,GAAY,IAAI,GAAQ;CAC9C,IAAM,IAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC;CAEvC,OAAO,EAAM,MAAM,CAAK;AAC1B"}
1
+ {"version":3,"file":"drop.js","names":[],"sources":["../../src/array/drop.ts"],"sourcesContent":["/**\n * Drops the first n elements from an array.\n */\nexport function drop<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n return array.slice(count);\n}\n"],"mappings":";AAGA,SAAgB,EAAQ,GAAqB,IAAI,GAAQ;CACvD,IAAM,IAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC;CAEvC,OAAO,EAAM,MAAM,CAAK;AAC1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"dropLast.cjs","names":[],"sources":["../../src/array/dropLast.ts"],"sourcesContent":["/**\n * Drops the last n elements from an array.\n */\nexport function dropLast<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [...array];\n\n return array.slice(0, Math.max(0, array.length - count));\n}\n"],"mappings":"AAGA,SAAgB,EAAY,EAAY,EAAI,EAAQ,CAClD,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAIvC,OAFI,IAAU,EAAU,CAAC,GAAG,CAAK,EAE1B,EAAM,MAAM,EAAG,KAAK,IAAI,EAAG,EAAM,OAAS,CAAK,CAAC,CACzD"}
1
+ {"version":3,"file":"dropLast.cjs","names":[],"sources":["../../src/array/dropLast.ts"],"sourcesContent":["/**\n * Drops the last n elements from an array.\n */\nexport function dropLast<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [...array];\n\n return array.slice(0, Math.max(0, array.length - count));\n}\n"],"mappings":"AAGA,SAAgB,EAAY,EAAqB,EAAI,EAAQ,CAC3D,IAAM,EAAQ,KAAK,IAAI,EAAG,KAAK,MAAM,CAAC,CAAC,EAIvC,OAFI,IAAU,EAAU,CAAC,GAAG,CAAK,EAE1B,EAAM,MAAM,EAAG,KAAK,IAAI,EAAG,EAAM,OAAS,CAAK,CAAC,CACzD"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Drops the last n elements from an array.
3
3
  */
4
- export declare function dropLast<T>(array: T[], n?: number): T[];
4
+ export declare function dropLast<T>(array: readonly T[], n?: number): T[];
5
5
  //# sourceMappingURL=dropLast.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dropLast.d.ts","sourceRoot":"","sources":["../../src/array/dropLast.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,CAMlD"}
1
+ {"version":3,"file":"dropLast.d.ts","sourceRoot":"","sources":["../../src/array/dropLast.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,SAAI,GAAG,CAAC,EAAE,CAM3D"}
@@ -1 +1 @@
1
- {"version":3,"file":"dropLast.js","names":[],"sources":["../../src/array/dropLast.ts"],"sourcesContent":["/**\n * Drops the last n elements from an array.\n */\nexport function dropLast<T>(array: T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [...array];\n\n return array.slice(0, Math.max(0, array.length - count));\n}\n"],"mappings":";AAGA,SAAgB,EAAY,GAAY,IAAI,GAAQ;CAClD,IAAM,IAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC;CAIvC,OAFI,MAAU,IAAU,CAAC,GAAG,CAAK,IAE1B,EAAM,MAAM,GAAG,KAAK,IAAI,GAAG,EAAM,SAAS,CAAK,CAAC;AACzD"}
1
+ {"version":3,"file":"dropLast.js","names":[],"sources":["../../src/array/dropLast.ts"],"sourcesContent":["/**\n * Drops the last n elements from an array.\n */\nexport function dropLast<T>(array: readonly T[], n = 1): T[] {\n const count = Math.max(0, Math.floor(n));\n\n if (count === 0) return [...array];\n\n return array.slice(0, Math.max(0, array.length - count));\n}\n"],"mappings":";AAGA,SAAgB,EAAY,GAAqB,IAAI,GAAQ;CAC3D,IAAM,IAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,CAAC,CAAC;CAIvC,OAFI,MAAU,IAAU,CAAC,GAAG,CAAK,IAE1B,EAAM,MAAM,GAAG,KAAK,IAAI,GAAG,EAAM,SAAS,CAAK,CAAC;AACzD"}
@@ -1 +1 @@
1
- {"version":3,"file":"filterMap.cjs","names":[],"sources":["../../src/array/filterMap.ts"],"sourcesContent":["/**\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"],"mappings":"AAGA,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,IAAU,IAAA,IACZ,EAAO,KAAK,CAAK,CAErB,CAEA,OAAO,CACT"}
1
+ {"version":3,"file":"filterMap.cjs","names":[],"sources":["../../src/array/filterMap.ts"],"sourcesContent":["/**\n * Maps and filters in one pass. Returning `undefined` drops an item.\n *\n * Allocates a new array for the result.\n */\nexport function filterMap<T, R>(\n array: readonly T[],\n callback: (item: T, index: number, array: readonly T[]) => R | undefined,\n): 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"],"mappings":"AAKA,SAAgB,EACd,EACA,EACK,CACL,IAAM,EAAc,CAAC,EAErB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IAAS,CACjD,IAAM,EAAQ,EAAS,EAAM,GAAQ,EAAO,CAAK,EAE7C,IAAU,IAAA,IACZ,EAAO,KAAK,CAAK,CAErB,CAEA,OAAO,CACT"}
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Maps and filters in one pass. Returning `undefined` drops an item.
3
+ *
4
+ * Allocates a new array for the result.
3
5
  */
4
- export declare function filterMap<T, R>(array: T[], callback: (item: T, index: number, array: T[]) => R | undefined): R[];
6
+ export declare function filterMap<T, R>(array: readonly T[], callback: (item: T, index: number, array: readonly T[]) => R | undefined): R[];
5
7
  //# sourceMappingURL=filterMap.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterMap.d.ts","sourceRoot":"","sources":["../../src/array/filterMap.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAYhH"}
1
+ {"version":3,"file":"filterMap.d.ts","sourceRoot":"","sources":["../../src/array/filterMap.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAC5B,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,SAAS,GACvE,CAAC,EAAE,CAYL"}
@@ -1 +1 @@
1
- {"version":3,"file":"filterMap.js","names":[],"sources":["../../src/array/filterMap.ts"],"sourcesContent":["/**\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"],"mappings":";AAGA,SAAgB,EAAgB,GAAY,GAAsE;CAChH,IAAM,IAAc,CAAC;CAErB,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KAAS;EACjD,IAAM,IAAQ,EAAS,EAAM,IAAQ,GAAO,CAAK;EAEjD,AAAI,MAAU,KAAA,KACZ,EAAO,KAAK,CAAK;CAErB;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"filterMap.js","names":[],"sources":["../../src/array/filterMap.ts"],"sourcesContent":["/**\n * Maps and filters in one pass. Returning `undefined` drops an item.\n *\n * Allocates a new array for the result.\n */\nexport function filterMap<T, R>(\n array: readonly T[],\n callback: (item: T, index: number, array: readonly T[]) => R | undefined,\n): 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"],"mappings":";AAKA,SAAgB,EACd,GACA,GACK;CACL,IAAM,IAAc,CAAC;CAErB,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KAAS;EACjD,IAAM,IAAQ,EAAS,EAAM,IAAQ,GAAO,CAAK;EAEjD,AAAI,MAAU,KAAA,KACZ,EAAO,KAAK,CAAK;CAErB;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"first.cjs","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,EAAS,EAAY,EAA6B,CAChE,OAAO,EAAM,OAAS,EAAI,EAAM,GAAK,CACvC"}
1
+ {"version":3,"file":"first.cjs","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,EAAS,EAAqB,EAA6B,CACzE,OAAO,EAAM,OAAS,EAAI,EAAM,GAAK,CACvC"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Returns the first element or fallback when array is empty.
3
3
  */
4
- export declare function first<T>(array: T[], fallback?: T): T | undefined;
4
+ export declare function first<T>(array: readonly T[], fallback?: T): T | undefined;
5
5
  //# sourceMappingURL=first.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"first.d.ts","sourceRoot":"","sources":["../../src/array/first.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAEhE"}
1
+ {"version":3,"file":"first.d.ts","sourceRoot":"","sources":["../../src/array/first.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAEzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"first.js","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":";AAGA,SAAgB,EAAS,GAAY,GAA6B;CAChE,OAAO,EAAM,SAAS,IAAI,EAAM,KAAK;AACvC"}
1
+ {"version":3,"file":"first.js","names":[],"sources":["../../src/array/first.ts"],"sourcesContent":["/**\n * Returns the first element or fallback when array is empty.\n */\nexport function first<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[0] : fallback;\n}\n"],"mappings":";AAGA,SAAgB,EAAS,GAAqB,GAA6B;CACzE,OAAO,EAAM,SAAS,IAAI,EAAM,KAAK;AACvC"}
@@ -1 +1 @@
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
+ {"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: readonly 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,EAAqB,EAAuD,CACrG,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"}
@@ -3,5 +3,5 @@ import type { Primitive } from '../types';
3
3
  * Groups elements by a selector function. Dangerous keys (`__proto__`, `constructor`,
4
4
  * `prototype`) are skipped.
5
5
  */
6
- export declare function groupBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T[]>;
6
+ export declare function groupBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T[]>;
7
7
  //# sourceMappingURL=groupBy.d.ts.map
@@ -1 +1 @@
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
+ {"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,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAiBrG"}
@@ -1 +1 @@
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
+ {"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: readonly 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,GAAqB,GAAuD;CACrG,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
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunk.cjs"),t=require("./compact.cjs"),n=require("./compare.cjs"),r=require("./compareBy.cjs"),i=require("./contains.cjs"),a=require("./countBy.cjs"),o=require("./difference.cjs"),s=require("./drop.cjs"),c=require("./dropLast.cjs"),l=require("./filterMap.cjs"),u=require("./first.cjs"),d=require("./flatten.cjs"),f=require("./groupBy.cjs"),p=require("./indexBy.cjs"),m=require("./intersection.cjs"),h=require("./last.cjs"),g=require("./partition.cjs"),_=require("./replace.cjs"),v=require("./rotate.cjs"),y=require("./search.cjs"),b=require("./sort.cjs"),x=require("./take.cjs"),S=require("./takeLast.cjs"),C=require("./toggle.cjs"),w=require("./union.cjs"),T=require("./uniq.cjs"),E=require("./unzip.cjs"),D=require("./zip.cjs");exports.chunk=e.chunk,exports.compact=t.compact,exports.compare=n.compare,exports.compareBy=r.compareBy,exports.contains=i.contains,exports.countBy=a.countBy,exports.difference=o.difference,exports.drop=s.drop,exports.dropLast=c.dropLast,exports.filterMap=l.filterMap,exports.first=u.first,exports.flatten=d.flatten,exports.fuzzyFilter=y.fuzzyFilter,exports.fuzzyScore=y.fuzzyScore,exports.groupBy=f.groupBy,exports.indexBy=p.indexBy,exports.intersection=m.intersection,exports.last=h.last,exports.partition=g.partition,exports.replace=_.replace,exports.rotate=v.rotate,exports.sort=b.sort,exports.take=x.take,exports.takeLast=S.takeLast,exports.toggle=C.toggle,exports.union=w.union,exports.uniq=T.uniq,exports.unzip=E.unzip,exports.zip=D.zip;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./chunk.cjs"),t=require("./compact.cjs"),n=require("./compare.cjs"),r=require("./compareBy.cjs"),i=require("./contains.cjs"),a=require("./countBy.cjs"),o=require("./difference.cjs"),s=require("./drop.cjs"),c=require("./dropLast.cjs"),l=require("./filterMap.cjs"),u=require("./first.cjs"),d=require("./groupBy.cjs"),f=require("./indexBy.cjs"),p=require("./intersection.cjs"),m=require("./last.cjs"),h=require("./partition.cjs"),g=require("./replace.cjs"),_=require("./rotate.cjs"),v=require("./search.cjs"),y=require("./sort.cjs"),b=require("./take.cjs"),x=require("./takeLast.cjs"),S=require("./toggle.cjs"),C=require("./union.cjs"),w=require("./uniq.cjs"),T=require("./unzip.cjs"),E=require("./zip.cjs");exports.chunk=e.chunk,exports.compact=t.compact,exports.compare=n.compare,exports.compareBy=r.compareBy,exports.contains=i.contains,exports.countBy=a.countBy,exports.difference=o.difference,exports.drop=s.drop,exports.dropLast=c.dropLast,exports.filterMap=l.filterMap,exports.first=u.first,exports.fuzzyFilter=v.fuzzyFilter,exports.fuzzyScore=v.fuzzyScore,exports.groupBy=d.groupBy,exports.indexBy=f.indexBy,exports.intersection=p.intersection,exports.last=m.last,exports.partition=h.partition,exports.replace=g.replace,exports.rotate=_.rotate,exports.sort=y.sort,exports.take=b.take,exports.takeLast=x.takeLast,exports.toggle=S.toggle,exports.union=C.union,exports.uniq=w.uniq,exports.unzip=T.unzip,exports.zip=E.zip;
@@ -9,7 +9,6 @@ export * from './drop';
9
9
  export * from './dropLast';
10
10
  export * from './filterMap';
11
11
  export * from './first';
12
- export * from './flatten';
13
12
  export * from './groupBy';
14
13
  export * from './indexBy';
15
14
  export * from './intersection';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/array/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
@@ -9,21 +9,20 @@ import { drop as s } from "./drop.js";
9
9
  import { dropLast as c } from "./dropLast.js";
10
10
  import { filterMap as l } from "./filterMap.js";
11
11
  import { first as u } from "./first.js";
12
- import { flatten as d } from "./flatten.js";
13
- import { groupBy as f } from "./groupBy.js";
14
- import { indexBy as p } from "./indexBy.js";
15
- import { intersection as m } from "./intersection.js";
16
- import { last as h } from "./last.js";
17
- import { partition as g } from "./partition.js";
18
- import { replace as _ } from "./replace.js";
19
- import { rotate as v } from "./rotate.js";
20
- import { fuzzyFilter as y, fuzzyScore as b } from "./search.js";
21
- import { sort as x } from "./sort.js";
22
- import { take as S } from "./take.js";
23
- import { takeLast as C } from "./takeLast.js";
24
- import { toggle as w } from "./toggle.js";
25
- import { union as T } from "./union.js";
26
- import { uniq as E } from "./uniq.js";
27
- import { unzip as D } from "./unzip.js";
28
- import { zip as O } from "./zip.js";
29
- export { e as chunk, t as compact, n as compare, r as compareBy, i as contains, a as countBy, o as difference, s as drop, c as dropLast, l as filterMap, u as first, d as flatten, y as fuzzyFilter, b as fuzzyScore, f as groupBy, p as indexBy, m as intersection, h as last, g as partition, _ as replace, v as rotate, x as sort, S as take, C as takeLast, w as toggle, T as union, E as uniq, D as unzip, O as zip };
12
+ import { groupBy as d } from "./groupBy.js";
13
+ import { indexBy as f } from "./indexBy.js";
14
+ import { intersection as p } from "./intersection.js";
15
+ import { last as m } from "./last.js";
16
+ import { partition as h } from "./partition.js";
17
+ import { replace as g } from "./replace.js";
18
+ import { rotate as _ } from "./rotate.js";
19
+ import { fuzzyFilter as v, fuzzyScore as y } from "./search.js";
20
+ import { sort as b } from "./sort.js";
21
+ import { take as x } from "./take.js";
22
+ import { takeLast as S } from "./takeLast.js";
23
+ import { toggle as C } from "./toggle.js";
24
+ import { union as w } from "./union.js";
25
+ import { uniq as T } from "./uniq.js";
26
+ import { unzip as E } from "./unzip.js";
27
+ import { zip as D } from "./zip.js";
28
+ export { e as chunk, t as compact, n as compare, r as compareBy, i as contains, a as countBy, o as difference, s as drop, c as dropLast, l as filterMap, u as first, v as fuzzyFilter, y as fuzzyScore, d as groupBy, f as indexBy, p as intersection, m as last, h as partition, g as replace, _ as rotate, b as sort, x as take, S as takeLast, C as toggle, w as union, T as uniq, E as unzip, D as zip };
@@ -1 +1 @@
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
+ {"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: readonly 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,EAAqB,EAAqD,CACnG,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"}
@@ -3,5 +3,5 @@ import type { Primitive } from '../types';
3
3
  * Creates an object keyed by selector result. Last item wins on collisions. Dangerous keys
4
4
  * (`__proto__`, `constructor`, `prototype`) are skipped.
5
5
  */
6
- export declare function indexBy<T>(array: T[], selector: (item: T) => Primitive): Record<string, T>;
6
+ export declare function indexBy<T>(array: readonly T[], selector: (item: T) => Primitive): Record<string, T>;
7
7
  //# sourceMappingURL=indexBy.d.ts.map
@@ -1 +1 @@
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
+ {"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,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAYnG"}
@@ -1 +1 @@
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
+ {"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: readonly 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,GAAqB,GAAqD;CACnG,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 { 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
+ {"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 `source` and `other`.\n *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function intersection<T>(source: readonly T[], other: readonly 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":"+CAQA,SAAgB,EAAgB,EAAsB,EAAqB,EAAwC,CACjH,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,6 +1,8 @@
1
1
  import type { Primitive } from '../types';
2
2
  /**
3
- * Returns elements that are present in both arrays.
3
+ * Returns elements that are present in both `source` and `other`.
4
+ *
5
+ * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.
4
6
  */
5
- export declare function intersection<T>(source: T[], other: T[], selector?: (item: T) => Primitive): T[];
7
+ export declare function intersection<T>(source: readonly T[], other: readonly T[], selector?: (item: T) => Primitive): T[];
6
8
  //# sourceMappingURL=intersection.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"intersection.d.ts","sourceRoot":"","sources":["../../src/array/intersection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,SAAS,GAAG,CAAC,EAAE,CAUjH"}
@@ -1 +1 @@
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
+ {"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 `source` and `other`.\n *\n * Allocates a `Set` from `other` for O(1) membership checks, plus a new array for the result.\n */\nexport function intersection<T>(source: readonly T[], other: readonly 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":";;AAQA,SAAgB,EAAgB,GAAsB,GAAqB,GAAwC;CACjH,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":"last.cjs","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,EAAQ,EAAY,EAA6B,CAC/D,OAAO,EAAM,OAAS,EAAI,EAAM,EAAM,OAAS,GAAK,CACtD"}
1
+ {"version":3,"file":"last.cjs","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":"AAGA,SAAgB,EAAQ,EAAqB,EAA6B,CACxE,OAAO,EAAM,OAAS,EAAI,EAAM,EAAM,OAAS,GAAK,CACtD"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Returns the last element or fallback when array is empty.
3
3
  */
4
- export declare function last<T>(array: T[], fallback?: T): T | undefined;
4
+ export declare function last<T>(array: readonly T[], fallback?: T): T | undefined;
5
5
  //# sourceMappingURL=last.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"last.d.ts","sourceRoot":"","sources":["../../src/array/last.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAE/D"}
1
+ {"version":3,"file":"last.d.ts","sourceRoot":"","sources":["../../src/array/last.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAExE"}
@@ -1 +1 @@
1
- {"version":3,"file":"last.js","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":";AAGA,SAAgB,EAAQ,GAAY,GAA6B;CAC/D,OAAO,EAAM,SAAS,IAAI,EAAM,EAAM,SAAS,KAAK;AACtD"}
1
+ {"version":3,"file":"last.js","names":[],"sources":["../../src/array/last.ts"],"sourcesContent":["/**\n * Returns the last element or fallback when array is empty.\n */\nexport function last<T>(array: readonly T[], fallback?: T): T | undefined {\n return array.length > 0 ? array[array.length - 1] : fallback;\n}\n"],"mappings":";AAGA,SAAgB,EAAQ,GAAqB,GAA6B;CACxE,OAAO,EAAM,SAAS,IAAI,EAAM,EAAM,SAAS,KAAK;AACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"partition.cjs","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\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"],"mappings":"AAGA,SAAgB,EAAa,EAAY,EAAwE,CAC/G,IAAM,EAAgB,CAAC,EACjB,EAAgB,CAAC,EAEvB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IACpC,EAAU,EAAM,GAAQ,EAAO,CAAK,EACtC,EAAS,KAAK,EAAM,EAAM,EAE1B,EAAS,KAAK,EAAM,EAAM,EAI9B,MAAO,CAAC,EAAU,CAAQ,CAC5B"}
1
+ {"version":3,"file":"partition.cjs","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into values that match and do not match the predicate.\n *\n * Allocates two new arrays for the accepted and rejected partitions.\n */\nexport function partition<T>(\n array: readonly T[],\n predicate: (item: T, index: number, array: readonly T[]) => boolean,\n): [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"],"mappings":"AAKA,SAAgB,EACd,EACA,EACY,CACZ,IAAM,EAAgB,CAAC,EACjB,EAAgB,CAAC,EAEvB,IAAK,IAAI,EAAQ,EAAG,EAAQ,EAAM,OAAQ,IACpC,EAAU,EAAM,GAAQ,EAAO,CAAK,EACtC,EAAS,KAAK,EAAM,EAAM,EAE1B,EAAS,KAAK,EAAM,EAAM,EAI9B,MAAO,CAAC,EAAU,CAAQ,CAC5B"}
@@ -1,5 +1,7 @@
1
1
  /**
2
2
  * Splits an array into values that match and do not match the predicate.
3
+ *
4
+ * Allocates two new arrays for the accepted and rejected partitions.
3
5
  */
4
- export declare function partition<T>(array: T[], predicate: (item: T, index: number, array: T[]) => boolean): [T[], T[]];
6
+ export declare function partition<T>(array: readonly T[], predicate: (item: T, index: number, array: readonly T[]) => boolean): [T[], T[]];
5
7
  //# sourceMappingURL=partition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"partition.d.ts","sourceRoot":"","sources":["../../src/array/partition.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAa/G"}
1
+ {"version":3,"file":"partition.d.ts","sourceRoot":"","sources":["../../src/array/partition.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,KAAK,OAAO,GAClE,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAaZ"}
@@ -1 +1 @@
1
- {"version":3,"file":"partition.js","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\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"],"mappings":";AAGA,SAAgB,EAAa,GAAY,GAAwE;CAC/G,IAAM,IAAgB,CAAC,GACjB,IAAgB,CAAC;CAEvB,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KACxC,AAAI,EAAU,EAAM,IAAQ,GAAO,CAAK,IACtC,EAAS,KAAK,EAAM,EAAM,IAE1B,EAAS,KAAK,EAAM,EAAM;CAI9B,OAAO,CAAC,GAAU,CAAQ;AAC5B"}
1
+ {"version":3,"file":"partition.js","names":[],"sources":["../../src/array/partition.ts"],"sourcesContent":["/**\n * Splits an array into values that match and do not match the predicate.\n *\n * Allocates two new arrays for the accepted and rejected partitions.\n */\nexport function partition<T>(\n array: readonly T[],\n predicate: (item: T, index: number, array: readonly T[]) => boolean,\n): [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"],"mappings":";AAKA,SAAgB,EACd,GACA,GACY;CACZ,IAAM,IAAgB,CAAC,GACjB,IAAgB,CAAC;CAEvB,KAAK,IAAI,IAAQ,GAAG,IAAQ,EAAM,QAAQ,KACxC,AAAI,EAAU,EAAM,IAAQ,GAAO,CAAK,IACtC,EAAS,KAAK,EAAM,EAAM,IAE1B,EAAS,KAAK,EAAM,EAAM;CAI9B,OAAO,CAAC,GAAU,CAAQ;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"replace.cjs","names":[],"sources":["../../src/array/replace.ts"],"sourcesContent":["import type { Predicate } from '../types';\n\n/**\n * Replaces the first element in an array that satisfies the provided predicate\n * function with a new value.\n *\n * @example\n * ```ts\n * replace([1, 2, 3], (n) => n === 2, 4) // [1, 4, 3]\n * ```\n *\n * @param array - The array to search.\n * @param predicate - A function to test each element of the array.\n * @param value - The new value to replace the found element.\n *\n * @return A new array with the replaced value.\n */\nexport function replace<T>(array: T[], predicate: Predicate<T>, value: T): T[] {\n const index = array.findIndex(predicate);\n\n if (index === -1) return array;\n\n return [...array.slice(0, index), value, ...array.slice(index + 1)];\n}\n"],"mappings":"AAiBA,SAAgB,EAAW,EAAY,EAAyB,EAAe,CAC7E,IAAM,EAAQ,EAAM,UAAU,CAAS,EAIvC,OAFI,IAAU,GAAW,EAElB,CAAC,GAAG,EAAM,MAAM,EAAG,CAAK,EAAG,EAAO,GAAG,EAAM,MAAM,EAAQ,CAAC,CAAC,CACpE"}
1
+ {"version":3,"file":"replace.cjs","names":[],"sources":["../../src/array/replace.ts"],"sourcesContent":["import type { Predicate } from '../types';\n\n/** Replaces the first matching item without mutating the input. */\nexport function replace<T>(array: T[], predicate: Predicate<T>, value: T): T[];\nexport function replace<T>(array: readonly T[], predicate: Predicate<T>, value: T): readonly T[];\nexport function replace<T>(array: readonly T[], predicate: Predicate<T>, value: T): readonly T[] {\n const index = array.findIndex(predicate);\n\n if (index === -1) return array;\n\n return [...array.slice(0, index), value, ...array.slice(index + 1)];\n}\n"],"mappings":"AAKA,SAAgB,EAAW,EAAqB,EAAyB,EAAwB,CAC/F,IAAM,EAAQ,EAAM,UAAU,CAAS,EAIvC,OAFI,IAAU,GAAW,EAElB,CAAC,GAAG,EAAM,MAAM,EAAG,CAAK,EAAG,EAAO,GAAG,EAAM,MAAM,EAAQ,CAAC,CAAC,CACpE"}