@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.
- package/README.md +5 -18
- package/dist/array/chunk.cjs.map +1 -1
- package/dist/array/chunk.d.ts +1 -1
- package/dist/array/chunk.d.ts.map +1 -1
- package/dist/array/chunk.js.map +1 -1
- package/dist/array/compact.cjs.map +1 -1
- package/dist/array/compact.d.ts +1 -1
- package/dist/array/compact.d.ts.map +1 -1
- package/dist/array/compact.js.map +1 -1
- package/dist/array/contains.cjs.map +1 -1
- package/dist/array/contains.d.ts +1 -1
- package/dist/array/contains.d.ts.map +1 -1
- package/dist/array/contains.js.map +1 -1
- package/dist/array/countBy.cjs.map +1 -1
- package/dist/array/countBy.d.ts +1 -1
- package/dist/array/countBy.d.ts.map +1 -1
- package/dist/array/countBy.js.map +1 -1
- package/dist/array/difference.cjs.map +1 -1
- package/dist/array/difference.d.ts +4 -2
- package/dist/array/difference.d.ts.map +1 -1
- package/dist/array/difference.js.map +1 -1
- package/dist/array/drop.cjs.map +1 -1
- package/dist/array/drop.d.ts +1 -1
- package/dist/array/drop.d.ts.map +1 -1
- package/dist/array/drop.js.map +1 -1
- package/dist/array/dropLast.cjs.map +1 -1
- package/dist/array/dropLast.d.ts +1 -1
- package/dist/array/dropLast.d.ts.map +1 -1
- package/dist/array/dropLast.js.map +1 -1
- package/dist/array/filterMap.cjs.map +1 -1
- package/dist/array/filterMap.d.ts +3 -1
- package/dist/array/filterMap.d.ts.map +1 -1
- package/dist/array/filterMap.js.map +1 -1
- package/dist/array/first.cjs.map +1 -1
- package/dist/array/first.d.ts +1 -1
- package/dist/array/first.d.ts.map +1 -1
- package/dist/array/first.js.map +1 -1
- package/dist/array/groupBy.cjs.map +1 -1
- package/dist/array/groupBy.d.ts +1 -1
- package/dist/array/groupBy.d.ts.map +1 -1
- package/dist/array/groupBy.js.map +1 -1
- package/dist/array/index.cjs +1 -1
- package/dist/array/index.d.ts +0 -1
- package/dist/array/index.d.ts.map +1 -1
- package/dist/array/index.js +17 -18
- package/dist/array/indexBy.cjs.map +1 -1
- package/dist/array/indexBy.d.ts +1 -1
- package/dist/array/indexBy.d.ts.map +1 -1
- package/dist/array/indexBy.js.map +1 -1
- package/dist/array/intersection.cjs.map +1 -1
- package/dist/array/intersection.d.ts +4 -2
- package/dist/array/intersection.d.ts.map +1 -1
- package/dist/array/intersection.js.map +1 -1
- package/dist/array/last.cjs.map +1 -1
- package/dist/array/last.d.ts +1 -1
- package/dist/array/last.d.ts.map +1 -1
- package/dist/array/last.js.map +1 -1
- package/dist/array/partition.cjs.map +1 -1
- package/dist/array/partition.d.ts +3 -1
- package/dist/array/partition.d.ts.map +1 -1
- package/dist/array/partition.js.map +1 -1
- package/dist/array/replace.cjs.map +1 -1
- package/dist/array/replace.d.ts +2 -15
- package/dist/array/replace.d.ts.map +1 -1
- package/dist/array/replace.js.map +1 -1
- package/dist/array/rotate.cjs.map +1 -1
- package/dist/array/rotate.d.ts +5 -17
- package/dist/array/rotate.d.ts.map +1 -1
- package/dist/array/rotate.js.map +1 -1
- package/dist/array/sort.cjs.map +1 -1
- package/dist/array/sort.d.ts +2 -2
- package/dist/array/sort.d.ts.map +1 -1
- package/dist/array/sort.js.map +1 -1
- package/dist/array/take.cjs.map +1 -1
- package/dist/array/take.d.ts +1 -1
- package/dist/array/take.d.ts.map +1 -1
- package/dist/array/take.js.map +1 -1
- package/dist/array/takeLast.cjs.map +1 -1
- package/dist/array/takeLast.d.ts +1 -1
- package/dist/array/takeLast.d.ts.map +1 -1
- package/dist/array/takeLast.js.map +1 -1
- package/dist/array/toggle.cjs.map +1 -1
- package/dist/array/toggle.d.ts +1 -1
- package/dist/array/toggle.d.ts.map +1 -1
- package/dist/array/toggle.js.map +1 -1
- package/dist/array/union.cjs.map +1 -1
- package/dist/array/union.d.ts +4 -2
- package/dist/array/union.d.ts.map +1 -1
- package/dist/array/union.js.map +1 -1
- package/dist/array/uniq.cjs.map +1 -1
- package/dist/array/uniq.d.ts +1 -1
- package/dist/array/uniq.d.ts.map +1 -1
- package/dist/array/uniq.js.map +1 -1
- package/dist/array/zip.cjs.map +1 -1
- package/dist/array/zip.d.ts +1 -1
- package/dist/array/zip.d.ts.map +1 -1
- package/dist/array/zip.js.map +1 -1
- package/dist/arsenal.cjs +1 -1
- package/dist/arsenal.cjs.map +1 -1
- package/dist/arsenal.iife.js +1 -1
- package/dist/arsenal.iife.js.map +1 -1
- package/dist/arsenal.js +1 -1
- package/dist/arsenal.js.map +1 -1
- package/dist/async/abortError.cjs +1 -1
- package/dist/async/abortError.cjs.map +1 -1
- package/dist/async/abortError.d.ts +3 -2
- package/dist/async/abortError.d.ts.map +1 -1
- package/dist/async/abortError.js +2 -2
- package/dist/async/abortError.js.map +1 -1
- package/dist/cache/cache.cjs +1 -1
- package/dist/cache/cache.cjs.map +1 -1
- package/dist/cache/cache.d.ts +1 -0
- package/dist/cache/cache.d.ts.map +1 -1
- package/dist/cache/cache.js +1 -0
- package/dist/cache/cache.js.map +1 -1
- package/dist/function/assert.cjs.map +1 -1
- package/dist/function/assert.d.ts +1 -1
- package/dist/function/assert.js.map +1 -1
- package/dist/guards/index.cjs +1 -1
- package/dist/guards/index.js +7 -7
- package/dist/guards/isEmpty.cjs +1 -1
- package/dist/guards/isEmpty.cjs.map +1 -1
- package/dist/guards/isEmpty.d.ts.map +1 -1
- package/dist/guards/isEmpty.js +4 -5
- package/dist/guards/isEmpty.js.map +1 -1
- package/dist/guards/isFunction.cjs.map +1 -1
- package/dist/guards/isFunction.d.ts +1 -1
- package/dist/guards/isFunction.d.ts.map +1 -1
- package/dist/guards/isFunction.js.map +1 -1
- package/dist/guards/isPrimitive.cjs +1 -1
- package/dist/guards/isPrimitive.cjs.map +1 -1
- package/dist/guards/isPrimitive.d.ts +4 -17
- package/dist/guards/isPrimitive.d.ts.map +1 -1
- package/dist/guards/isPrimitive.js +1 -2
- package/dist/guards/isPrimitive.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -22
- package/dist/math/average.cjs +1 -1
- package/dist/math/average.cjs.map +1 -1
- package/dist/math/average.d.ts +3 -2
- package/dist/math/average.d.ts.map +1 -1
- package/dist/math/average.js +1 -6
- package/dist/math/average.js.map +1 -1
- package/dist/math/gcd.cjs +1 -1
- package/dist/math/gcd.cjs.map +1 -1
- package/dist/math/gcd.d.ts.map +1 -1
- package/dist/math/gcd.js +1 -0
- package/dist/math/gcd.js.map +1 -1
- package/dist/math/index.cjs +1 -1
- package/dist/math/index.d.ts +0 -1
- package/dist/math/index.d.ts.map +1 -1
- package/dist/math/index.js +7 -8
- package/dist/math/lcm.cjs +1 -1
- package/dist/math/lcm.cjs.map +1 -1
- package/dist/math/lcm.d.ts.map +1 -1
- package/dist/math/lcm.js +5 -1
- package/dist/math/lcm.js.map +1 -1
- package/dist/math/linspace.cjs +1 -1
- package/dist/math/linspace.cjs.map +1 -1
- package/dist/math/linspace.d.ts.map +1 -1
- package/dist/math/linspace.js +2 -1
- package/dist/math/linspace.js.map +1 -1
- package/dist/math/median.cjs.map +1 -1
- package/dist/math/median.d.ts +1 -1
- package/dist/math/median.d.ts.map +1 -1
- package/dist/math/median.js.map +1 -1
- package/dist/math/standardDeviation.cjs.map +1 -1
- package/dist/math/standardDeviation.d.ts +1 -1
- package/dist/math/standardDeviation.d.ts.map +1 -1
- package/dist/math/standardDeviation.js.map +1 -1
- package/dist/math/sum.cjs +1 -1
- package/dist/math/sum.cjs.map +1 -1
- package/dist/math/sum.d.ts +1 -1
- package/dist/math/sum.d.ts.map +1 -1
- package/dist/math/sum.js +1 -1
- package/dist/math/sum.js.map +1 -1
- package/dist/math/variance.cjs.map +1 -1
- package/dist/math/variance.d.ts +1 -1
- package/dist/math/variance.d.ts.map +1 -1
- package/dist/math/variance.js.map +1 -1
- package/dist/object/diff.cjs.map +1 -1
- package/dist/object/diff.d.ts +1 -1
- package/dist/object/diff.d.ts.map +1 -1
- package/dist/object/diff.js.map +1 -1
- package/dist/object/prune.cjs +1 -1
- package/dist/object/prune.cjs.map +1 -1
- package/dist/object/prune.d.ts.map +1 -1
- package/dist/object/prune.js +16 -17
- package/dist/object/prune.js.map +1 -1
- package/dist/random/_index.cjs +1 -1
- package/dist/random/_index.cjs.map +1 -1
- package/dist/random/_index.d.ts +1 -1
- package/dist/random/_index.d.ts.map +1 -1
- package/dist/random/_index.js +4 -5
- package/dist/random/_index.js.map +1 -1
- package/dist/random/index.cjs +1 -1
- package/dist/random/index.d.ts +0 -1
- package/dist/random/index.d.ts.map +1 -1
- package/dist/random/index.js +2 -2
- package/dist/random/source.cjs +2 -0
- package/dist/random/source.cjs.map +1 -0
- package/dist/random/source.d.ts +2 -0
- package/dist/random/source.d.ts.map +1 -1
- package/dist/random/source.js +10 -0
- package/dist/random/source.js.map +1 -0
- package/dist/string/index.cjs +1 -1
- package/dist/string/index.d.ts +1 -1
- package/dist/string/index.d.ts.map +1 -1
- package/dist/string/index.js +2 -2
- package/dist/string/{pad.cjs → padCenter.cjs} +2 -2
- package/dist/string/padCenter.cjs.map +1 -0
- package/dist/string/padCenter.d.ts +3 -0
- package/dist/string/padCenter.d.ts.map +1 -0
- package/dist/string/{pad.js → padCenter.js} +3 -3
- package/dist/string/padCenter.js.map +1 -0
- package/package.json +7 -7
- package/dist/array/flatten.cjs +0 -2
- package/dist/array/flatten.cjs.map +0 -1
- package/dist/array/flatten.d.ts +0 -5
- package/dist/array/flatten.d.ts.map +0 -1
- package/dist/array/flatten.js +0 -11
- package/dist/array/flatten.js.map +0 -1
- package/dist/math/percent.cjs +0 -2
- package/dist/math/percent.cjs.map +0 -1
- package/dist/math/percent.d.ts +0 -19
- package/dist/math/percent.d.ts.map +0 -1
- package/dist/math/percent.js +0 -8
- package/dist/math/percent.js.map +0 -1
- package/dist/random/uuid.cjs +0 -2
- package/dist/random/uuid.cjs.map +0 -1
- package/dist/random/uuid.d.ts +0 -12
- package/dist/random/uuid.d.ts.map +0 -1
- package/dist/random/uuid.js +0 -8
- package/dist/random/uuid.js.map +0 -1
- package/dist/string/pad.cjs.map +0 -1
- package/dist/string/pad.d.ts +0 -5
- package/dist/string/pad.d.ts.map +0 -1
- package/dist/string/pad.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
# @vielzeug/arsenal
|
|
2
2
|
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/@vielzeug/arsenal) [](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 {
|
|
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(
|
|
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
|
|
package/dist/array/chunk.cjs.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/chunk.d.ts
CHANGED
|
@@ -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"}
|
package/dist/array/chunk.js.map
CHANGED
|
@@ -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,
|
|
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,
|
|
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"}
|
package/dist/array/compact.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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,
|
|
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"}
|
package/dist/array/contains.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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,
|
|
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"}
|
package/dist/array/countBy.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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":"+
|
|
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
|
|
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":";;
|
|
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"}
|
package/dist/array/drop.cjs.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/drop.d.ts
CHANGED
package/dist/array/drop.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/drop.js.map
CHANGED
|
@@ -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,
|
|
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,
|
|
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"}
|
package/dist/array/dropLast.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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[]
|
|
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
|
|
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[]
|
|
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"}
|
package/dist/array/first.cjs.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/first.d.ts
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/first.js.map
CHANGED
|
@@ -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,
|
|
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,
|
|
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"}
|
package/dist/array/groupBy.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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"}
|
package/dist/array/index.cjs
CHANGED
|
@@ -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("./
|
|
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;
|
package/dist/array/index.d.ts
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/index.js
CHANGED
|
@@ -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 {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
|
|
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,
|
|
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"}
|
package/dist/array/indexBy.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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"}
|
package/dist/array/last.cjs.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/last.d.ts
CHANGED
package/dist/array/last.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/array/last.js.map
CHANGED
|
@@ -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,
|
|
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[]
|
|
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
|
|
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[]
|
|
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
|
|
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"}
|