moderndash 0.0.8 → 0.0.9

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Maximilian Dewald
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,586 @@
1
+ /**
2
+ * Creates an array of elements split into groups the length of size. If array can't be split evenly, the final chunk will be the remaining elements.
3
+ *
4
+ * @category Array
5
+ * @returns Returns the new array of chunks.
6
+ * @param chunkSize - The array to process.
7
+ * @param array - The length of each chunk
8
+ * @example
9
+ * chunk(2, ['a', 'b', 'c', 'd'])
10
+ * // => [['a', 'b'], ['c', 'd']]
11
+ *
12
+ * chunk(3, ['a', 'b', 'c', 'd'])
13
+ * // => [['a', 'b', 'c'], ['d']]
14
+ */
15
+ declare function chunk<TInput>(chunkSize: number, array: TInput[]): TInput[][];
16
+
17
+ type MinimumTwoArrays<T> = [T[], T[], ...T[][]];
18
+ type IterateeFunction<T> = (value: T) => unknown;
19
+ type PropertyShorthand<T> = keyof T;
20
+ type RecordKey = string | number | symbol;
21
+ type Collection<T> = T[] | Record<RecordKey, T>;
22
+ type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
23
+
24
+ /**
25
+ * Creates an array of `array` values not included in the other given arrays. The order and references of result values are determined by the first array.
26
+ *
27
+ * **Note:** Unlike `pullAll`, this method returns a new array.
28
+ *
29
+ * @category Array
30
+ * @param arrays - First array is inspected, others are excluded.
31
+ * @returns Returns the new array of filtered values.
32
+ * @example
33
+ * difference([2, 1], [2, 3])
34
+ * // =\> [1]
35
+ */
36
+ declare function difference<T>(...arrays: MinimumTwoArrays<T>): T[];
37
+
38
+ /**
39
+ * This method is like `difference` except that it accepts `iteratee` which
40
+ * is invoked for each element of `array` and `values` to generate the criterion
41
+ * by which they're compared. The order and references of result values are
42
+ * determined by the first array.
43
+ *
44
+ * **Note:** Unlike `pullAllBy`, this method returns a new array.
45
+ *
46
+ * @category Array
47
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
48
+ * @param arrays - First array to inspect. Others are excluded.
49
+
50
+ * @returns Returns the new array of filtered values.
51
+ * @example
52
+ * differenceBy(Math.floor, [2.1, 1.2], [2.3, 3.4])
53
+ * // => [1.2]
54
+ * differenceBy('x', [{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }])
55
+ * // => [{ 'x': 2 }]
56
+ */
57
+ declare function differenceBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, ...arrays: MinimumTwoArrays<T>): T[];
58
+
59
+ /**
60
+ * This method is like `difference` except that it accepts `comparator`
61
+ * which is invoked to compare elements of `array` to `values`. The order and
62
+ * references of result values are determined by the first array. The comparator
63
+ * is invoked with two arguments: (arrVal, othVal).
64
+ *
65
+ * **Note:** Unlike `pullAllWith`, this method returns a new array.
66
+ *
67
+ * @category Array
68
+ * @param comparator - The comparator invoked per element.
69
+ * @param arrays - First array to inspect. Others are excluded.
70
+ * @returns Returns the new array of filtered values.
71
+ * @example
72
+ * differenceWith(isEqual, [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }], [{ 'x': 1, 'y': 2 }])
73
+ * // => [{ 'x': 2, 'y': 1 }]
74
+ */
75
+ declare function differenceWith<T>(comparator: (a: T, b: T) => boolean, ...arrays: MinimumTwoArrays<T>): T[];
76
+
77
+ /**
78
+ * Creates a slice of `array` excluding elements dropped from the end.
79
+ * Elements are dropped until `predicate` returns falsey. The predicate is
80
+ * invoked with three arguments: (value, index, array).
81
+ *
82
+ * @category Array
83
+ * @param predicate - The function invoked per iteration.
84
+ * @param array - The array to query.
85
+ * @returns Returns the slice of `array`.
86
+ * @example
87
+ * const users = [
88
+ * { 'user': 'barney', 'active': false },
89
+ * { 'user': 'fred', 'active': true },
90
+ * { 'user': 'pebbles', 'active': true }
91
+ * ]
92
+ *
93
+ * dropRightWhile(({ active }) => active, users)
94
+ * // => objects for ['barney']
95
+ */
96
+ declare function dropRightWhile<T>(predicate: (value: T) => boolean, array: T[]): T[];
97
+
98
+ /**
99
+ * Creates a slice of `array` excluding elements dropped from the beginning.
100
+ * Elements are dropped until `predicate` returns falsey. The predicate is
101
+ * invoked with three arguments: (value, index, array).
102
+ *
103
+ * @category Array
104
+ * @param predicate - The function invoked per iteration.
105
+ * @param array - The array to query.
106
+ * @returns Returns the slice of `array`.
107
+ * @example
108
+ * const users = [
109
+ * { 'user': 'barney', 'active': true },
110
+ * { 'user': 'fred', 'active': true },
111
+ * { 'user': 'pebbles', 'active': false }
112
+ * ]
113
+ *
114
+ * dropWhile(({ active }) => active, users)
115
+ * // => objects for ['pebbles']
116
+ */
117
+ declare function dropWhile<T>(predicate: (value: T) => boolean, array: T[]): T[];
118
+
119
+ /**
120
+ * Creates an array of unique values that are included in all given arrays.
121
+ * The order and references of result values are determined by the first array.
122
+ *
123
+ * @category Array
124
+ * @param arrays - The arrays to inspect.
125
+ * @returns Returns the new array of intersecting values.
126
+ * @example
127
+ * intersection([2, 1], [2, 3])
128
+ * // => [2]
129
+ */
130
+ declare function intersection<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[];
131
+
132
+ /**
133
+ * This method is like `intersection` except that it accepts `iteratee`
134
+ * which is invoked for each element of each `arrays` to generate the criterion
135
+ * by which they're compared. The order and references of result values are
136
+ * determined by the first array. The iteratee is invoked with one argument:
137
+ * (value).
138
+ *
139
+ * @category Array
140
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
141
+ * @param arrays - The arrays to inspect.
142
+ * @returns Returns the new array of intersecting values.
143
+ * @example
144
+ * intersectionBy(Math.floor, [2.1, 1.2], [2.3, 3.4])
145
+ * // => [2.1]
146
+ */
147
+ declare function intersectionBy<TInput>(iteratee: IterateeFunction<TInput> | PropertyShorthand<TInput>, ...arrays: MinimumTwoArrays<TInput>): TInput[];
148
+
149
+ /**
150
+ * This method is like `intersection` except that it accepts `comparator`
151
+ * which is invoked to compare elements of `arrays`. The order and references
152
+ * of result values are determined by the first array. The comparator is
153
+ * invoked with two arguments: (arrVal, othVal).
154
+ *
155
+ * @category Array
156
+ * @param comparator - The comparator invoked per element.
157
+ * @param arrays - The arrays to inspect.
158
+ * @returns Returns the new array of intersecting values.
159
+ * @example
160
+ * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
161
+ * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]
162
+ *
163
+ * intersectionWith(isEqual, objects, others)
164
+ * // => [{ 'x': 1, 'y': 2 }]
165
+ */
166
+ declare function intersectionWith<T>(comparator: (a: T, b: T) => boolean, ...arrays: MinimumTwoArrays<T>): T[];
167
+
168
+ /**
169
+ * Gets a random element from `array`.
170
+ *
171
+ * @category Array
172
+ * @param array - The array to sample.
173
+ * @returns Returns the random element.
174
+ * @example
175
+ * sample([1, 2, 3, 4])
176
+ * // => 2
177
+ */
178
+ declare function sample<T>(array: T[]): T | undefined;
179
+
180
+ /**
181
+ * Gets `n` random elements at unique keys from `array` up to the
182
+ * size of `array`.
183
+ *
184
+ * @category Array
185
+ * @param size The number of elements to sample.
186
+ * @param array The array to sample.
187
+ * @returns Returns the random elements.
188
+ * @example
189
+ * sampleSize([1, 2, 3], 2)
190
+ * // => [3, 1]
191
+ *
192
+ * sampleSize([1, 2, 3], 4)
193
+ * // => [2, 3, 1]
194
+ */
195
+ declare function sampleSize<TInput>(size: number, array: TInput[]): TInput[];
196
+
197
+ /**
198
+ * Creates an array of shuffled values, using a version of the
199
+ * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
200
+ *
201
+ * @since 0.1.0
202
+ * @category Array
203
+ * @param array - The array or object to shuffle.
204
+ * @returns {Array} Returns the new shuffled array.
205
+ * @example
206
+ * shuffle([1, 2, 3, 4])
207
+ * // => [4, 1, 3, 2]
208
+ */
209
+ declare function shuffle<TInput>(array: TInput[]): TInput[];
210
+
211
+ /**
212
+ * Creates a slice of `array` with elements taken from the end. Elements are
213
+ * taken until `predicate` returns falsey. The predicate is invoked with
214
+ * three arguments: (value, index, array).
215
+ *
216
+ * @category Array
217
+ * @param predicate - The function invoked per iteration.
218
+ * @param array - The array to query.
219
+ * @returns Returns the slice of `array`.
220
+ * @example
221
+ * const users = [
222
+ * { 'user': 'barney', 'active': false },
223
+ * { 'user': 'fred', 'active': true },
224
+ * { 'user': 'pebbles', 'active': true }
225
+ * ]
226
+ *
227
+ * takeRightWhile(({ active }) => active, users)
228
+ * // => objects for ['fred', 'pebbles']
229
+ */
230
+ declare function takeRightWhile<T>(predicate: (elem: T) => boolean, array: T[]): T[];
231
+
232
+ /**
233
+ * Creates a slice of `array` with elements taken from the beginning. Elements
234
+ * are taken until `predicate` returns falsey. The predicate is invoked with
235
+ * three arguments: (value, index, array).
236
+ *
237
+ * @category Array
238
+ * @param predicate The function invoked per iteration.
239
+ * @param array The array to query.
240
+ * @returns Returns the slice of `array`.
241
+ * @example
242
+ * const users = [
243
+ * { 'user': 'barney', 'active': true },
244
+ * { 'user': 'fred', 'active': true },
245
+ * { 'user': 'pebbles', 'active': false }
246
+ * ]
247
+ *
248
+ * takeWhile(({ active }) => active, users)
249
+ * // => objects for ['barney', 'fred']
250
+ */
251
+ declare function takeWhile<T>(predicate: (elem: T) => boolean, array: T[]): T[];
252
+
253
+ /**
254
+ * Creates an array of unique values, in order, from all given arrays using for equality comparisons.
255
+ *
256
+ * @category Array
257
+ * @param arrays - The arrays to inspect.
258
+ * @returns Returns the new array of combined values.
259
+ * @example
260
+ * union([2, 3], [1, 2])
261
+ * // => [2, 3, 1]
262
+ */
263
+ declare function union<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[];
264
+
265
+ /**
266
+ * This method is like `union` except that it accepts `iteratee` which is
267
+ * invoked for each element of each `arrays` to generate the criterion by
268
+ * which uniqueness is computed. Result values are chosen from the first
269
+ * array in which the value occurs. The iteratee is invoked with one argument:
270
+ * (value).
271
+ *
272
+ * @category Array
273
+ * @param arrays - The arrays to inspect.
274
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
275
+ * @returns Returns the new array of combined values.
276
+ * @example
277
+ * unionBy(Math.floor, [2.1], [1.2, 2.3])
278
+ * // => [2.1, 1.2]
279
+ */
280
+ declare function unionBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, ...arrays: MinimumTwoArrays<T>): T[];
281
+
282
+ /**
283
+ * This method is like `union` except that it accepts `comparator` which
284
+ * is invoked to compare elements of `arrays`. Result values are chosen from
285
+ * the first array in which the value occurs. The comparator is invoked
286
+ * with two arguments: (arrVal, othVal).
287
+ *
288
+ * @category Array
289
+ * @param comparator - The comparator invoked per element.
290
+ * @param arrays - The arrays to inspect.
291
+ * @returns Returns the new array of combined values.
292
+ * @example
293
+ * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
294
+ * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]
295
+ *
296
+ * unionWith(isEqual, objects, others)
297
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 1 }]
298
+ */
299
+ declare function unionWith<TInput>(comparator: (a: TInput, b: TInput) => boolean, ...arrays: MinimumTwoArrays<TInput>): TInput[];
300
+
301
+ /**
302
+ * Creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.
303
+ * The order of result values is determined by the order they occur in the array.
304
+ *
305
+ * @category Array
306
+ * @param array - The array to inspect.
307
+ * @returns Returns the new duplicate free array.
308
+ * @example
309
+ * uniq([2, 1, 2])
310
+ * // => [2, 1]
311
+ */
312
+ declare function uniq<TInput>(array: TInput[]): TInput[];
313
+
314
+ /**
315
+ * This method is like `uniq` except that it accepts `iteratee` which is
316
+ * invoked for each element in `array` to generate the criterion by which
317
+ * uniqueness is computed. The order of result values is determined by the
318
+ * order they occur in the array.
319
+ *
320
+ * @category Array
321
+ * @param array - The array to inspect.
322
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
323
+ * @returns Returns the new duplicate free array.
324
+ * @example
325
+ * uniqBy(Math.floor, [2.1, 1.2, 2.3])
326
+ * // => [2.1, 1.2]
327
+ */
328
+ declare function uniqBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, array: T[]): T[];
329
+
330
+ /**
331
+ * This method is like `uniq` except that it accepts `comparator` which is invoked to compare elements of `array`.
332
+ * The order of result values is determined by the order they occur in the array.
333
+ *
334
+ * @category Array
335
+ * @param array - The array to inspect.
336
+ * @param comparator - The comparator invoked per element.
337
+ * @returns {Array} Returns the new duplicate free array.
338
+ * @example
339
+ * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]
340
+ *
341
+ * uniqWith(isEqual, objects)
342
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
343
+ */
344
+ declare function uniqWith<TInput>(comparator: (a: TInput, b: TInput) => boolean, array: TInput[]): TInput[];
345
+
346
+ /**
347
+ * This method is like `zip` except that it accepts an array of grouped
348
+ * elements and creates an array regrouping the elements to their pre-zip configuration.
349
+ *
350
+ * @category Array
351
+ * @param array - The array of grouped elements to process.
352
+ * @returns Returns the new array of regrouped elements.
353
+ * @example
354
+ * const zipped = zip(['a', 'b'], [1, 2], [true, false])
355
+ * // => [['a', 1, true], ['b', 2, false]]
356
+ *
357
+ * unzip(zipped)
358
+ * // => [['a', 'b'], [1, 2], [true, false]]
359
+ */
360
+ declare function unzip<TInput extends unknown[]>(array: TInput[]): TInput[];
361
+
362
+ /**
363
+ * This method is like `unzip` except that it accepts `iteratee` to specify
364
+ * how regrouped values should be combined. The iteratee is invoked with the
365
+ * elements of each group: (...group).
366
+ *
367
+ * @category Array
368
+ * @param iteratee - The function to combine regrouped values.
369
+ * @param array - The array of grouped elements to process.
370
+ * @returns Returns the new array of regrouped elements.
371
+ * @example
372
+ * const zipped = zip([1, 2], [10, 20], [100, 200])
373
+ * // => [[1, 10, 100], [2, 20, 200]]
374
+ *
375
+ * unzipWith(add, zipped)
376
+ * // => [3, 30, 300]
377
+ */
378
+ declare function unzipWith<TInput extends unknown[], TOutput>(iteratee: (...t: TInput) => TOutput, array: TInput[]): TOutput[];
379
+
380
+ /**
381
+ * Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
382
+ * the second of which contains the second elements of the given arrays, and so on.
383
+ *
384
+ * @category Array
385
+ * @param arrays - The arrays to process.
386
+ * @returns Returns the new array of grouped elements.
387
+ * @example
388
+ * zip(['a', 'b'], [1, 2], [true, false])
389
+ * // => [['a', 1, true], ['b', 2, false]]
390
+ */
391
+ declare function zip<TInput>(...arrays: TInput[][]): TInput[][];
392
+
393
+ type UnZip<A extends readonly unknown[]> = {
394
+ [K in keyof A]: readonly A[K][];
395
+ };
396
+ /**
397
+ * This method is like `zip` except that it accepts `iteratee` to specify
398
+ * how grouped values should be combined. The iteratee is invoked with the
399
+ * elements of each group: (...group).
400
+ *
401
+ * @category Array
402
+ * @param combineFunc - The function to combine grouped values.
403
+ * @param arrays - The arrays to process.
404
+ * @returns Returns the new array of grouped elements.
405
+ * @example
406
+ * zipWith([1, 2], [10, 20], [100, 200], (a, b, c) => a + b + c)
407
+ * // => [111, 222]
408
+ */
409
+ declare function zipWith<Args extends unknown[], TOutput>(combineFunc: (...args: Args) => TOutput, ...arrays: UnZip<Args>): TOutput[];
410
+
411
+ /**
412
+ * Creates an object composed of keys generated from the results of running
413
+ * each element of `collection` thru `iteratee`. The corresponding value of
414
+ * each key is the number of times the key was returned by `iteratee`.
415
+ *
416
+ * @category Collection
417
+ * @param iteratee - The iteratee to transform keys.
418
+ * @param collection - The array or object to iterate over.
419
+ * @returns Returns the composed aggregate object.
420
+ * @example
421
+ * const users = [
422
+ * { 'user': 'barney', 'active': true },
423
+ * { 'user': 'betty', 'active': true },
424
+ * { 'user': 'fred', 'active': false }
425
+ * ]
426
+ *
427
+ * countBy(value => value.active, users);
428
+ * // => { 'true': 2, 'false': 1 }
429
+ */
430
+ declare function countBy<TInput, TKey extends RecordKey>(iteratee: (value: TInput) => TKey, collection: Collection<TInput>): Record<TKey, number>;
431
+
432
+ /**
433
+ * Creates an object composed of keys generated from the results of running
434
+ * each element of `collection` thru `iteratee`. The order of grouped values
435
+ * is determined by the order they occur in `collection`. The corresponding
436
+ * value of each key is an array of elements responsible for generating the
437
+ * key.
438
+ *
439
+ * @category Collection
440
+ * @param collection The array or object to iterate over.
441
+ * @param iteratee The iteratee to transform keys.
442
+ * @returns Returns the composed aggregate object.
443
+ * @example
444
+ *
445
+ * groupBy(Math.floor, [6.1, 4.2, 6.3])
446
+ * // => { '4': [4.2], '6': [6.1, 6.3] }
447
+ */
448
+ declare function groupBy<T, U extends RecordKey>(iteratee: (value: T) => U, collection: Collection<T>): Record<U, T[]>;
449
+
450
+ declare function sortBy<T, U>(iteratee: (item: T) => NoUnion<number | bigint | Date | string, U>, array: T[]): T[];
451
+
452
+ /**
453
+ * The opposite of `before`. This method creates a function that invokes `func` once it's called `n` or more times.
454
+ *
455
+ * @category Function
456
+ * @param n The number of calls before `func` is invoked.
457
+ * @param func The function to restrict.
458
+ * @returns Returns the new restricted function.
459
+ * @example
460
+ * const caution = () => alert("Caution!");
461
+ *
462
+ * // Display alert only after it has been called 5 times
463
+ * after(5, caution)
464
+ */
465
+ declare function after<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc): (...args: Parameters<TFunc>) => ReturnType<TFunc> | undefined;
466
+
467
+ /**
468
+ * Creates a function that invokes `func`, with the `this` binding and arguments
469
+ * of the created function, while it's called less than `n` times. Subsequent
470
+ * calls to the created function return the result of the last `func` invocation.
471
+ *
472
+ * @category Function
473
+ * @param n - The number of calls at which `func` is no longer invoked.
474
+ * @param func - The function to restrict.
475
+ * @returns Returns the new restricted function.
476
+ * @example
477
+ * const caution = () => alert("Caution!");
478
+ *
479
+ * // Only call caution two times
480
+ * before(2, caution)
481
+ */
482
+ declare function before<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc): TFunc;
483
+
484
+ declare function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(fn: T, wait?: number, options?: {
485
+ leading?: boolean;
486
+ maxWait?: number;
487
+ trailing?: boolean;
488
+ }): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
489
+
490
+ type Cache = Map<string | symbol, unknown>;
491
+ /**
492
+ * Creates a function that memoizes the result of `func`. If `resolver` is
493
+ * provided, it determines the cache key for storing the result based on the
494
+ * arguments provided to the memoized function. By default, all arguments
495
+ * provided to the memoized function are used as the map cache key.
496
+ *
497
+ * **Note:** The cache is exposed as the `cache` property on the memoized
498
+ * function. Its creation may be customized by replacing the `memoize.Cache`
499
+ * constructor with one whose instances implement the
500
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
501
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
502
+ *
503
+ * @category Function
504
+ * @param func - The function to have its output memoized.
505
+ * @param resolver - The function to resolve the cache key.
506
+ * @returns Returns the new memoized function.
507
+ * @example
508
+ * const object = \{ 'a': 1, 'b': 2 \}
509
+ *
510
+ * const values = memoize(values)
511
+ * values(object)
512
+ * // => [1, 2]
513
+ *
514
+ * values(object)
515
+ * // => [1, 2]
516
+ *
517
+ * object.a = 2
518
+ * values(object)
519
+ * // => [2, 2]
520
+ *
521
+ * // Modify the result cache.
522
+ * values.cache.set(object, ['a', 'b'])
523
+ * values(object)
524
+ * // => ['a', 'b']
525
+ *
526
+ * // Replace `memoize.Cache`.
527
+ * memoize.Cache = WeakMap
528
+ */
529
+ declare function memoize<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(func: TFunc, resolver?: ((...args: Parameters<TFunc>) => string | symbol)): TFunc & {
530
+ cache: Cache;
531
+ };
532
+
533
+ declare function once<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(func: TFunc): TFunc;
534
+
535
+ declare function throttle<T extends (...args: Parameters<T>) => ReturnType<T>>(func: T, wait?: number, options?: {
536
+ leading?: boolean;
537
+ trailing?: boolean;
538
+ }): (this: ThisParameterType<T>, ...args: Parameters<T>) => ReturnType<T>;
539
+
540
+ declare function isEmpty(value: unknown): boolean;
541
+
542
+ declare function isEqual(value1: unknown, value2: unknown): boolean;
543
+
544
+ declare function isEqualWith<T>(customizer: (value: T) => unknown, a: T, b: T): boolean;
545
+
546
+ declare function isPlainObject(value: unknown): value is object;
547
+
548
+ /**
549
+ * Creates an object composed of the picked `object` properties.
550
+ *
551
+ * @category Object
552
+ * @param object The source object.
553
+ * @param keys The property paths to pick.
554
+ * @returns {Object} Returns the new object.
555
+ * @example
556
+ *
557
+ * const object = { 'a': 1, 'b': '2', 'c': 3 }
558
+ *
559
+ * pick(object, ['a', 'c'])
560
+ * // => { 'a': 1, 'c': 3 }
561
+ */
562
+ declare function pick<T, K extends keyof T>(object: T, keys: K[]): Pick<T, K>;
563
+
564
+ declare function camelCase(str: string): string;
565
+
566
+ declare function capitalize(str: string): string;
567
+
568
+ declare function deburr(str: string): string;
569
+
570
+ declare function escape(str: string): string;
571
+
572
+ declare function escapeRegExp(str: string): string;
573
+
574
+ declare function kebabCase(str: string): string;
575
+
576
+ declare function pascalCase(str: string): string;
577
+
578
+ declare function snakeCase(str: string): string;
579
+
580
+ declare function startCase(str: string): string;
581
+
582
+ declare function stripSpecialChars(str: string): string;
583
+
584
+ declare function unescapeHTML(html: string): string;
585
+
586
+ export { Collection, IterateeFunction, MinimumTwoArrays, NoUnion, PropertyShorthand, RecordKey, after, before, camelCase, capitalize, chunk, countBy, debounce, deburr, difference, differenceBy, differenceWith, dropRightWhile, dropWhile, escape, escapeRegExp, groupBy, intersection, intersectionBy, intersectionWith, isEmpty, isEqual, isEqualWith, isPlainObject, kebabCase, memoize, once, pascalCase, pick, sample, sampleSize, shuffle, snakeCase, sortBy, startCase, stripSpecialChars, takeRightWhile, takeWhile, throttle, unescapeHTML, union, unionBy, unionWith, uniq, uniqBy, uniqWith, unzip, unzipWith, zip, zipWith };