moderndash 0.0.14 → 0.0.16

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.
@@ -0,0 +1,803 @@
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<TInput> = [TInput[], TInput[], ...TInput[][]];
18
+ type IterateeFunction<T> = (value: T) => unknown;
19
+ type PropertyShorthand<T> = keyof T;
20
+ type RecordKey = string | number | symbol;
21
+ type ArrayOrRecord<TInput> = TInput[] | Record<RecordKey, TInput>;
22
+ type NoUnion<T, U = T> = T extends U ? [U] extends [T] ? T : never : never;
23
+ /**
24
+ * @description Generic function type, should fit any function
25
+ * @typeParam TFunc - The input function type
26
+ */
27
+ type GenericFunction<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>> = (...args: Parameters<TFunc>) => ReturnType<TFunc>;
28
+
29
+ /**
30
+ * 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.
31
+ *
32
+ * **Note:** Unlike `pullAll`, this method returns a new array.
33
+ *
34
+ * @category Array
35
+ * @param arrays - First array is inspected, others are excluded.
36
+ * @returns Returns the new array of filtered values.
37
+ * @example
38
+ * difference([2, 1], [2, 3])
39
+ * // => [1]
40
+ */
41
+ declare function difference<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[];
42
+
43
+ /**
44
+ * This method is like `difference` except that it accepts `iteratee` which
45
+ * is invoked for each element of `array` and `values` to generate the criterion
46
+ * by which they're compared. The order and references of result values are
47
+ * determined by the first array.
48
+ *
49
+ * **Note:** Unlike `pullAllBy`, this method returns a new array.
50
+ *
51
+ * @category Array
52
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
53
+ * @param arrays - First array to inspect. Others are excluded.
54
+
55
+ * @returns Returns the new array of filtered values.
56
+ * @example
57
+ * differenceBy(Math.floor, [2.1, 1.2], [2.3, 3.4])
58
+ * // => [1.2]
59
+ * differenceBy('x', [{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }])
60
+ * // => [{ 'x': 2 }]
61
+ */
62
+ declare function differenceBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, ...arrays: MinimumTwoArrays<T>): T[];
63
+
64
+ /**
65
+ * This method is like `difference` except that it accepts `comparator`
66
+ * which is invoked to compare elements of `array` to `values`. The order and
67
+ * references of result values are determined by the first array. The comparator
68
+ * is invoked with two arguments: (arrVal, othVal).
69
+ *
70
+ * **Note:** Unlike `pullAllWith`, this method returns a new array.
71
+ *
72
+ * @category Array
73
+ * @param comparator - The comparator invoked per element.
74
+ * @param arrays - First array to inspect. Others are excluded.
75
+ * @returns Returns the new array of filtered values.
76
+ * @example
77
+ * differenceWith(isEqual, [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }], [{ 'x': 1, 'y': 2 }])
78
+ * // => [{ 'x': 2, 'y': 1 }]
79
+ */
80
+ declare function differenceWith<T>(comparator: (a: T, b: T) => boolean, ...arrays: MinimumTwoArrays<T>): T[];
81
+
82
+ /**
83
+ * Creates a slice of `array` excluding elements dropped from the end.
84
+ * Elements are dropped until `predicate` returns falsey. The predicate is
85
+ * invoked with three arguments: (value, index, array).
86
+ *
87
+ * @category Array
88
+ * @param predicate - The function invoked per iteration.
89
+ * @param array - The array to query.
90
+ * @returns Returns the slice of `array`.
91
+ * @example
92
+ * const users = [
93
+ * { 'user': 'barney', 'active': false },
94
+ * { 'user': 'fred', 'active': true },
95
+ * { 'user': 'pebbles', 'active': true }
96
+ * ]
97
+ *
98
+ * dropRightWhile(({ active }) => active, users)
99
+ * // => objects for ['barney']
100
+ */
101
+ declare function dropRightWhile<T>(predicate: (value: T) => boolean, array: T[]): T[];
102
+
103
+ /**
104
+ * Creates a slice of `array` excluding elements dropped from the beginning.
105
+ * Elements are dropped until `predicate` returns falsey. The predicate is
106
+ * invoked with three arguments: (value, index, array).
107
+ *
108
+ * @category Array
109
+ * @param predicate - The function invoked per iteration.
110
+ * @param array - The array to query.
111
+ * @returns Returns the slice of `array`.
112
+ * @example
113
+ * const users = [
114
+ * { 'user': 'barney', 'active': true },
115
+ * { 'user': 'fred', 'active': true },
116
+ * { 'user': 'pebbles', 'active': false }
117
+ * ]
118
+ *
119
+ * dropWhile(({ active }) => active, users)
120
+ * // => objects for ['pebbles']
121
+ */
122
+ declare function dropWhile<T>(predicate: (value: T) => boolean, array: T[]): T[];
123
+
124
+ /**
125
+ * Creates an array of unique values that are included in all given arrays.
126
+ * The order and references of result values are determined by the first array.
127
+ *
128
+ * @category Array
129
+ * @param arrays - The arrays to inspect.
130
+ * @returns Returns the new array of intersecting values.
131
+ * @example
132
+ * intersection([2, 1], [2, 3])
133
+ * // => [2]
134
+ */
135
+ declare function intersection<TInput>(...arrays: MinimumTwoArrays<TInput>): TInput[];
136
+
137
+ /**
138
+ * This method is like `intersection` except that it accepts `iteratee`
139
+ * which is invoked for each element of each `arrays` to generate the criterion
140
+ * by which they're compared. The order and references of result values are
141
+ * determined by the first array. The iteratee is invoked with one argument:
142
+ * (value).
143
+ *
144
+ * @example
145
+ * intersectionBy(Math.floor, [2.1, 1.2], [2.3, 3.4])
146
+ * // => [2.1]
147
+ * @category Array
148
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
149
+ * @param arrays - The arrays to inspect.
150
+ * @returns Returns the new array of intersecting values.
151
+ */
152
+ declare function intersectionBy<TInput>(iteratee: IterateeFunction<TInput> | PropertyShorthand<TInput>, ...arrays: MinimumTwoArrays<TInput>): TInput[];
153
+
154
+ /**
155
+ * This method is like `intersection` except that it accepts `comparator`
156
+ * which is invoked to compare elements of `arrays`. The order and references
157
+ * of result values are determined by the first array. The comparator is
158
+ * invoked with two arguments: (arrVal, othVal).
159
+ *
160
+ * @example
161
+ * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
162
+ * const others = [{ 'x': 1, 'y': 1 }, { 'x': 1, 'y': 2 }]
163
+ *
164
+ * intersectionWith(isEqual, objects, others)
165
+ * // => [{ 'x': 1, 'y': 2 }]
166
+ * @category Array
167
+ * @param comparator - The comparator invoked per element.
168
+ * @param arrays - The arrays to inspect.
169
+ * @returns Returns the new array of intersecting values.
170
+ */
171
+ declare function intersectionWith<T>(comparator: (a: T, b: T) => boolean, ...arrays: MinimumTwoArrays<T>): T[];
172
+
173
+ /**
174
+ * Gets a random element from `array`.
175
+ *
176
+ * @category Array
177
+ * @param array - The array to sample.
178
+ * @returns Returns the random element.
179
+ * @example
180
+ * sample([1, 2, 3, 4])
181
+ * // => 2
182
+ */
183
+ declare function sample<T>(array: T[]): T | undefined;
184
+
185
+ /**
186
+ * Gets `n` random elements at unique keys from `array` up to the
187
+ * size of `array`.
188
+ *
189
+ * @category Array
190
+ * @param size The number of elements to sample.
191
+ * @param array The array to sample.
192
+ * @returns Returns the random elements.
193
+ * @example
194
+ * sampleSize([1, 2, 3], 2)
195
+ * // => [3, 1]
196
+ *
197
+ * sampleSize([1, 2, 3], 4)
198
+ * // => [2, 3, 1]
199
+ */
200
+ declare function sampleSize<TInput>(size: number, array: TInput[]): TInput[];
201
+
202
+ /**
203
+ * Creates an array of shuffled values, using a version of the
204
+ * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle).
205
+ *
206
+ * @since 0.1.0
207
+ * @category Array
208
+ * @param array - The array or object to shuffle.
209
+ * @returns Returns the new shuffled array.
210
+ * @example
211
+ * shuffle([1, 2, 3, 4])
212
+ * // => [4, 1, 3, 2]
213
+ */
214
+ declare function shuffle<TInput>(array: TInput[]): TInput[];
215
+
216
+ /**
217
+ * Creates a slice of `array` with elements taken from the end. Elements are
218
+ * taken until `predicate` returns falsey. The predicate is invoked with
219
+ * three arguments: (value, index, array).
220
+ *
221
+ * @category Array
222
+ * @param predicate - The function invoked per iteration.
223
+ * @param array - The array to query.
224
+ * @returns Returns the slice of `array`.
225
+ * @example
226
+ * const users = [
227
+ * { 'user': 'barney', 'active': false },
228
+ * { 'user': 'fred', 'active': true },
229
+ * { 'user': 'pebbles', 'active': true }
230
+ * ]
231
+ *
232
+ * takeRightWhile(({ active }) => active, users)
233
+ * // => objects for ['fred', 'pebbles']
234
+ */
235
+ declare function takeRightWhile<T>(predicate: (elem: T) => boolean, array: T[]): T[];
236
+
237
+ /**
238
+ * Creates a slice of `array` with elements taken from the beginning. Elements
239
+ * are taken until `predicate` returns falsey. The predicate is invoked with
240
+ * three arguments: (value, index, array).
241
+ *
242
+ * @category Array
243
+ * @param predicate The function invoked per iteration.
244
+ * @param array The array to query.
245
+ * @returns Returns the slice of `array`.
246
+ * @example
247
+ * const users = [
248
+ * { 'user': 'barney', 'active': true },
249
+ * { 'user': 'fred', 'active': true },
250
+ * { 'user': 'pebbles', 'active': false }
251
+ * ]
252
+ *
253
+ * takeWhile(({ active }) => active, users)
254
+ * // => objects for ['barney', 'fred']
255
+ */
256
+ declare function takeWhile<T>(predicate: (elem: T) => boolean, array: T[]): T[];
257
+
258
+ /**
259
+ * Creates a duplicate-free version of an array, in which only the first occurrence of each element is kept.
260
+ * The order of result values is determined by the order they occur in the array.
261
+ *
262
+ * @category Array
263
+ * @param array - The array to inspect.
264
+ * @returns Returns the new duplicate free array.
265
+ * @example
266
+ * uniq([2, 1, 2])
267
+ * // => [2, 1]
268
+ */
269
+ declare function uniq<TInput>(array: TInput[]): TInput[];
270
+
271
+ /**
272
+ * This method is like `uniq` except that it accepts `iteratee` which is
273
+ * invoked for each element in `array` to generate the criterion by which
274
+ * uniqueness is computed. The order of result values is determined by the
275
+ * order they occur in the array.
276
+ *
277
+ * @category Array
278
+ * @param array - The array to inspect.
279
+ * @param iteratee - The iteratee invoked per element. Or property shorthand.
280
+ * @returns Returns the new duplicate free array.
281
+ * @example
282
+ * uniqBy(Math.floor, [2.1, 1.2, 2.3])
283
+ * // => [2.1, 1.2]
284
+ */
285
+ declare function uniqBy<T>(iteratee: IterateeFunction<T> | PropertyShorthand<T>, array: T[]): T[];
286
+
287
+ /**
288
+ * This method is like `uniq` except that it accepts `comparator` which is invoked to compare elements of `array`.
289
+ * The order of result values is determined by the order they occur in the array.
290
+ *
291
+ * @category Array
292
+ * @param array - The array to inspect.
293
+ * @param comparator - The comparator invoked per element.
294
+ * @returns Returns the new duplicate free array.
295
+ * @example
296
+ * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }]
297
+ *
298
+ * uniqWith(isEqual, objects)
299
+ * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }]
300
+ */
301
+ declare function uniqWith<TInput>(comparator: (a: TInput, b: TInput) => boolean, array: TInput[]): TInput[];
302
+
303
+ /**
304
+ * This method is like `zip` except that it accepts an array of grouped
305
+ * elements and creates an array regrouping the elements to their pre-zip configuration.
306
+ *
307
+ * @category Array
308
+ * @param array - The array of grouped elements to process.
309
+ * @returns Returns the new array of regrouped elements.
310
+ * @example
311
+ * const zipped = zip(['a', 'b'], [1, 2], [true, false])
312
+ * // => [['a', 1, true], ['b', 2, false]]
313
+ *
314
+ * unzip(zipped)
315
+ * // => [['a', 'b'], [1, 2], [true, false]]
316
+ */
317
+ declare function unzip<TInput extends unknown[]>(array: TInput[]): TInput[];
318
+
319
+ /**
320
+ * This method is like `unzip` except that it accepts `iteratee` to specify
321
+ * how regrouped values should be combined. The iteratee is invoked with the
322
+ * elements of each group: (...group).
323
+ *
324
+ * @category Array
325
+ * @param iteratee - The function to combine regrouped values.
326
+ * @param array - The array of grouped elements to process.
327
+ * @returns Returns the new array of regrouped elements.
328
+ * @example
329
+ * const zipped = zip([1, 2], [10, 20], [100, 200])
330
+ * // => [[1, 10, 100], [2, 20, 200]]
331
+ *
332
+ * unzipWith(add, zipped)
333
+ * // => [3, 30, 300]
334
+ */
335
+ declare function unzipWith<TInput extends unknown[], TOutput>(iteratee: (...t: TInput) => TOutput, array: TInput[]): TOutput[];
336
+
337
+ /**
338
+ * Creates an array of grouped elements, the first of which contains the first elements of the given arrays,
339
+ * the second of which contains the second elements of the given arrays, and so on.
340
+ *
341
+ * @category Array
342
+ * @param arrays - The arrays to process.
343
+ * @returns Returns the new array of grouped elements.
344
+ * @example
345
+ * zip(['a', 'b'], [1, 2], [true, false])
346
+ * // => [['a', 1, true], ['b', 2, false]]
347
+ */
348
+ declare function zip<TInput>(...arrays: TInput[][]): TInput[][];
349
+
350
+ type UnZip<A extends readonly unknown[]> = {
351
+ [K in keyof A]: readonly A[K][];
352
+ };
353
+ /**
354
+ * This method is like `zip` except that it accepts `iteratee` to specify
355
+ * how grouped values should be combined. The iteratee is invoked with the
356
+ * elements of each group: (...group).
357
+ *
358
+ * @category Array
359
+ * @param combineFunc - The function to combine grouped values.
360
+ * @param arrays - The arrays to process.
361
+ * @returns Returns the new array of grouped elements.
362
+ * @example
363
+ * zipWith([1, 2], [10, 20], [100, 200], (a, b, c) => a + b + c)
364
+ * // => [111, 222]
365
+ */
366
+ declare function zipWith<Args extends unknown[], TOutput>(combineFunc: (...args: Args) => TOutput, ...arrays: UnZip<Args>): TOutput[];
367
+
368
+ /**
369
+ * Creates an object composed of keys generated from the results of running
370
+ * each element of `collection` thru `iteratee`. The corresponding value of
371
+ * each key is the number of times the key was returned by `iteratee`.
372
+ *
373
+ * @example
374
+ * const users = [
375
+ * { 'user': 'barney', 'active': true },
376
+ * { 'user': 'betty', 'active': true },
377
+ * { 'user': 'fred', 'active': false }
378
+ * ]
379
+ *
380
+ * countBy(users, value => value.active);
381
+ * // => { 'true': 2, 'false': 1 }
382
+ * @category Collection
383
+ * @param iteratee - The iteratee to transform keys.
384
+ * @param collection - The array or record to iterate over.
385
+ * @returns Returns the composed aggregate object.
386
+ */
387
+ declare function countBy<TInput, TKey extends RecordKey>(collection: ArrayOrRecord<TInput>, iteratee: (value: TInput) => TKey): Record<TKey, number>;
388
+
389
+ /**
390
+ * Creates an object composed of keys generated from the results of running
391
+ * each element of `collection` thru `iteratee`. The order of grouped values
392
+ * is determined by the order they occur in `collection`. The corresponding
393
+ * value of each key is an array of elements responsible for generating the
394
+ * key.
395
+ *
396
+ * @example
397
+ * groupBy([6.1, 4.2, 6.3], Math.floor)
398
+ * // => { '4': [4.2], '6': [6.1, 6.3] }
399
+ * @category Collection
400
+ * @param collection - The array or object to iterate over.
401
+ * @param iteratee - The iteratee to transform keys.
402
+ * @returns Returns the composed aggregate object.
403
+ */
404
+ declare function groupBy<T, U extends RecordKey>(collection: ArrayOrRecord<T>, iteratee: (value: T) => U): Record<U, T[]>;
405
+
406
+ declare function sortBy<T, U>(iteratee: (item: T) => NoUnion<number | bigint | Date | string, U>, array: T[]): T[];
407
+
408
+ /**
409
+ * The opposite of `before`. This method creates a function that invokes `func` once it's called `n` or more times.
410
+ *
411
+ * @category Function
412
+ * @param n The number of calls before `func` is invoked.
413
+ * @param func The function to restrict.
414
+ * @returns Returns the new restricted function.
415
+ * @example
416
+ * const caution = () => console.log("Caution!");
417
+ *
418
+ * const afterFN = after(2, caution);
419
+ *
420
+ * afterFN()
421
+ * afterFN()
422
+ * afterFN()
423
+ * // => `caution` is invoked after called twice
424
+ */
425
+ declare function after<TFunc extends GenericFunction<TFunc>>(n: number, func: TFunc): (...args: Parameters<TFunc>) => ReturnType<TFunc> | undefined;
426
+
427
+ /**
428
+ * Creates a function that invokes `func`, while it's called less than `n` times. Subsequent
429
+ * calls to the created function return the result of the last `func` invocation.
430
+ *
431
+ * @category Function
432
+ * @param n - The number of calls at which `func` is no longer invoked.
433
+ * @param func - The function to restrict.
434
+ * @returns Returns the new restricted function.
435
+ * @example
436
+ * const caution = () => console.log("Caution!");
437
+ *
438
+ * // Only call caution two times
439
+ * const reducedCaution = before(2, caution)
440
+ *
441
+ * reducedCaution()
442
+ * reducedCaution()
443
+ * reducedCaution()
444
+ * // => `caution` is invoked twice
445
+ */
446
+ declare function before<TFunc extends (...args: Parameters<TFunc>) => ReturnType<TFunc>>(n: number, func: TFunc): TFunc;
447
+
448
+ declare function debounce<TFunc extends GenericFunction<TFunc>>(fn: TFunc, wait?: number, options?: {
449
+ leading?: boolean;
450
+ maxWait?: number;
451
+ trailing?: boolean;
452
+ }): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc>;
453
+
454
+ /**
455
+ * Creates a function that memoizes the result of `func`. If `resolver` is
456
+ * provided, it determines the cache key for storing the result based on the
457
+ * arguments provided to the memoized function. By default, all arguments
458
+ * provided to the memoized function are used as the map cache key.
459
+ *
460
+ * **Note:** The cache is exposed as the `cache` property on the memoized
461
+ * function. Its creation may be customized by replacing the `memoize.Cache`
462
+ * constructor with one whose instances implement the
463
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
464
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
465
+ *
466
+ * @category Function
467
+ * @param func - The function to have its output memoized.
468
+ * @param resolver - The function to resolve the cache key.
469
+ * @typeParam TFunc - The input function type
470
+ * @typeParam Cache - The cache map type
471
+ * @returns Returns the new memoized function.
472
+ * @example
473
+ * const object = \{ 'a': 1, 'b': 2 \}
474
+ *
475
+ * const values = memoize(values)
476
+ * values(object)
477
+ * // => [1, 2]
478
+ *
479
+ * values(object)
480
+ * // => [1, 2]
481
+ *
482
+ * object.a = 2
483
+ * values(object)
484
+ * // => [2, 2]
485
+ *
486
+ * // Modify the result cache.
487
+ * values.cache.set(object, ['a', 'b'])
488
+ * values(object)
489
+ * // => ['a', 'b']
490
+ *
491
+ * // Replace `memoize.Cache`.
492
+ * memoize.Cache = WeakMap
493
+ */
494
+ declare function memoize<TFunc extends GenericFunction<TFunc>, Cache extends Map<string | symbol, ReturnType<TFunc>>>(func: TFunc, resolver?: ((...args: Parameters<TFunc>) => string | symbol)): TFunc & {
495
+ cache: Cache;
496
+ };
497
+
498
+ /**
499
+ * Creates a function that is restricted to invoking `func` once. Repeat calls
500
+ * to the function return the value of the first invocation. The `func` is
501
+ * invoked with the `this` binding and arguments of the created function.
502
+ *
503
+ * @category Function
504
+ * @param func - The function to restrict.
505
+ * @returns Returns the new restricted function.
506
+ * @example
507
+ * const initialize = once(() => console.log('initialize'))
508
+ * initialize()
509
+ * initialize()
510
+ * // => `createApplication` is invoked once
511
+ */
512
+ declare function once<TFunc extends GenericFunction<TFunc>>(func: TFunc): TFunc;
513
+
514
+ declare function throttle<TFunc extends GenericFunction<TFunc>>(func: TFunc, wait?: number, options?: {
515
+ leading?: boolean;
516
+ trailing?: boolean;
517
+ }): (this: ThisParameterType<TFunc>, ...args: Parameters<TFunc>) => ReturnType<TFunc>;
518
+
519
+ /**
520
+ * Invokes the iteratee `n` times, returning an array of the results of
521
+ * each invocation. The function is invoked with one argument: (index).
522
+ *
523
+ * @example
524
+ * times(3, index => console.log("Run", index)))
525
+ * // => "Run 0" | "Run 1" | "Run 2"
526
+ * times(3, Math.random)
527
+ * // => [0.123, 0.456, 0.789]
528
+ * times(4, () => 0)
529
+ * // => [0, 0, 0, 0]
530
+ * @category Function
531
+ * @param n - The number of times to invoke `func`.
532
+ * @param iteratee - The function invoked per iteration.
533
+ * @returns Returns the array of results.
534
+ */
535
+ declare function times<T>(n: number, func: (index: number) => T): T[];
536
+
537
+ /**
538
+ * Checks if `value` is an empty object, collection, map, or set.
539
+ *
540
+ * Objects are considered empty if they have no own enumerable string keyed
541
+ * properties.
542
+ *
543
+ * Array-like values such as `arguments` objects, arrays, buffers, strings, or
544
+ * Similarly, maps and sets are considered empty if they have a `size` of `0`.
545
+ *
546
+ * @category Lang
547
+ * @param value - The value to check.
548
+ * @returns Returns `true` if `value` is empty, else `false`.
549
+ * @example
550
+ * isEmpty(null)
551
+ * // => true
552
+ *
553
+ * isEmpty({})
554
+ * // => true
555
+ *
556
+ * isEmpty("")
557
+ * // => true
558
+ *
559
+ * isEmpty([1, 2, 3])
560
+ * // => false
561
+ *
562
+ * isEmpty('abc')
563
+ * // => false
564
+ *
565
+ * isEmpty({ 'a': 1 })
566
+ * // => false
567
+ */
568
+ declare function isEmpty(value: string | object | null | undefined): boolean;
569
+
570
+ /**
571
+ * Performs a deep comparison between two values to determine if they are
572
+ * equivalent.
573
+ *
574
+ * **Note:** This method supports comparing arrays, array buffers, booleans,
575
+ * date objects, error objects, maps, numbers, `Object` objects, regexes,
576
+ * sets, strings, symbols, and typed arrays. `Object` objects are compared
577
+ * by their own, not inherited, enumerable properties. Functions and DOM
578
+ * nodes are compared by strict equality, i.e. `===`.
579
+ *
580
+ * @category Lang
581
+ * @param value1 - The value to compare.
582
+ * @param value2 - The other value to compare.
583
+ * @returns Returns `true` if the values are equivalent, else `false`.
584
+ * @example
585
+ * var object = { 'a': 1 };
586
+ * var other = { 'a': 1 };
587
+ *
588
+ * _.isEqual(object, other);
589
+ * // => true
590
+ *
591
+ * object === other;
592
+ * // => false
593
+ */
594
+ declare function isEqual(value1: unknown, value2: unknown): boolean;
595
+
596
+ /**
597
+ * This method is like `_.isEqual` except that it accepts `customizer` which
598
+ * is invoked to compare values. If `customizer` returns `undefined`, comparisons
599
+ * are handled by the method instead. The `customizer` is invoked with up to
600
+ * six arguments: (objValue, othValue [, index|key, object, other, stack]).
601
+ *
602
+ * @category Lang
603
+ * @param value1 - The value to compare.
604
+ * @param value2 - The other value to compare.
605
+ * @param customizer - The function to customize comparisons.
606
+ * @returns Returns `true` if the values are equivalent, else `false`.
607
+ * @example
608
+ * function isGreeting(value) {
609
+ * return /^h(?:i|ello)$/.test(value);
610
+ * }
611
+ *
612
+ * function customizer(objValue, othValue) {
613
+ * if (isGreeting(objValue) && isGreeting(othValue)) {
614
+ * return true;
615
+ * }
616
+ * }
617
+ *
618
+ * var array = ['hello', 'goodbye'];
619
+ * var other = ['hi', 'goodbye'];
620
+ *
621
+ * isEqualWith(array, other, customizer);
622
+ * // => true
623
+ */
624
+ declare function isEqualWith<T>(a: T, b: T, customizer: (value: T) => unknown): boolean;
625
+
626
+ declare function isPlainObject(value: unknown): value is object;
627
+
628
+ /**
629
+ * Creates an object composed of the picked `object` properties.
630
+ *
631
+ * @example
632
+ * const object = { 'a': 1, 'b': '2', 'c': 3 }
633
+ *
634
+ * pick(object, ['a', 'c'])
635
+ * // => { 'a': 1, 'c': 3 }
636
+ * @category Object
637
+ * @param object - The source object.
638
+ * @param keys - The property paths to pick.
639
+ * @returns Returns the new object.
640
+ */
641
+ declare function pick<T, K extends keyof T>(object: T, keys: K[]): Pick<T, K>;
642
+
643
+ /**
644
+ * Converts `string` to camelCase.
645
+ *
646
+ * @example
647
+ * camelCase('Foo Bar')
648
+ * // => 'fooBar'
649
+ * camelCase('--foo-bar--')
650
+ * // => 'fooBar'
651
+ * camelCase('__FOO_BAR__')
652
+ * // => 'fooBar'
653
+ * @category String
654
+ * @param str - The string to convert.
655
+ * @returns Returns the camel cased string.
656
+ */
657
+ declare function camelCase(str: string): string;
658
+
659
+ /**
660
+ * Converts the first character of a string to upper case and the remaining to lower case.
661
+ *
662
+ * @example
663
+ * capitalize('FRED')
664
+ * // => 'Fred'
665
+ * @category String
666
+ * @param str - The string to capitalize.
667
+ * @returns Returns the capitalized string.
668
+ */
669
+ declare function capitalize(str: string): string;
670
+
671
+ /**
672
+ * Deburrs a string by converting
673
+ * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
674
+ * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
675
+ * letters to basic Latin letters and removing
676
+ * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
677
+ *
678
+ * @example
679
+ * deburr('déjà vu')
680
+ * // => 'deja vu'
681
+ * @category String
682
+ * @param str - The string to deburr.
683
+ * @returns Returns the deburred string.
684
+ */
685
+ declare function deburr(str: string): string;
686
+
687
+ /**
688
+ * Converts the characters `&`, `<`, `>`, `"` and `'` in a string to their corresponding HTML entities.
689
+ *
690
+ * @example
691
+ * escape('fred, barney, & pebbles')
692
+ * // => 'fred, barney, &amp; pebbles'
693
+ * @category String
694
+ * @param str - The string to escape.
695
+ * @returns Returns the escaped string.
696
+ */
697
+ declare function escape(str: string): string;
698
+
699
+ /**
700
+ * Escapes the `RegExp` special characters `^`, `$`, `\`, `.`, `*`, `+`,
701
+ * `?`, `(`, `)`, `[`, `]`, `{`, `}`, and `|` in a string.
702
+ *
703
+ * @example
704
+ * escapeRegExp('[moderndash](https://moderndash.io/)')
705
+ * // => '\[moderndash\]\(https://moderndash\.io/\)'
706
+ * @category String
707
+ * @param str - The string to escape.
708
+ * @returns Returns the escaped string.
709
+ */
710
+ declare function escapeRegExp(str: string): string;
711
+
712
+ /**
713
+ * Converts a string to kebab-case.
714
+ *
715
+ * @example
716
+ * kebabCase('Foo Bar')
717
+ * // => 'foo-bar'
718
+ * kebabCase('fooBar')
719
+ * // => 'foo-bar'
720
+ * kebabCase('__FOO_BAR__')
721
+ * // => 'foo-bar'
722
+ * @category String
723
+ * @param str - The string to convert.
724
+ * @returns Returns the kebab cased string.
725
+ */
726
+ declare function kebabCase(str: string): string;
727
+
728
+ /**
729
+ * Converts a string to PascalCase.
730
+ *
731
+ * @example
732
+ * kebabCase('Foo Bar')
733
+ * // => 'FooBar'
734
+ * kebabCase('fooBar')
735
+ * // => 'FooBar'
736
+ * kebabCase('__FOO_BAR__')
737
+ * // => 'FooBar'
738
+ * @category String
739
+ * @param str - The string to convert.
740
+ * @returns Returns the pascal cased string.
741
+ */
742
+ declare function pascalCase(str: string): string;
743
+
744
+ /**
745
+ * Converts a string to snake_case.
746
+ *
747
+ * @example
748
+ * snakeCase('Foo Bar')
749
+ * // => 'foo_bar'
750
+ * snakeCase('fooBar')
751
+ * // => 'foo_bar'
752
+ * snakeCase('--FOO-BAR--')
753
+ * // => 'foo_bar'
754
+ * snakeCase('foo2bar')
755
+ * // => 'foo_2_bar'
756
+ * @category String
757
+ * @param str - The string to convert.
758
+ * @returns Returns the snake cased string.
759
+ */
760
+ declare function snakeCase(str: string): string;
761
+
762
+ /**
763
+ * Converts a string to Start Case.
764
+ *
765
+ * @example
766
+ * startCase('--foo-bar--')
767
+ * // => 'Foo Bar'
768
+ * startCase('fooBar')
769
+ * // => 'Foo Bar'
770
+ * startCase('__FOO_BAR__')
771
+ * // => 'Foo Bar'
772
+ * @category String
773
+ * @param str - The string to convert.
774
+ * @returns Returns the start cased string.
775
+ */
776
+ declare function startCase(str: string): string;
777
+
778
+ /**
779
+ * Removes all special characters from a string.
780
+ *
781
+ * @example
782
+ * stripSpecialChars('Héllo! World #$%&*!')
783
+ * // => 'Hello World'
784
+ * @category String
785
+ * @param str - The string to remove special characters from.
786
+ * @returns Returns the string with special characters removed.
787
+ */
788
+ declare function stripSpecialChars(str: string): string;
789
+
790
+ /**
791
+ * Converts the HTML entities `&amp;`, `&lt;`, `&gt;`, `&quot;` and `&#39;`
792
+ * in a string to their corresponding characters.
793
+ *
794
+ * @example
795
+ * unescape('fred, barney, &amp; pebbles')
796
+ * // => 'fred, barney, & pebbles'
797
+ * @category String
798
+ * @param str - The string to unescape.
799
+ * @returns Returns the unescaped string.
800
+ */
801
+ declare function unescape(str: string): string;
802
+
803
+ export { ArrayOrRecord, GenericFunction, 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, times, unescape, uniq, uniqBy, uniqWith, unzip, unzipWith, zip, zipWith };