@xylabs/array 5.0.82 → 5.0.84
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 +57 -0
- package/dist/neutral/containsAll.d.ts +6 -0
- package/dist/neutral/containsAll.d.ts.map +1 -1
- package/dist/neutral/distinct.d.ts +4 -0
- package/dist/neutral/distinct.d.ts.map +1 -1
- package/dist/neutral/filterAs.d.ts +6 -0
- package/dist/neutral/filterAs.d.ts.map +1 -1
- package/dist/neutral/findAs.d.ts +12 -0
- package/dist/neutral/findAs.d.ts.map +1 -1
- package/dist/neutral/flatten.d.ts +6 -0
- package/dist/neutral/flatten.d.ts.map +1 -1
- package/dist/neutral/index.mjs.map +1 -1
- package/dist/neutral/uniq.d.ts +11 -0
- package/dist/neutral/uniq.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -45,6 +45,8 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
45
45
|
function containsAll<T>(source, target): boolean;
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
Checks whether the source array contains every element in the target array.
|
|
49
|
+
|
|
48
50
|
## Type Parameters
|
|
49
51
|
|
|
50
52
|
### T
|
|
@@ -57,14 +59,20 @@ function containsAll<T>(source, target): boolean;
|
|
|
57
59
|
|
|
58
60
|
`T`[]
|
|
59
61
|
|
|
62
|
+
The array to search within
|
|
63
|
+
|
|
60
64
|
### target
|
|
61
65
|
|
|
62
66
|
`T`[]
|
|
63
67
|
|
|
68
|
+
The elements that must all be present
|
|
69
|
+
|
|
64
70
|
## Returns
|
|
65
71
|
|
|
66
72
|
`boolean`
|
|
67
73
|
|
|
74
|
+
True if every target element exists in source
|
|
75
|
+
|
|
68
76
|
### <a id="distinct"></a>distinct
|
|
69
77
|
|
|
70
78
|
[**@xylabs/array**](#../README)
|
|
@@ -78,6 +86,9 @@ function distinct<T>(
|
|
|
78
86
|
array): boolean;
|
|
79
87
|
```
|
|
80
88
|
|
|
89
|
+
Array filter callback that removes duplicate values, with correct NaN handling.
|
|
90
|
+
Use with `array.filter(distinct)`.
|
|
91
|
+
|
|
81
92
|
## Type Parameters
|
|
82
93
|
|
|
83
94
|
### T
|
|
@@ -112,6 +123,8 @@ function distinct<T>(
|
|
|
112
123
|
function filterAs<In, Out>(x, predicate): NonNullable<Out>[];
|
|
113
124
|
```
|
|
114
125
|
|
|
126
|
+
Maps each element using the predicate and filters out nullish results.
|
|
127
|
+
|
|
115
128
|
## Type Parameters
|
|
116
129
|
|
|
117
130
|
### In
|
|
@@ -128,14 +141,20 @@ function filterAs<In, Out>(x, predicate): NonNullable<Out>[];
|
|
|
128
141
|
|
|
129
142
|
`In`[]
|
|
130
143
|
|
|
144
|
+
The input array
|
|
145
|
+
|
|
131
146
|
### predicate
|
|
132
147
|
|
|
133
148
|
(`a`) => `Out`
|
|
134
149
|
|
|
150
|
+
Transform function applied to each element
|
|
151
|
+
|
|
135
152
|
## Returns
|
|
136
153
|
|
|
137
154
|
`NonNullable`\<`Out`\>[]
|
|
138
155
|
|
|
156
|
+
Array of non-nullish transformed values
|
|
157
|
+
|
|
139
158
|
### <a id="filterAsync"></a>filterAsync
|
|
140
159
|
|
|
141
160
|
[**@xylabs/array**](#../README)
|
|
@@ -184,6 +203,8 @@ The elements of an array that meet the condition specified in a callback functio
|
|
|
184
203
|
function findAs<In, Out>(x, predicate): NonNullable<Out> | undefined;
|
|
185
204
|
```
|
|
186
205
|
|
|
206
|
+
Maps each element using the predicate and returns the first non-nullish result.
|
|
207
|
+
|
|
187
208
|
## Type Parameters
|
|
188
209
|
|
|
189
210
|
### In
|
|
@@ -200,14 +221,20 @@ function findAs<In, Out>(x, predicate): NonNullable<Out> | undefined;
|
|
|
200
221
|
|
|
201
222
|
`In`[]
|
|
202
223
|
|
|
224
|
+
The input array
|
|
225
|
+
|
|
203
226
|
### predicate
|
|
204
227
|
|
|
205
228
|
(`a`) => `Out`
|
|
206
229
|
|
|
230
|
+
Transform function applied to each element
|
|
231
|
+
|
|
207
232
|
## Returns
|
|
208
233
|
|
|
209
234
|
`NonNullable`\<`Out`\> \| `undefined`
|
|
210
235
|
|
|
236
|
+
The first non-nullish transformed value, or undefined
|
|
237
|
+
|
|
211
238
|
### <a id="findLastAs"></a>findLastAs
|
|
212
239
|
|
|
213
240
|
[**@xylabs/array**](#../README)
|
|
@@ -218,6 +245,8 @@ function findAs<In, Out>(x, predicate): NonNullable<Out> | undefined;
|
|
|
218
245
|
function findLastAs<In, Out>(x, predicate): NonNullable<Out> | undefined;
|
|
219
246
|
```
|
|
220
247
|
|
|
248
|
+
Maps each element using the predicate and returns the last non-nullish result.
|
|
249
|
+
|
|
221
250
|
## Type Parameters
|
|
222
251
|
|
|
223
252
|
### In
|
|
@@ -234,14 +263,20 @@ function findLastAs<In, Out>(x, predicate): NonNullable<Out> | undefined;
|
|
|
234
263
|
|
|
235
264
|
`In`[]
|
|
236
265
|
|
|
266
|
+
The input array
|
|
267
|
+
|
|
237
268
|
### predicate
|
|
238
269
|
|
|
239
270
|
(`a`) => `Out`
|
|
240
271
|
|
|
272
|
+
Transform function applied to each element
|
|
273
|
+
|
|
241
274
|
## Returns
|
|
242
275
|
|
|
243
276
|
`NonNullable`\<`Out`\> \| `undefined`
|
|
244
277
|
|
|
278
|
+
The last non-nullish transformed value, or undefined
|
|
279
|
+
|
|
245
280
|
### <a id="flatten"></a>flatten
|
|
246
281
|
|
|
247
282
|
[**@xylabs/array**](#../README)
|
|
@@ -252,6 +287,8 @@ function findLastAs<In, Out>(x, predicate): NonNullable<Out> | undefined;
|
|
|
252
287
|
function flatten<T>(a?, b?): T[];
|
|
253
288
|
```
|
|
254
289
|
|
|
290
|
+
Concatenates two values or arrays into a single flat array, filtering out nullish entries.
|
|
291
|
+
|
|
255
292
|
## Type Parameters
|
|
256
293
|
|
|
257
294
|
### T
|
|
@@ -262,16 +299,22 @@ function flatten<T>(a?, b?): T[];
|
|
|
262
299
|
|
|
263
300
|
### a?
|
|
264
301
|
|
|
302
|
+
First value or array
|
|
303
|
+
|
|
265
304
|
`T` | `ConcatArray`\<`T`\>
|
|
266
305
|
|
|
267
306
|
### b?
|
|
268
307
|
|
|
308
|
+
Second value or array
|
|
309
|
+
|
|
269
310
|
`T` | `ConcatArray`\<`T`\>
|
|
270
311
|
|
|
271
312
|
## Returns
|
|
272
313
|
|
|
273
314
|
`T`[]
|
|
274
315
|
|
|
316
|
+
A flat array of non-nullish elements
|
|
317
|
+
|
|
275
318
|
### <a id="uniq"></a>uniq
|
|
276
319
|
|
|
277
320
|
[**@xylabs/array**](#../README)
|
|
@@ -282,6 +325,8 @@ function flatten<T>(a?, b?): T[];
|
|
|
282
325
|
function uniq<T>(arr): T[];
|
|
283
326
|
```
|
|
284
327
|
|
|
328
|
+
Returns a new array with duplicate values removed.
|
|
329
|
+
|
|
285
330
|
## Type Parameters
|
|
286
331
|
|
|
287
332
|
### T
|
|
@@ -294,10 +339,14 @@ function uniq<T>(arr): T[];
|
|
|
294
339
|
|
|
295
340
|
`T`[]
|
|
296
341
|
|
|
342
|
+
The input array
|
|
343
|
+
|
|
297
344
|
## Returns
|
|
298
345
|
|
|
299
346
|
`T`[]
|
|
300
347
|
|
|
348
|
+
A deduplicated array
|
|
349
|
+
|
|
301
350
|
### <a id="uniqBy"></a>uniqBy
|
|
302
351
|
|
|
303
352
|
[**@xylabs/array**](#../README)
|
|
@@ -308,6 +357,8 @@ function uniq<T>(arr): T[];
|
|
|
308
357
|
function uniqBy<T, I>(arr, iteratee): T[];
|
|
309
358
|
```
|
|
310
359
|
|
|
360
|
+
Returns a new array with duplicates removed, using a key function for comparison.
|
|
361
|
+
|
|
311
362
|
## Type Parameters
|
|
312
363
|
|
|
313
364
|
### T
|
|
@@ -324,14 +375,20 @@ function uniqBy<T, I>(arr, iteratee): T[];
|
|
|
324
375
|
|
|
325
376
|
`T`[]
|
|
326
377
|
|
|
378
|
+
The input array
|
|
379
|
+
|
|
327
380
|
### iteratee
|
|
328
381
|
|
|
329
382
|
(`item`) => `I`
|
|
330
383
|
|
|
384
|
+
Function that returns the key to compare by
|
|
385
|
+
|
|
331
386
|
## Returns
|
|
332
387
|
|
|
333
388
|
`T`[]
|
|
334
389
|
|
|
390
|
+
A deduplicated array keeping the first occurrence of each key
|
|
391
|
+
|
|
335
392
|
|
|
336
393
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
337
394
|
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether the source array contains every element in the target array.
|
|
3
|
+
* @param source - The array to search within
|
|
4
|
+
* @param target - The elements that must all be present
|
|
5
|
+
* @returns True if every target element exists in source
|
|
6
|
+
*/
|
|
1
7
|
export declare const containsAll: <T>(source: T[], target: T[]) => boolean;
|
|
2
8
|
//# sourceMappingURL=containsAll.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"containsAll.d.ts","sourceRoot":"","sources":["../../src/containsAll.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,YAA0C,CAAA"}
|
|
1
|
+
{"version":3,"file":"containsAll.d.ts","sourceRoot":"","sources":["../../src/containsAll.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAE,YAA0C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distinct.d.ts","sourceRoot":"","sources":["../../src/distinct.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,EAAE,KAAG,OASjE,CAAA"}
|
|
1
|
+
{"version":3,"file":"distinct.d.ts","sourceRoot":"","sources":["../../src/distinct.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,MAAM,EAAE,OAAO,CAAC,EAAE,KAAG,OASjE,CAAA"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each element using the predicate and filters out nullish results.
|
|
3
|
+
* @param x - The input array
|
|
4
|
+
* @param predicate - Transform function applied to each element
|
|
5
|
+
* @returns Array of non-nullish transformed values
|
|
6
|
+
*/
|
|
1
7
|
export declare const filterAs: <In, Out>(x: In[], predicate: (a: In) => Out) => NonNullable<Out>[];
|
|
2
8
|
//# sourceMappingURL=filterAs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterAs.d.ts","sourceRoot":"","sources":["../../src/filterAs.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,GAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,uBAEnE,CAAA"}
|
|
1
|
+
{"version":3,"file":"filterAs.d.ts","sourceRoot":"","sources":["../../src/filterAs.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,uBAEnE,CAAA"}
|
package/dist/neutral/findAs.d.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each element using the predicate and returns the first non-nullish result.
|
|
3
|
+
* @param x - The input array
|
|
4
|
+
* @param predicate - Transform function applied to each element
|
|
5
|
+
* @returns The first non-nullish transformed value, or undefined
|
|
6
|
+
*/
|
|
1
7
|
export declare const findAs: <In, Out>(x: In[], predicate: (a: In) => Out) => NonNullable<Out> | undefined;
|
|
8
|
+
/**
|
|
9
|
+
* Maps each element using the predicate and returns the last non-nullish result.
|
|
10
|
+
* @param x - The input array
|
|
11
|
+
* @param predicate - Transform function applied to each element
|
|
12
|
+
* @returns The last non-nullish transformed value, or undefined
|
|
13
|
+
*/
|
|
2
14
|
export declare const findLastAs: <In, Out>(x: In[], predicate: (a: In) => Out) => NonNullable<Out> | undefined;
|
|
3
15
|
//# sourceMappingURL=findAs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findAs.d.ts","sourceRoot":"","sources":["../../src/findAs.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,GAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,iCAEjE,CAAA;AAED,eAAO,MAAM,UAAU,GAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,iCAErE,CAAA"}
|
|
1
|
+
{"version":3,"file":"findAs.d.ts","sourceRoot":"","sources":["../../src/findAs.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,iCAEjE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,KAAK,GAAG,iCAErE,CAAA"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concatenates two values or arrays into a single flat array, filtering out nullish entries.
|
|
3
|
+
* @param a - First value or array
|
|
4
|
+
* @param b - Second value or array
|
|
5
|
+
* @returns A flat array of non-nullish elements
|
|
6
|
+
*/
|
|
1
7
|
export declare const flatten: <T>(a?: T | ConcatArray<T>, b?: T | ConcatArray<T>) => T[];
|
|
2
8
|
//# sourceMappingURL=flatten.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../src/flatten.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAG,CAAC,EAG5E,CAAA"}
|
|
1
|
+
{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../src/flatten.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAG,CAAC,EAG5E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/containsAll.ts","../../src/distinct.ts","../../src/filterAs.ts","../../src/filterAsync.ts","../../src/findAs.ts","../../src/flatten.ts","../../src/uniq.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/containsAll.ts","../../src/distinct.ts","../../src/filterAs.ts","../../src/filterAsync.ts","../../src/findAs.ts","../../src/flatten.ts","../../src/uniq.ts"],"sourcesContent":["/**\n * Checks whether the source array contains every element in the target array.\n * @param source - The array to search within\n * @param target - The elements that must all be present\n * @returns True if every target element exists in source\n */\nexport const containsAll = <T>(source: T[], target: T[]) => target.every(i => source.includes(i))\n","/**\n * Array filter callback that removes duplicate values, with correct NaN handling.\n * Use with `array.filter(distinct)`.\n */\nexport const distinct = <T>(value: T, index: number, array: T[]): boolean => {\n // Special case for NaN\n if (Number.isNaN(value)) {\n // Return true for the first NaN only\n return array.findIndex(item => Number.isNaN(item)) === index\n }\n\n // Standard distinct logic for other values\n return array.indexOf(value) === index\n}\n","import { exists } from '@xylabs/exists'\n\n/**\n * Maps each element using the predicate and filters out nullish results.\n * @param x - The input array\n * @param predicate - Transform function applied to each element\n * @returns Array of non-nullish transformed values\n */\nexport const filterAs = <In, Out>(x: In[], predicate: (a: In) => Out) => {\n return x.map(predicate).filter(exists)\n}\n","/**\n * Returns the elements of an array that meet the condition specified in a callback function.\n * @param array The array to filter.\n * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.\n * @returns The elements of an array that meet the condition specified in a callback function.\n */\nexport const filterAsync = async <T>(\n array: T[],\n predicate: (value: T, index: number, array: T[]) => Promise<boolean>,\n): Promise<T[]> => {\n const results = await Promise.all(array.map(predicate))\n return array.filter((_, index) => results[index])\n}\n","import { exists } from '@xylabs/exists'\n\n/**\n * Maps each element using the predicate and returns the first non-nullish result.\n * @param x - The input array\n * @param predicate - Transform function applied to each element\n * @returns The first non-nullish transformed value, or undefined\n */\nexport const findAs = <In, Out>(x: In[], predicate: (a: In) => Out) => {\n return x.map(predicate).find(exists)\n}\n\n/**\n * Maps each element using the predicate and returns the last non-nullish result.\n * @param x - The input array\n * @param predicate - Transform function applied to each element\n * @returns The last non-nullish transformed value, or undefined\n */\nexport const findLastAs = <In, Out>(x: In[], predicate: (a: In) => Out) => {\n return x.map(predicate).findLast(exists)\n}\n","import { exists } from '@xylabs/exists'\n\n/**\n * Concatenates two values or arrays into a single flat array, filtering out nullish entries.\n * @param a - First value or array\n * @param b - Second value or array\n * @returns A flat array of non-nullish elements\n */\nexport const flatten = <T>(a?: T | ConcatArray<T>, b?: T | ConcatArray<T>): T[] => {\n // eslint-disable-next-line unicorn/prefer-spread\n return ([] as (T | undefined)[]).concat(a).concat(b).filter(exists)\n}\n","/**\n * Returns a new array with duplicate values removed.\n * @param arr - The input array\n * @returns A deduplicated array\n */\nexport const uniq = <T>(arr: T[]): T[] => {\n return [...new Set(arr)]\n}\n\n/**\n * Returns a new array with duplicates removed, using a key function for comparison.\n * @param arr - The input array\n * @param iteratee - Function that returns the key to compare by\n * @returns A deduplicated array keeping the first occurrence of each key\n */\nexport const uniqBy = <T, I>(arr: T[], iteratee: (item: T) => I): T[] => {\n const seen = new Set()\n return arr.filter((item) => {\n const key = iteratee(item)\n if (!seen.has(key)) {\n seen.add(key)\n return true\n }\n return false\n })\n}\n"],"mappings":";AAMO,IAAM,cAAc,CAAI,QAAa,WAAgB,OAAO,MAAM,OAAK,OAAO,SAAS,CAAC,CAAC;;;ACFzF,IAAM,WAAW,CAAI,OAAU,OAAe,UAAwB;AAE3E,MAAI,OAAO,MAAM,KAAK,GAAG;AAEvB,WAAO,MAAM,UAAU,UAAQ,OAAO,MAAM,IAAI,CAAC,MAAM;AAAA,EACzD;AAGA,SAAO,MAAM,QAAQ,KAAK,MAAM;AAClC;;;ACbA,SAAS,cAAc;AAQhB,IAAM,WAAW,CAAU,GAAS,cAA8B;AACvE,SAAO,EAAE,IAAI,SAAS,EAAE,OAAO,MAAM;AACvC;;;ACJO,IAAM,cAAc,OACzB,OACA,cACiB;AACjB,QAAM,UAAU,MAAM,QAAQ,IAAI,MAAM,IAAI,SAAS,CAAC;AACtD,SAAO,MAAM,OAAO,CAAC,GAAG,UAAU,QAAQ,KAAK,CAAC;AAClD;;;ACZA,SAAS,UAAAA,eAAc;AAQhB,IAAM,SAAS,CAAU,GAAS,cAA8B;AACrE,SAAO,EAAE,IAAI,SAAS,EAAE,KAAKA,OAAM;AACrC;AAQO,IAAM,aAAa,CAAU,GAAS,cAA8B;AACzE,SAAO,EAAE,IAAI,SAAS,EAAE,SAASA,OAAM;AACzC;;;ACpBA,SAAS,UAAAC,eAAc;AAQhB,IAAM,UAAU,CAAI,GAAwB,MAAgC;AAEjF,SAAQ,CAAC,EAAwB,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,OAAOA,OAAM;AACpE;;;ACNO,IAAM,OAAO,CAAI,QAAkB;AACxC,SAAO,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC;AACzB;AAQO,IAAM,SAAS,CAAO,KAAU,aAAkC;AACvE,QAAM,OAAO,oBAAI,IAAI;AACrB,SAAO,IAAI,OAAO,CAAC,SAAS;AAC1B,UAAM,MAAM,SAAS,IAAI;AACzB,QAAI,CAAC,KAAK,IAAI,GAAG,GAAG;AAClB,WAAK,IAAI,GAAG;AACZ,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,CAAC;AACH;","names":["exists","exists"]}
|
package/dist/neutral/uniq.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new array with duplicate values removed.
|
|
3
|
+
* @param arr - The input array
|
|
4
|
+
* @returns A deduplicated array
|
|
5
|
+
*/
|
|
1
6
|
export declare const uniq: <T>(arr: T[]) => T[];
|
|
7
|
+
/**
|
|
8
|
+
* Returns a new array with duplicates removed, using a key function for comparison.
|
|
9
|
+
* @param arr - The input array
|
|
10
|
+
* @param iteratee - Function that returns the key to compare by
|
|
11
|
+
* @returns A deduplicated array keeping the first occurrence of each key
|
|
12
|
+
*/
|
|
2
13
|
export declare const uniqBy: <T, I>(arr: T[], iteratee: (item: T) => I) => T[];
|
|
3
14
|
//# sourceMappingURL=uniq.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/uniq.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,KAAK,CAAC,EAAE,KAAG,CAAC,EAEnC,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAG,CAAC,EAUlE,CAAA"}
|
|
1
|
+
{"version":3,"file":"uniq.d.ts","sourceRoot":"","sources":["../../src/uniq.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,KAAK,CAAC,EAAE,KAAG,CAAC,EAEnC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAG,CAAC,EAUlE,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/array",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.84",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"!**/*.test.*"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@xylabs/exists": "~5.0.
|
|
45
|
-
"@xylabs/vitest-extended": "~5.0.82"
|
|
44
|
+
"@xylabs/exists": "~5.0.84"
|
|
46
45
|
},
|
|
47
46
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
49
|
-
"@xylabs/tsconfig": "~7.4.
|
|
47
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.13",
|
|
48
|
+
"@xylabs/tsconfig": "~7.4.13",
|
|
49
|
+
"@xylabs/vitest-extended": "~5.0.84",
|
|
50
50
|
"typescript": "~5.9.3",
|
|
51
51
|
"vitest": "~4.0.18"
|
|
52
52
|
},
|