atomic-fns 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +5 -3
  2. package/package.json +6 -7
  3. package/src/collections/index.d.ts +658 -0
  4. package/src/collections/index.js +1068 -0
  5. package/src/collections/index.ts +1162 -0
  6. package/src/datetime/index.d.ts +6 -0
  7. package/src/datetime/index.js +6 -0
  8. package/src/datetime/index.ts +7 -0
  9. package/src/{functools.d.ts → functools/index.d.ts} +8 -7
  10. package/src/functools/index.js +84 -0
  11. package/src/{functools.ts → functools/index.ts} +9 -7
  12. package/src/globals/index.d.ts +291 -0
  13. package/src/globals/index.js +391 -0
  14. package/src/globals/index.ts +456 -0
  15. package/src/index.d.ts +8 -7
  16. package/src/index.js +8 -7
  17. package/src/index.ts +8 -7
  18. package/src/itertools/index.d.ts +254 -0
  19. package/src/itertools/index.js +485 -0
  20. package/src/itertools/index.ts +511 -0
  21. package/src/math/index.d.ts +21 -0
  22. package/src/math/index.js +39 -0
  23. package/src/math/index.ts +44 -0
  24. package/src/{operators.d.ts → operators/index.d.ts} +8 -6
  25. package/src/operators/index.js +171 -0
  26. package/src/{operators.ts → operators/index.ts} +75 -30
  27. package/src/random/index.d.ts +42 -0
  28. package/src/random/index.js +65 -0
  29. package/src/random/index.ts +66 -0
  30. package/tests/collections.spec.ts +42 -25
  31. package/tests/globals.spec.ts +51 -47
  32. package/tests/itertools.spec.ts +190 -4
  33. package/tests/operators.spec.ts +1 -26
  34. package/tests/random.spec.ts +46 -0
  35. package/tsconfig.json +12 -4
  36. package/src/collections.d.ts +0 -228
  37. package/src/collections.js +0 -553
  38. package/src/collections.ts +0 -641
  39. package/src/datetime.d.ts +0 -5
  40. package/src/datetime.js +0 -5
  41. package/src/datetime.ts +0 -6
  42. package/src/functools.js +0 -78
  43. package/src/globals.d.ts +0 -179
  44. package/src/globals.js +0 -309
  45. package/src/globals.ts +0 -377
  46. package/src/itertools.d.ts +0 -20
  47. package/src/itertools.js +0 -98
  48. package/src/itertools.ts +0 -116
  49. package/src/math.d.ts +0 -16
  50. package/src/math.js +0 -70
  51. package/src/math.ts +0 -77
  52. package/src/objects.d.ts +0 -0
  53. package/src/objects.js +0 -1
  54. package/src/objects.ts +0 -0
  55. package/src/operators.js +0 -109
  56. package/src/random.d.ts +0 -22
  57. package/src/random.js +0 -48
  58. package/src/random.ts +0 -53
  59. package/src/strings.d.ts +0 -0
  60. package/src/strings.js +0 -1
  61. package/src/strings.ts +0 -0
  62. package/src/util.d.ts +0 -0
  63. package/src/util.js +0 -1
  64. package/src/util.ts +0 -0
@@ -0,0 +1,658 @@
1
+ /**
2
+ * This module includes classes and functions to work with Container types.
3
+ *
4
+ * @module Collections
5
+ */
6
+ import { Iteratee } from '../globals/index.js';
7
+ /**
8
+ * A container type that provides contains().
9
+ *
10
+ *
11
+ * @interface Container
12
+ */
13
+ export interface Container {
14
+ contains: (x: any) => boolean;
15
+ }
16
+ /**
17
+ * These are the "rich comparison" methods, inspired by Python operators.
18
+ *
19
+ *
20
+ * @interface Comparable
21
+ */
22
+ export interface Comparable {
23
+ /** x < y: calls this.lt(other) reflection. */
24
+ lt?: (other: any) => boolean;
25
+ /** x ≤ y: calls this.le(other) reflection. */
26
+ le?: (other: any) => boolean;
27
+ /** x == y: calls this.eq(other) reflection. */
28
+ eq: (other: any) => boolean;
29
+ /** x != y: calls this.ne(other) reflection. */
30
+ ne: (other: any) => boolean;
31
+ /** x > y: calls this.gt(other) reflection. */
32
+ gt?: (other: any) => boolean;
33
+ /** x ≥ y: calls this.ge(other) reflection. */
34
+ ge?: (other: any) => boolean;
35
+ }
36
+ /**
37
+ * A `Collection` is an iterable {@link Container} type.
38
+ * This is an abstract base class for user-defined collection types.
39
+ *
40
+ *
41
+ * @abstract
42
+ * @class Collection
43
+ * @implements {Container}
44
+ */
45
+ export declare abstract class Collection implements Container {
46
+ /**
47
+ * Returns an iterator for the container items
48
+ * @return {Iterator}
49
+ */
50
+ [Symbol.iterator](): this;
51
+ /**
52
+ * Implements the iterator protocol and returns the next item in the iterable.
53
+ */
54
+ next(): void;
55
+ /**
56
+ * Adds a new item to the container.
57
+ * @param item - The item to add to the collection.
58
+ */
59
+ add(item: any): void;
60
+ /**
61
+ * Checks if item is present in the container.
62
+ * @param item - The item to search for in the collection.
63
+ * @returns `true` when the element is found, else `false`
64
+ */
65
+ contains(item: any): boolean;
66
+ /**
67
+ * Returns the total number of elements in the container.
68
+ */
69
+ size(): number;
70
+ /**
71
+ * Remove the first item from the container where `item == x`
72
+ * @returns `true` when the element is found and removed, else `false`
73
+ */
74
+ remove(x: any): boolean;
75
+ /**
76
+ * Retrieve and remove the item at index `i`.
77
+ * @returns the item or undefined if not found.
78
+ */
79
+ pop(i: any): void;
80
+ /**
81
+ * Remove all items from the container
82
+ */
83
+ clear(): void;
84
+ }
85
+ /**
86
+ * Implements an iterable that allows backward iteration.
87
+ * @interface Reversible
88
+ */
89
+ export interface Reversible<T = unknown> {
90
+ reversed: () => Iterator<T>;
91
+ }
92
+ /**
93
+ * A sequence is an iterable {@link Collection} type with efficient index-based access.
94
+ * @abstract
95
+ * @class Sequence
96
+ * @extends {Collection}
97
+ * @template T
98
+ */
99
+ export declare abstract class Sequence<T> extends Collection implements Reversible<T> {
100
+ /**
101
+ * Return the item at the given key or index
102
+ * @param {*} key
103
+ * @memberof Sequence
104
+ */
105
+ get(key: any): T | undefined;
106
+ /**
107
+ * Set a new value at the given key or index
108
+ *
109
+ * @param {*} key
110
+ * @param {T} val
111
+ * @memberof Sequence
112
+ */
113
+ set(key: any, val: T): void;
114
+ /**
115
+ * Deletes the given key or index, and its value.
116
+ * Raises ValueError if not key is found.
117
+ *
118
+ * @param {*} key
119
+ * @memberof Sequence
120
+ */
121
+ delete(key: any): void;
122
+ /**
123
+ * Adds a new item to the end of the sequence.
124
+ *
125
+ * @param {T} x
126
+ * @memberof Sequence
127
+ */
128
+ append(x: T): void;
129
+ /**
130
+ * Append all the items to the sequence.
131
+ *
132
+ * @param {Iterable<T>} iter
133
+ * @memberof Sequence
134
+ */
135
+ extend(iter: Iterable<T>): void;
136
+ /**
137
+ * Return the index of x in the sequence, or undefined if not found.
138
+ *
139
+ * @param {T} item
140
+ * @return {(number | undefined)}
141
+ * @memberof Sequence
142
+ */
143
+ indexOf(item: T): number | undefined;
144
+ size(): number;
145
+ reversed(): Iterator<T>;
146
+ }
147
+ /**
148
+ * Returns a new immutable Set object with elements from `iterable`. Its contents cannot be altered after it's created.
149
+ *
150
+ *
151
+ * @class FrozenSet
152
+ * @extends {Set<T>}
153
+ * @template T
154
+ */
155
+ export declare class FrozenSet<T = any> extends Set<T> {
156
+ constructor(iterable: Iterable<T>);
157
+ /** @private */
158
+ add(): this;
159
+ /** @private */
160
+ delete(): boolean;
161
+ /** @private */
162
+ clear(): this;
163
+ /** @private */
164
+ freeze(): Readonly<this>;
165
+ }
166
+ /**
167
+ * Creates a new array with all `falsey` and empty values removed.
168
+ * @param arr The array to compact
169
+ * @returns A new array with the filtered values.
170
+ * @example
171
+ ```js
172
+ compact([0, 1, false, 2, '', 3])
173
+ // => [1, 2, 3]
174
+ ```
175
+ */
176
+ export declare function compact(arr: any[]): any;
177
+ export declare function compact(arr: Object): any;
178
+ export declare function count<T>(iterable: Iterable<T> | Object, func: Iteratee<T>): {};
179
+ /**
180
+ * Creates a function that can be used to create named tuple-like objects.
181
+ * @example
182
+ ```js
183
+ * let Point = namedtuple('x', 'y', 'z')
184
+ * let userObj = User(0, 0, 0)
185
+ * // => {x: 0, y: 0, z: 0}
186
+ ```
187
+ * @param fields - A list of field names
188
+ * @returns A function that can be called with the field values
189
+ */
190
+ export declare function namedtuple(...fields: string[]): (...args: any[]) => {};
191
+ /**
192
+ * Iterates over elements of collection, returning an array of all elements where predicate returns truthy value.
193
+ *
194
+ * The predicate is invoked with three arguments: `(value, index|key, arr)`.
195
+ *
196
+ * @example
197
+ ```js
198
+ * let users = [
199
+ { 'user': 'barney', 'age': 36, 'active': true },
200
+ { 'user': 'fred', 'age': 40, 'active': false }
201
+ ]
202
+
203
+ filter(users, o => !o.active)
204
+ // => objects for ['fred']
205
+
206
+ // The shape iteratee shorthand.
207
+ filter(users, { age: 36, active: true })
208
+ // => objects for ['barney']
209
+
210
+ // The property iteratee shorthand.
211
+ filter(users, 'active')
212
+ // => objects for ['barney']
213
+ ```
214
+ * @param {Array} arr The collection to iterate over
215
+ * @param {Function} fn The predicate function invoked for each item
216
+ * @returns {Array} The new filtered array
217
+ */
218
+ export declare function filter(arr: any, fn?: Iteratee | PropertyKey | Object): any[] | undefined;
219
+ /**
220
+ * Iterates over elements of collection, returning the first element where predicate returns truthy value. The predicate is invoked with three arguments: `(value, index|key, collection)`.
221
+ * @example
222
+ ```js
223
+ let users = [
224
+ { 'user': 'barney', 'age': 36, 'active': true },
225
+ { 'user': 'fred', 'age': 40, 'active': false },
226
+ { 'user': 'pebbles', 'age': 1, 'active': true }
227
+ ]
228
+
229
+ find(users, (o) => o.age < 40)
230
+ // => object for 'barney'
231
+
232
+ // The shape iteratee shorthand.
233
+ find(users, { 'age': 1, 'active': true })
234
+ // => object for 'pebbles'
235
+
236
+ // The `property` iteratee shorthand.
237
+ find(users, 'active')
238
+ // => object for 'barney'
239
+ ```
240
+ * @param {Array} arr The collection to iterate over.
241
+ * @param {Function} fn The function invoked per iteration.
242
+ * @returns {*} The matched element, else `undefined`.
243
+ * @see {@link findRight}
244
+ */
245
+ export declare function find(arr: any, fn: Iteratee | PropertyKey | Object): any;
246
+ /**
247
+ * This method is like {@link find} except that it iterates from right to left.
248
+ * @example
249
+ ```js
250
+ findRight([1, 2, 3, 4], (n) => n % 2 === 1)
251
+ // => 3
252
+ ```
253
+ * @param {Array} arr The collection to iterate over.
254
+ * @param {Function} fn The function invoked per iteration.
255
+ * @returns {*} The matched element, else `undefined`.
256
+ * @see {@link find}
257
+ */
258
+ export declare function findRight(arr: any, fn: Iteratee | PropertyKey | Object): any;
259
+ /**
260
+ * Creates a function that performs a partial deep comparison between a given object and `shape`, returning `true` if the given object has equivalent property values, else `false`.
261
+ * @example
262
+ ```js
263
+ let objects = [
264
+ { a: 1, b: 2, c: 3 },
265
+ { a: 4, b: 5, c: 6 }
266
+ ]
267
+
268
+ filter(objects, matches({ a: 4, c: 6 }))
269
+ // => [{ a: 4, b: 5, c: 6 }]
270
+ ```
271
+ * @param shape
272
+ * @returns
273
+ */
274
+ export declare const matches: (shape: any) => (obj: any) => boolean;
275
+ /**
276
+ * Iterates over elements of collection and invokes `iteratee` for each element. The iteratee is invoked with three arguments: `(value, index|key, collection)`. Iteratee functions may exit iteration early by explicitly returning `false`.
277
+ * @example
278
+ ```js
279
+ forEach([1, 2], (value) => {
280
+ console.log(value)
281
+ })
282
+ // => Logs `1` then `2`.
283
+
284
+ forEach({ 'a': 1, 'b': 2 }, (value, key) => {
285
+ console.log(key)
286
+ })
287
+ // => Logs 'a' then 'b' (iteration order is not guaranteed).
288
+ ```
289
+ * @param {Array|Object} collection The collection to iterate over.
290
+ * @param {Iteratee} fn The function invoked per iteration.
291
+ * @returns {*} Returns `collection`.
292
+ * @see {@link forEachRight}
293
+ * @see {@link filter}
294
+ * @see {@link map}
295
+ */
296
+ export declare function forEach<T>(collection: T[], fn: Iteratee<T>): any;
297
+ export declare function forEach<T>(collection: Iterable<T>, fn: Iteratee<T>): any;
298
+ export declare function forEach<T>(collection: Object, fn: Iteratee<T>): any;
299
+ /**
300
+ * This method is like {@link forEach} except that it iterates over the collection from right to left.
301
+
302
+ * @example
303
+ ```js
304
+ forEachRight([1, 2], (value) => {
305
+ console.log(value)
306
+ })
307
+ // => Logs `2` then `1`.
308
+ ```
309
+ * @param {Array|Object} collection The collection to iterate over.
310
+ * @param {Iteratee} fn The function invoked per iteration.
311
+ * @returns {*} Returns `collection`.
312
+ * @see {@link forEach}
313
+ * @see {@link filter}
314
+ * @see {@link map}
315
+ */
316
+ export declare function forEachRight(collection: any[] | Object, fn: Iteratee): Object;
317
+ /**
318
+ * Flattens an array or object. Arrays will be flattened recursively up to `depth` times. Objects will be flattened recursively.
319
+ * @example
320
+ ```js
321
+ flatten([1, [2, [3, [4]], 5]])
322
+ // => [1, 2, [3, [4]], 5]
323
+
324
+ flatten({
325
+ dates: {
326
+ expiry_date: '30 sep 2018',
327
+ available: '30 sep 2017',
328
+ min_contract_period: [
329
+ {
330
+ id: 1,
331
+ name: '1 month'
332
+ }
333
+ ]
334
+ },
335
+ price: {
336
+ currency: 'RM',
337
+ value: 1500
338
+ }
339
+ })
340
+ // => {
341
+ 'dates.expiry_date': '30 sep 2018',
342
+ 'dates.available': '30 sep 2017',
343
+ 'dates.min_contract_period[0].id': 1,
344
+ 'dates.min_contract_period[0].name': '1 month',
345
+ 'price.currency': 'RM',
346
+ 'price.value': 1500
347
+ }
348
+ ```
349
+ * @param {Array|Object} arr The array or object to flatten.
350
+ * @param {number} [depth=1] The max recursion depth.
351
+ * @returns {*} The new flattened array or object.
352
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat Array.flat()}
353
+ */
354
+ export declare function flatten(arr: any[] | Object, depth?: boolean | number): Object;
355
+ /**
356
+ * Creates an array of values by running each element in collection thru iteratee. The iteratee is invoked with three arguments: `(value, index|key, collection)`.
357
+ * @example
358
+ ```js
359
+ function square(n) {
360
+ return n * n
361
+ }
362
+
363
+ map([4, 8], square)
364
+ // => [16, 64]
365
+
366
+ map({ a: 4, b: 8 }, square)
367
+ // => [16, 64] (iteration order is not guaranteed)
368
+
369
+ let users = [
370
+ { user: 'barney' },
371
+ { user: 'fred' }
372
+ ]
373
+
374
+ // The `property` iteratee shorthand.
375
+ map(users, 'user')
376
+ // => ['barney', 'fred']
377
+ ```
378
+ * @param {Array|Object} arr The collection to iterate over.
379
+ * @param {Iteratee|PropertyKey} fn The function invoked per iteration.
380
+ * @returns Returns the new mapped array.
381
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map Array.map()}
382
+ */
383
+ export declare function map(arr: any, fn: Iteratee | PropertyKey): any[] | undefined;
384
+ /**
385
+ * Creates an object composed of the picked object properties.
386
+ * @param {Object} obj The source object.
387
+ * @param {Iteratee|PropertyKey[]} paths The properties to pick. If `paths` is a function, it will be invoked per property with two values `(value, key)`.
388
+ * @returns A new object with the properties.
389
+ * @example
390
+ ```js
391
+ let object = { a: 1, b: '2', c: 3 }
392
+
393
+ pick(object, ['a', 'c'])
394
+ // => { a: 1, c: 3 }
395
+
396
+ pick(object, (x) => isNumber(x))
397
+ // => { a: 1, c: 3 }
398
+ ```
399
+ *
400
+ * @see {@link omit}
401
+ */
402
+ export declare function pick(obj: Object, paths: Iteratee | PropertyKey[]): {};
403
+ /**
404
+ * The opposite of {@link pick} - this method creates an object composed of the own and inherited enumerable property paths of `object` that are not omitted.
405
+ * @example
406
+ ```js
407
+ let object = { 'a': 1, 'b': '2', 'c': 3 }
408
+
409
+ omit(object, ['a', 'c'])
410
+ // => { 'b': '2' }
411
+
412
+ omit(object, (x) => isNumber(x))
413
+ // => { 'b': '2' }
414
+ ```
415
+ * @param {Object} obj The source object.
416
+ * @param {Iteratee|PropertyKey[]} paths The property paths to omit.
417
+ * @returns {Object} Returns the new object.
418
+ * @see {@link pick}
419
+ */
420
+ export declare function omit(obj: Object, paths: Iteratee | PropertyKey[]): {};
421
+ /**
422
+ * This method is like {@link find} except that it returns the index of the first element `predicate` returns truthy for instead of the element itself.
423
+ * @param {Array} obj The array to inspect.
424
+ * @param {string|Object|Iteratee} fn The predicate function
425
+ * @param {number} [start=0] The index to search from.
426
+ * @returns {number} The index of the found value, else -1
427
+ * @example
428
+ ```js
429
+ let users = [
430
+ { 'user': 'barney', 'active': false },
431
+ { 'user': 'fred', 'active': false },
432
+ { 'user': 'pebbles', 'active': true }
433
+ ]
434
+
435
+ index(users, (o) => o.user == 'barney')
436
+ // => 0
437
+
438
+ // The `shape` iteratee shorthand.
439
+ index(users, { 'user': 'fred', 'active': false })
440
+ // => 1
441
+
442
+ // The `property` iteratee shorthand.
443
+ index(users, 'active')
444
+ // => 2
445
+ ```
446
+ * @see {@link indexOf}
447
+ * @see {@link lastIndex}
448
+ *
449
+ */
450
+ export declare function index(obj: any, fn: Iteratee | string | Object, start?: number): number | undefined;
451
+ /**
452
+ * This method is like {@link index} except that it searches for a given value directly, instead of using a predicate function.
453
+ * @param {Array} obj The array to inspect.
454
+ * @param {*} value The value to find
455
+ * @param {number} [start=0] The index to search from.
456
+ * @returns {number} The index of the found value, else -1
457
+ * @example
458
+ ```js
459
+ indexOf([1, 2, 1, 2], 2)
460
+ // => 1
461
+
462
+ // Search from a `start` index.
463
+ indexOf([1, 2, 1, 2], 2, 2)
464
+ // => 3
465
+ ```
466
+ * @see {@link index}
467
+ * @see {@link lastIndexOf}
468
+ */
469
+ export declare function indexOf(obj: any, value: any, start?: number): any;
470
+ /**
471
+ * This method is like {@link index} except that it iterates the collection from right to left.
472
+ * @param {Array} obj The array to inspect.
473
+ * @param {string|Iteratee|Object} fn The function invoked per iteration.
474
+ * @param {number} [start] The index to search from.
475
+ * @returns {number} The index of the found value, else -1
476
+ * @example
477
+ ```js
478
+ let users = [
479
+ { 'user': 'barney', 'active': true },
480
+ { 'user': 'fred', 'active': false },
481
+ { 'user': 'pebbles', 'active': false }
482
+ ]
483
+
484
+ findLastIndex(users, (o) => o.user == 'pebbles')
485
+ // => 2
486
+
487
+ // The `shape` iteratee shorthand.
488
+ findLastIndex(users, { 'user': 'barney', 'active': true })
489
+ // => 0
490
+
491
+ // The `property` iteratee shorthand.
492
+ findLastIndex(users, 'active')
493
+ // => 0
494
+ ```
495
+ * @see {@link index}
496
+ * @see {@link lastIndexOf}
497
+ */
498
+ export declare function lastIndex(obj: any[], fn: string | Iteratee | Object, start?: any): any;
499
+ /**
500
+ * This method is like {@link indexOf} except that it iterates the collection from right to left.
501
+ * @param {Array} obj The array to inspect.
502
+ * @param {*} value The value to find
503
+ * @param {number} [start] The index to search from.
504
+ * @returns {number} The index of the found value, else -1
505
+ * @example
506
+ ```js
507
+ lastIndexOf([1, 2, 1, 2], 2)
508
+ // => 3
509
+
510
+ // Search from the `fromIndex`.
511
+ lastIndexOf([1, 2, 1, 2], 2, 2)
512
+ // => 1
513
+ ```
514
+ * @see {@link lastIndex}
515
+ * @see {@link indexOf}
516
+ */
517
+ export declare function lastIndexOf(obj: any[], value: any, start?: any): any;
518
+ /**
519
+ * Creates a shallow clone of `value`. If `deep` is `true` it will clone it recursively.
520
+ * @param {*} value
521
+ * @param {boolean} [deep=false]
522
+ * @return The clone value
523
+ * @see {@link cloneArray}
524
+ * @see {@link cloneTypedArray}
525
+ */
526
+ export declare function clone(value: any, deep?: boolean): any;
527
+ /**
528
+ * Clones an array. If `deep` is `false` (default) the clone will be shallow. Otherwise {@link https://developer.mozilla.org/en-US/docs/Web/API/structuredClone structuredClone} is used.
529
+ * @param arr The array to clone
530
+ * @param [deep=false] Creates a deep clone using `structuredClone` if true.
531
+ * @returns The new array
532
+ * @see {@link clone}
533
+ */
534
+ export declare function cloneArray(arr: any, deep?: boolean): any;
535
+ /**
536
+ * Clones a typed array. If `deep` is `false` (default) the clone will be shallow. Otherwise {@link https://developer.mozilla.org/en-US/docs/Web/API/structuredClone structuredClone} is used.
537
+ * @param arr The array to clone
538
+ * @param [deep=false] Creates a deep clone using `structuredClone` if true.
539
+ * @returns The new array
540
+ * @see {@link clone}
541
+ */
542
+ export declare function cloneTypedArray(typedArray: any, isDeep: any): any;
543
+ /**
544
+ * Creates a duplicate-free version of an array, using a `Set` for equality comparisons, in which only the first occurrence of each element is kept. The order of result values is not guaranteed.
545
+ * @param arr The array containing duplicated elements
546
+ * @param fn The iteratee invoked per element.
547
+ * @returns Returns the new duplicate free array.
548
+ * @example
549
+ ```js
550
+ uniq([2, 1, 2])
551
+ // => [2, 1]
552
+
553
+ uniq([2.1, 1.2, 2.3], Math.floor)
554
+ // => [2.1, 1.2]
555
+ ```
556
+ *
557
+ * @see {@link sortedUniq}
558
+ */
559
+ export declare function uniq<T = any>(arr: T[], fn?: PropertyKey | Iteratee): T[];
560
+ /**
561
+ * This method is like {@link uniq} except that it sorts the results in ascending order
562
+ * @param arr The array containing duplicated elements
563
+ * @param fn The iteratee invoked per element.
564
+ * @returns Returns the new duplicate free array
565
+ * @example
566
+ ```js
567
+ uniq([2, 1, 2])
568
+ // => [1, 2]
569
+ ```
570
+ * @see {@link uniq}
571
+ */
572
+ export declare function sortedUniq(arr: any, fn?: string | Iteratee): any[];
573
+ /**
574
+ * Recursively merges own and inherited enumerable string keyed properties of source objects into the destination object. Source properties that resolve to `undefined` are skipped if a destination value exists. Array and plain object properties are merged recursively. Other objects and value types are overridden by assignment. Source objects are applied from left to right. Subsequent sources overwrite property assignments of previous sources.
575
+ *
576
+ * Note: this method mutates `object`
577
+ *
578
+ *
579
+ * @param {Object} object The destination object.
580
+ * @param {...Object} sources The source objects.
581
+ * @returns Returns `object`.
582
+ *
583
+ * @example
584
+ ```js
585
+ let object = {
586
+ 'a': [{ 'b': 2 }, { 'd': 4 }]
587
+ }
588
+
589
+ let other = {
590
+ 'a': [{ 'c': 3 }, { 'e': 5 }]
591
+ }
592
+
593
+ merge(object, other)
594
+ // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
595
+ ```
596
+ */
597
+ export declare function merge(object: any, ...sources: any[]): Object;
598
+ /**
599
+ * Returns a generator of array values not included in the other given arrays using a `Set` for equality comparisons. The order and references of result values are not guaranteed.
600
+ * @param args The initial arrays
601
+ * @example
602
+ ```js
603
+ [...difference([2, 1], [2, 3])]
604
+ // => [1]
605
+ ```
606
+ * @see {@link union}
607
+ * @see {@link intersection}
608
+ */
609
+ export declare function difference(...args: Array<Iterable<any>>): Generator<any, void, unknown>;
610
+ /**
611
+ * Creates a generator of unique values that are included in all given arrays.
612
+ * @param args The arrays to inspect
613
+ * @example
614
+ ```js
615
+ [...intersection([2, 1], [2, 3])]
616
+ // => [2]
617
+ ```
618
+ * @see {@link difference}
619
+ * @see {@link union}
620
+ */
621
+ export declare function intersection(...args: Array<Iterable<any>>): Generator<any, void, unknown>;
622
+ /**
623
+ * Creates a generator of unique values from all given arrays using `Set` for equality comparisons.
624
+ * @param args The arrays to perform union on.
625
+ * @example
626
+ ```js
627
+ [...union([2], [1, 2])]
628
+ // => [2, 1]
629
+ ```
630
+ * @see {@link difference}
631
+ * @see {@link intersection}
632
+ */
633
+ export declare function union(...args: Array<Iterable<any>>): Generator<unknown, void, unknown>;
634
+ /**
635
+ * Creates an object composed of keys generated from the results of running each element of `arr` thru `func`. The order of grouped values is determined by the order they occur in `arr`. The corresponding value of each key is an array of elements responsible for generating the key.
636
+ *
637
+ * @param arr The collection to iterate over.
638
+ * @param [func=id] The iteratee to transform keys.
639
+ * @returns Returns the composed aggregate object.
640
+ *
641
+ * @example
642
+ ```js
643
+ groupBy([6.1, 4.2, 6.3], Math.floor)
644
+ // => { '4': [4.2], '6': [6.1, 6.3] }
645
+
646
+ // The `property` iteratee shorthand.
647
+ groupBy(['one', 'two', 'three'], 'length')
648
+ // => { '3': ['one', 'two'], '5': ['three'] }
649
+ ```
650
+ */
651
+ export declare function groupBy(arr: Iterable<any> | Object, func?: Iteratee | PropertyKey): Object;
652
+ /**
653
+ * Removes all elements from array that `func` returns truthy for and returns an array of the removed elements.
654
+ * @param arr The array to remove from.
655
+ * @param func The function invoked per iteration or value(s) or value to remove.
656
+ * @returns
657
+ */
658
+ export declare function remove<T>(arr: T[], func: any): T[];