@xylabs/array 4.13.20 → 4.13.21
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 +316 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -12,13 +12,326 @@
|
|
|
12
12
|
[![snyk-badge][]][snyk-link]
|
|
13
13
|
[![socket-badge][]][socket-link]
|
|
14
14
|
|
|
15
|
-
Version: 4.13.19
|
|
16
15
|
|
|
17
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
18
17
|
|
|
19
|
-
## Documentation
|
|
18
|
+
## API Documentation
|
|
19
|
+
|
|
20
|
+
**@xylabs/array**
|
|
21
|
+
|
|
22
|
+
***
|
|
23
|
+
|
|
24
|
+
## Functions
|
|
25
|
+
|
|
26
|
+
- [containsAll](#functions/containsAll)
|
|
27
|
+
- [distinct](#functions/distinct)
|
|
28
|
+
- [filterAs](#functions/filterAs)
|
|
29
|
+
- [filterAsync](#functions/filterAsync)
|
|
30
|
+
- [findAs](#functions/findAs)
|
|
31
|
+
- [findLastAs](#functions/findLastAs)
|
|
32
|
+
- [flatten](#functions/flatten)
|
|
33
|
+
- [uniq](#functions/uniq)
|
|
34
|
+
- [uniqBy](#functions/uniqBy)
|
|
35
|
+
|
|
36
|
+
### functions
|
|
37
|
+
|
|
38
|
+
### <a id="containsAll"></a>containsAll
|
|
39
|
+
|
|
40
|
+
[**@xylabs/array**](#../README)
|
|
41
|
+
|
|
42
|
+
***
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
function containsAll<T>(source, target): boolean;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Type Parameters
|
|
49
|
+
|
|
50
|
+
### T
|
|
51
|
+
|
|
52
|
+
`T`
|
|
53
|
+
|
|
54
|
+
## Parameters
|
|
55
|
+
|
|
56
|
+
### source
|
|
57
|
+
|
|
58
|
+
`T`[]
|
|
59
|
+
|
|
60
|
+
### target
|
|
61
|
+
|
|
62
|
+
`T`[]
|
|
63
|
+
|
|
64
|
+
## Returns
|
|
65
|
+
|
|
66
|
+
`boolean`
|
|
67
|
+
|
|
68
|
+
### <a id="distinct"></a>distinct
|
|
69
|
+
|
|
70
|
+
[**@xylabs/array**](#../README)
|
|
71
|
+
|
|
72
|
+
***
|
|
73
|
+
|
|
74
|
+
```ts
|
|
75
|
+
function distinct<T>(
|
|
76
|
+
value,
|
|
77
|
+
index,
|
|
78
|
+
array): boolean;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Type Parameters
|
|
82
|
+
|
|
83
|
+
### T
|
|
84
|
+
|
|
85
|
+
`T`
|
|
86
|
+
|
|
87
|
+
## Parameters
|
|
88
|
+
|
|
89
|
+
### value
|
|
90
|
+
|
|
91
|
+
`T`
|
|
92
|
+
|
|
93
|
+
### index
|
|
94
|
+
|
|
95
|
+
`number`
|
|
96
|
+
|
|
97
|
+
### array
|
|
98
|
+
|
|
99
|
+
`T`[]
|
|
100
|
+
|
|
101
|
+
## Returns
|
|
102
|
+
|
|
103
|
+
`boolean`
|
|
104
|
+
|
|
105
|
+
### <a id="filterAs"></a>filterAs
|
|
106
|
+
|
|
107
|
+
[**@xylabs/array**](#../README)
|
|
108
|
+
|
|
109
|
+
***
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
function filterAs<In, Out>(x, predicate): NonNullable<Out>[];
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Type Parameters
|
|
116
|
+
|
|
117
|
+
### In
|
|
118
|
+
|
|
119
|
+
`In`
|
|
120
|
+
|
|
121
|
+
### Out
|
|
122
|
+
|
|
123
|
+
`Out`
|
|
124
|
+
|
|
125
|
+
## Parameters
|
|
126
|
+
|
|
127
|
+
### x
|
|
128
|
+
|
|
129
|
+
`In`[]
|
|
130
|
+
|
|
131
|
+
### predicate
|
|
132
|
+
|
|
133
|
+
(`a`) => `Out`
|
|
134
|
+
|
|
135
|
+
## Returns
|
|
136
|
+
|
|
137
|
+
`NonNullable`\<`Out`\>[]
|
|
138
|
+
|
|
139
|
+
### <a id="filterAsync"></a>filterAsync
|
|
140
|
+
|
|
141
|
+
[**@xylabs/array**](#../README)
|
|
142
|
+
|
|
143
|
+
***
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
function filterAsync<T>(array, predicate): Promise<T[]>;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Returns the elements of an array that meet the condition specified in a callback function.
|
|
150
|
+
|
|
151
|
+
## Type Parameters
|
|
152
|
+
|
|
153
|
+
### T
|
|
154
|
+
|
|
155
|
+
`T`
|
|
156
|
+
|
|
157
|
+
## Parameters
|
|
158
|
+
|
|
159
|
+
### array
|
|
160
|
+
|
|
161
|
+
`T`[]
|
|
162
|
+
|
|
163
|
+
The array to filter.
|
|
164
|
+
|
|
165
|
+
### predicate
|
|
166
|
+
|
|
167
|
+
(`value`, `index`, `array`) => `Promise`\<`boolean`\>
|
|
168
|
+
|
|
169
|
+
A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
|
|
170
|
+
|
|
171
|
+
## Returns
|
|
172
|
+
|
|
173
|
+
`Promise`\<`T`[]\>
|
|
174
|
+
|
|
175
|
+
The elements of an array that meet the condition specified in a callback function.
|
|
176
|
+
|
|
177
|
+
### <a id="findAs"></a>findAs
|
|
178
|
+
|
|
179
|
+
[**@xylabs/array**](#../README)
|
|
180
|
+
|
|
181
|
+
***
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
function findAs<In, Out>(x, predicate): undefined | NonNullable<Out>;
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Type Parameters
|
|
188
|
+
|
|
189
|
+
### In
|
|
190
|
+
|
|
191
|
+
`In`
|
|
192
|
+
|
|
193
|
+
### Out
|
|
194
|
+
|
|
195
|
+
`Out`
|
|
196
|
+
|
|
197
|
+
## Parameters
|
|
198
|
+
|
|
199
|
+
### x
|
|
200
|
+
|
|
201
|
+
`In`[]
|
|
202
|
+
|
|
203
|
+
### predicate
|
|
204
|
+
|
|
205
|
+
(`a`) => `Out`
|
|
206
|
+
|
|
207
|
+
## Returns
|
|
208
|
+
|
|
209
|
+
`undefined` \| `NonNullable`\<`Out`\>
|
|
210
|
+
|
|
211
|
+
### <a id="findLastAs"></a>findLastAs
|
|
212
|
+
|
|
213
|
+
[**@xylabs/array**](#../README)
|
|
214
|
+
|
|
215
|
+
***
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
function findLastAs<In, Out>(x, predicate): undefined | NonNullable<Out>;
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Type Parameters
|
|
222
|
+
|
|
223
|
+
### In
|
|
224
|
+
|
|
225
|
+
`In`
|
|
226
|
+
|
|
227
|
+
### Out
|
|
228
|
+
|
|
229
|
+
`Out`
|
|
230
|
+
|
|
231
|
+
## Parameters
|
|
232
|
+
|
|
233
|
+
### x
|
|
234
|
+
|
|
235
|
+
`In`[]
|
|
236
|
+
|
|
237
|
+
### predicate
|
|
238
|
+
|
|
239
|
+
(`a`) => `Out`
|
|
240
|
+
|
|
241
|
+
## Returns
|
|
242
|
+
|
|
243
|
+
`undefined` \| `NonNullable`\<`Out`\>
|
|
244
|
+
|
|
245
|
+
### <a id="flatten"></a>flatten
|
|
246
|
+
|
|
247
|
+
[**@xylabs/array**](#../README)
|
|
248
|
+
|
|
249
|
+
***
|
|
250
|
+
|
|
251
|
+
```ts
|
|
252
|
+
function flatten<T>(a?, b?): T[];
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Type Parameters
|
|
256
|
+
|
|
257
|
+
### T
|
|
258
|
+
|
|
259
|
+
`T`
|
|
260
|
+
|
|
261
|
+
## Parameters
|
|
262
|
+
|
|
263
|
+
### a?
|
|
264
|
+
|
|
265
|
+
`T` | `ConcatArray`\<`T`\>
|
|
266
|
+
|
|
267
|
+
### b?
|
|
268
|
+
|
|
269
|
+
`T` | `ConcatArray`\<`T`\>
|
|
270
|
+
|
|
271
|
+
## Returns
|
|
272
|
+
|
|
273
|
+
`T`[]
|
|
274
|
+
|
|
275
|
+
### <a id="uniq"></a>uniq
|
|
276
|
+
|
|
277
|
+
[**@xylabs/array**](#../README)
|
|
278
|
+
|
|
279
|
+
***
|
|
280
|
+
|
|
281
|
+
```ts
|
|
282
|
+
function uniq<T>(arr): T[];
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Type Parameters
|
|
286
|
+
|
|
287
|
+
### T
|
|
288
|
+
|
|
289
|
+
`T`
|
|
290
|
+
|
|
291
|
+
## Parameters
|
|
292
|
+
|
|
293
|
+
### arr
|
|
294
|
+
|
|
295
|
+
`T`[]
|
|
296
|
+
|
|
297
|
+
## Returns
|
|
298
|
+
|
|
299
|
+
`T`[]
|
|
300
|
+
|
|
301
|
+
### <a id="uniqBy"></a>uniqBy
|
|
302
|
+
|
|
303
|
+
[**@xylabs/array**](#../README)
|
|
304
|
+
|
|
305
|
+
***
|
|
306
|
+
|
|
307
|
+
```ts
|
|
308
|
+
function uniqBy<T, I>(arr, iteratee): T[];
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
## Type Parameters
|
|
312
|
+
|
|
313
|
+
### T
|
|
314
|
+
|
|
315
|
+
`T`
|
|
316
|
+
|
|
317
|
+
### I
|
|
318
|
+
|
|
319
|
+
`I`
|
|
320
|
+
|
|
321
|
+
## Parameters
|
|
322
|
+
|
|
323
|
+
### arr
|
|
324
|
+
|
|
325
|
+
`T`[]
|
|
326
|
+
|
|
327
|
+
### iteratee
|
|
328
|
+
|
|
329
|
+
(`item`) => `I`
|
|
330
|
+
|
|
331
|
+
## Returns
|
|
332
|
+
|
|
333
|
+
`T`[]
|
|
20
334
|
|
|
21
|
-
Coming Soon!
|
|
22
335
|
|
|
23
336
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
24
337
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/array",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.21",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"src"
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@xylabs/exists": "^4.13.
|
|
44
|
+
"@xylabs/exists": "^4.13.21"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@xylabs/ts-scripts-yarn3": "^7.0.0",
|
|
48
48
|
"@xylabs/tsconfig": "^7.0.0",
|
|
49
|
-
"@xylabs/vitest-extended": "^4.13.
|
|
49
|
+
"@xylabs/vitest-extended": "^4.13.21",
|
|
50
50
|
"typescript": "^5.8.3",
|
|
51
51
|
"vitest": "^3.2.4"
|
|
52
52
|
},
|