@vinicunca/perkakas 0.1.0 → 0.2.1

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/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { MergeDeep } from 'type-fest';
1
+ import { IsAny, ReadonlyTuple, MergeDeep } from 'type-fest';
2
2
 
3
3
  /**
4
4
  * Using event.code is not predictable since each machine may have different output
@@ -92,7 +92,7 @@ declare function anyPass<T>(fns: ReadonlyArray<(data: T) => boolean>): (data: T)
92
92
 
93
93
  type Pred<T, K> = (input: T) => K;
94
94
  type PredIndexed<T, K> = (input: T, index: number, array: Array<T>) => K;
95
- type PredIndexedOptional<T, K> = (input: T, index?: number, array?: Array<T>) => K;
95
+ type PredIndexedOptional<T, K> = (input: T, index?: number, array?: ReadonlyArray<T>) => K;
96
96
  type NonEmptyArray<T> = [T, ...Array<T>];
97
97
  /**
98
98
  * This should only be used for defining generics which extend any kind of JS
@@ -107,6 +107,14 @@ type NonEmptyArray<T> = [T, ...Array<T>];
107
107
  * @see This was inspired by the type-definition of Promise.all (https://github.com/microsoft/TypeScript/blob/1df5717b120cddd325deab8b0f2b2c3eecaf2b01/src/lib/es2015.promise.d.ts#L21)
108
108
  */
109
109
  type IterableContainer<T = unknown> = [] | ReadonlyArray<T>;
110
+ type ObjectKeys$1<T extends object> = `${Exclude<keyof T, symbol>}`;
111
+ /**
112
+ * An extension of Extract for type predicates which falls back to the base
113
+ * in order to narrow the `unknown` case.
114
+ * @example
115
+ * function isMyType<T>(data: T | MyType): data is NarrowedTo<T, MyType> { ... }
116
+ */
117
+ type NarrowedTo<T, Base> = Extract<T, Base> extends never ? Base : IsAny<T> extends true ? Base : Extract<T, Base>;
110
118
 
111
119
  type Chunked<T extends IterableContainer> = T[number] extends never ? [] : T extends readonly [...Array<unknown>, unknown] | readonly [unknown, ...Array<unknown>] ? NonEmptyArray<NonEmptyArray<T[number]>> : Array<NonEmptyArray<T[number]>>;
112
120
  /**
@@ -304,6 +312,7 @@ declare namespace difference {
304
312
  declare function dropLast<T>(array: ReadonlyArray<T>, n: number): Array<T>;
305
313
  /**
306
314
  * Removes last `n` elements from the `array`.
315
+ * @param array the target array
307
316
  * @param n the number of elements to skip
308
317
  * @signature
309
318
  * P.dropLast(n)(array)
@@ -329,6 +338,7 @@ declare function dropLast<T>(n: number): (array: ReadonlyArray<T>) => Array<T>;
329
338
  declare function drop<T>(array: ReadonlyArray<T>, n: number): Array<T>;
330
339
  /**
331
340
  * Removes first `n` elements from the `array`.
341
+ * @param array the target array
332
342
  * @param n the number of elements to skip
333
343
  * @signature
334
344
  * P.drop(n)(array)
@@ -343,6 +353,142 @@ declare namespace drop {
343
353
  function lazy<T>(n: number): (value: T) => LazyResult<T>;
344
354
  }
345
355
 
356
+ declare const COMPARATORS: {
357
+ readonly asc: <T>(x: T, y: T) => boolean;
358
+ readonly desc: <T_1>(x: T_1, y: T_1) => boolean;
359
+ };
360
+ /**
361
+ * An order rule defines a projection/extractor that returns a comparable from
362
+ * the data being compared. It would be run on each item being compared, and a
363
+ * comparator would then be used on the results to determine the order.
364
+ *
365
+ * There are 2 forms of the order rule, a simple one which only provides the
366
+ * projection function and assumes ordering is ascending, and a 2-tuple where
367
+ * the first element is the projection function and the second is the direction;
368
+ * this allows changing the direction without defining a more complex projection
369
+ * to simply negate the value (e.g. `(x) => -x`).
370
+ *
371
+ * We rely on the javascript implementation of `<` and `>` for comparison, which
372
+ * will attempt to transform both operands into a primitive comparable value via
373
+ * the built in `valueOf` function (and then `toString`). It's up to the caller
374
+ * to make sure that the projection is returning a value that makes sense for
375
+ * this logic.
376
+ *
377
+ * It's important to note that there is no built-in caching/memoization of
378
+ * projection function and therefore no guarantee that it would only be called
379
+ * once.
380
+ */
381
+ type OrderRule<T> = Projection<T> | readonly [projection: Projection<T>, direction: keyof typeof COMPARATORS];
382
+ type Projection<T> = (x: T) => Comparable$1;
383
+ type Comparable$1 = {
384
+ [Symbol.toPrimitive](hint: string): ComparablePrimitive$1;
385
+ } | {
386
+ toString(): string;
387
+ } | {
388
+ valueOf(): ComparablePrimitive$1;
389
+ } | ComparablePrimitive$1;
390
+ type ComparablePrimitive$1 = boolean | number | string;
391
+
392
+ /**
393
+ * Drop the first `n` items from `data` based on the provided ordering criteria.
394
+ * This allows you to avoid sorting the array before dropping the items.
395
+ * The complexity of this function is *O(Nlogn)* where `N` is the length of the array.
396
+ *
397
+ * For the opposite operation (to keep `n` elements) see `takeFirstBy`.
398
+ *
399
+ * @params data - the input array
400
+ * @params n - the number of items to drop. If `n` is non-positive no items would be dropped and a *clone* of the input would be returned, if `n` is bigger then data.length no items would be returned.
401
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
402
+ * @returns a subset of the input array.
403
+ * @signature
404
+ * P.dropFirstBy(data, n, ...rules);
405
+ * @example
406
+ * P.dropFirstBy(['aa', 'aaaa', 'a', 'aaa'], 2, x => x.length); // => ['aaa', 'aaaa']
407
+ * @dataFirst
408
+ * @category Array
409
+ */
410
+ declare function dropFirstBy<T>(data: ReadonlyArray<T>, n: number, ...rules: Readonly<NonEmptyArray<OrderRule<T>>>): Array<T>;
411
+ /**
412
+ * Drop the first `n` items from `data` based on the provided ordering criteria. This allows you to avoid sorting the array before dropping the items. The complexity of this function is *O(Nlogn)* where `N` is the length of the array.
413
+ *
414
+ * For the opposite operation (to keep `n` elements) see `takeFirstBy`.
415
+ *
416
+ * @params data - the input array
417
+ * @params n - the number of items to drop. If `n` is non-positive no items would be dropped and a *clone* of the input would be returned, if `n` is bigger then data.length no items would be returned.
418
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
419
+ * @returns a subset of the input array.
420
+ * @signature
421
+ * P.dropFirstBy(n, ...rules)(data);
422
+ * @example
423
+ * P.pipe(['aa', 'aaaa', 'a', 'aaa'], P.dropFirstBy(2, x => x.length)); // => ['aaa', 'aaaa']
424
+ * @dataLast
425
+ * @category Array
426
+ */
427
+ declare function dropFirstBy<T>(n: number, ...rules: Readonly<NonEmptyArray<OrderRule<T>>>): (data: ReadonlyArray<T>) => Array<T>;
428
+
429
+ /**
430
+ * Removes elements from the end of the array until the predicate returns false.
431
+ *
432
+ * The predicate is applied to each element in the array starting from the end and moving towards the beginning, until the predicate returns false. The returned array includes elements from the beginning of the array, up to and including the element that produced false for the predicate.
433
+ *
434
+ * @param data the array
435
+ * @param predicate the predicate
436
+ * @signature
437
+ * P.dropLastWhile(data, predicate)
438
+ * @example
439
+ * P.dropLastWhile([1, 2, 10, 3, 4], x => x < 10) // => [1, 2, 10]
440
+ * @dataFirst
441
+ * @category Array
442
+ */
443
+ declare function dropLastWhile<T>(data: ReadonlyArray<T>, predicate: (item: T) => boolean): Array<T>;
444
+ /**
445
+ * Removes elements from the end of the array until the predicate returns false.
446
+ *
447
+ * The predicate is applied to each element in the array starting from the end and moving towards the beginning, until the predicate returns false. The returned array includes elements from the beginning of the array, up to and including the element that produced false for the predicate.
448
+ *
449
+ * @param predicate the predicate
450
+ * @signature
451
+ * P.dropLastWhile(predicate)(data)
452
+ * @example
453
+ * P.pipe([1, 2, 10, 3, 4], P.dropLastWhile(x => x < 10)) // => [1, 2, 10]
454
+ * @dataLast
455
+ * @category Array
456
+ */
457
+ declare function dropLastWhile<T>(predicate: (item: T) => boolean): (data: ReadonlyArray<T>) => Array<T>;
458
+
459
+ /**
460
+ * Removes elements from the beginning of the array until the predicate returns false.
461
+ *
462
+ * The predicate is applied to each element in the array,
463
+ * until the predicate returns false.
464
+ * The returned array includes the rest of the elements,
465
+ * starting with the element that produced false for the predicate.
466
+ *
467
+ * @param data the array
468
+ * @param predicate the predicate
469
+ * @signature
470
+ * P.dropWhile(data, predicate)
471
+ * @example
472
+ * P.dropWhile([1, 2, 10, 3, 4], x => x < 10) // => [10, 3, 4]
473
+ * @dataFirst
474
+ * @category Array
475
+ */
476
+ declare function dropWhile<T>(data: ReadonlyArray<T>, predicate: (item: T) => boolean): Array<T>;
477
+ /**
478
+ * Removes elements from the beginning of the array until the predicate returns false.
479
+ *
480
+ * The predicate is applied to each element in the array, until the predicate returns false. The returned array includes the rest of the elements, starting with the element that produced false for the predicate.
481
+ *
482
+ * @param predicate the predicate
483
+ * @signature
484
+ * P.dropWhile(predicate)(data)
485
+ * @example
486
+ * P.pipe([1, 2, 10, 3, 4], P.dropWhile(x => x < 10)) // => [10, 3, 4]
487
+ * @dataLast
488
+ * @category Array
489
+ */
490
+ declare function dropWhile<T>(predicate: (item: T) => boolean): (data: ReadonlyArray<T>) => Array<T>;
491
+
346
492
  /**
347
493
  * Filter the elements of an array that meet the condition specified in a callback function.
348
494
  * @param array The array to filter.
@@ -384,9 +530,9 @@ declare namespace filter {
384
530
  */
385
531
  function indexed<T, S extends T>(fn: (input: T, index: number, array: Array<T>) => input is S): (array: ReadonlyArray<T>) => Array<S>;
386
532
  function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => Array<T>;
387
- const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>;
388
- const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>) & {
389
- indexed: true;
533
+ const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>;
534
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>) & {
535
+ readonly indexed: true;
390
536
  };
391
537
  }
392
538
 
@@ -437,20 +583,20 @@ declare namespace findIndex {
437
583
  } | {
438
584
  done: boolean;
439
585
  hasNext: boolean;
440
- next?: undefined;
586
+ next?: never;
441
587
  }) & {
442
588
  single: true;
443
589
  };
444
- const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => {
590
+ const lazyIndexed: ((fn: PredIndexedOptional<unknown, boolean>) => (value: unknown, index?: number | undefined, array?: unknown[] | undefined) => {
445
591
  done: boolean;
446
592
  hasNext: boolean;
447
593
  next: number;
448
594
  } | {
449
595
  done: boolean;
450
596
  hasNext: boolean;
451
- next?: undefined;
597
+ next?: never;
452
598
  }) & {
453
- indexed: true;
599
+ readonly indexed: true;
454
600
  } & {
455
601
  single: true;
456
602
  };
@@ -589,12 +735,12 @@ declare namespace find {
589
735
  }) & {
590
736
  single: true;
591
737
  };
592
- const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => {
738
+ const lazyIndexed: ((fn: PredIndexedOptional<unknown, boolean>) => (value: unknown, index?: number | undefined, array?: unknown[] | undefined) => {
593
739
  done: boolean;
594
740
  hasNext: boolean;
595
- next: T;
741
+ next: unknown;
596
742
  }) & {
597
- indexed: true;
743
+ readonly indexed: true;
598
744
  } & {
599
745
  single: true;
600
746
  };
@@ -633,6 +779,60 @@ declare namespace first {
633
779
  }
634
780
  }
635
781
 
782
+ type FirstBy<T extends IterableContainer> = (T extends readonly [unknown, ...ReadonlyArray<unknown>] ? never : T extends readonly [...ReadonlyArray<unknown>, unknown] ? never : undefined) | T[number];
783
+ /**
784
+ * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining "tie-breaker" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `P.first(P.sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.
785
+ *
786
+ * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.
787
+ *
788
+ * @param data an array of items
789
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending ordeP.
790
+ * @returns the first element by the order criteria, or `undefined` if the array
791
+ * is empty. (The function provides strong typing if the input type assures the
792
+ * array isn't empty).
793
+ * @signature
794
+ * P.firstBy(...rules)(data);
795
+ * @example
796
+ * const max = P.pipe([1,2,3], P.firstBy([P.identity, "desc"])); // => 3;
797
+ * const min = P.pipe([1,2,3], P.firstBy([1,2,3])); // => 1;
798
+ *
799
+ * const data = [{ a: "a" }, { a: "aa" }, { a: "aaa" }] as const;
800
+ * const maxBy = P.pipe(data, P.firstBy([(item) => item.a.length, "desc"])); // => { a: "aaa" };
801
+ * const minBy = P.pipe(data, P.firstBy((item) => item.a.length)); // => { a: "a" };
802
+ *
803
+ * const data = [{type: "cat", size: 1}, {type: "cat", size: 2}, {type: "dog", size: 3}] as const;
804
+ * const multi = P.pipe(data, P.firstBy(P.prop('type'), [P.prop('size'), 'desc'])); // => {type: "cat", size: 2}
805
+ * @dataLast
806
+ * @category Array
807
+ */
808
+ declare function firstBy<T extends IterableContainer>(...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>): (data: T) => FirstBy<T>;
809
+ /**
810
+ * Find the first element in the array that adheres to the order rules provided. This is a superset of what a typical `maxBy` or `minBy` function would do as it allows defining "tie-breaker" rules when values are equal, and allows comparing items using any logic. This function is equivalent to calling `P.first(P.sortBy(...))` but runs at *O(n)* instead of *O(nlogn)*.
811
+ *
812
+ * Use `nthBy` if you need an element other that the first, or `takeFirstBy` if you more than just the first element.
813
+ *
814
+ * @param data an array of items
815
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending ordeP.
816
+ * @returns the first element by the order criteria, or `undefined` if the array
817
+ * is empty. (The function provides strong typing if the input type assures the
818
+ * array isn't empty).
819
+ * @signature
820
+ * P.firstBy(data, ...rules);
821
+ * @example
822
+ * const max = P.firstBy([1,2,3], [P.identity, "desc"]); // => 3;
823
+ * const min = P.firstBy([1,2,3], P.identity); // => 1;
824
+ *
825
+ * const data = [{ a: "a" }, { a: "aa" }, { a: "aaa" }] as const;
826
+ * const maxBy = P.firstBy(data, [(item) => item.a.length, "desc"]); // => { a: "aaa" };
827
+ * const minBy = P.firstBy(data, (item) => item.a.length); // => { a: "a" };
828
+ *
829
+ * const data = [{type: "cat", size: 1}, {type: "cat", size: 2}, {type: "dog", size: 3}] as const;
830
+ * const multi = P.firstBy(data, P.prop('type'), [P.prop('size'), 'desc']); // => {type: "cat", size: 2}
831
+ * @dataFirst
832
+ * @category Array
833
+ */
834
+ declare function firstBy<T extends IterableContainer>(data: T, ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>): FirstBy<T>;
835
+
636
836
  /**
637
837
  * Map each element of an array into an object using a defined callback function and flatten the result.
638
838
  * @param array The array to map.
@@ -718,7 +918,7 @@ declare namespace flatMap {
718
918
  done: boolean;
719
919
  hasNext: boolean;
720
920
  next: K | readonly K[];
721
- hasMany?: undefined;
921
+ hasMany?: never;
722
922
  };
723
923
  }
724
924
 
@@ -816,13 +1016,13 @@ declare function forEach<T>(fn: Pred<T, void>): (array: ReadonlyArray<T>) => Arr
816
1016
  declare namespace forEach {
817
1017
  function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, void>): Array<T>;
818
1018
  function indexed<T>(fn: PredIndexed<T, void>): (array: ReadonlyArray<T>) => Array<T>;
819
- const lazy: <T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>;
820
- const lazyIndexed: (<T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>) & {
821
- indexed: true;
1019
+ const lazy: <T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>;
1020
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, void>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>) & {
1021
+ readonly indexed: true;
822
1022
  };
823
1023
  }
824
1024
 
825
- interface Strict$6 {
1025
+ interface Strict$7 {
826
1026
  <Value, Key extends PropertyKey = PropertyKey>(items: ReadonlyArray<Value>, fn: (item: Value) => Key | undefined): StrictOut$2<Value, Key>;
827
1027
  <Value, Key extends PropertyKey = PropertyKey>(fn: (item: Value) => Key | undefined): (items: ReadonlyArray<Value>) => StrictOut$2<Value, Key>;
828
1028
  readonly indexed: {
@@ -853,9 +1053,54 @@ declare function groupBy<T>(fn: (item: T) => PropertyKey | undefined): (array: R
853
1053
  declare namespace groupBy {
854
1054
  function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, PropertyKey | undefined>): Record<string, NonEmptyArray<T>>;
855
1055
  function indexed<T>(fn: PredIndexed<T, PropertyKey | undefined>): (array: ReadonlyArray<T>) => Record<string, NonEmptyArray<T>>;
856
- const strict: Strict$6;
1056
+ const strict: Strict$7;
857
1057
  }
858
1058
 
1059
+ type ArrayMinN<T, N extends number> = number extends N ? Array<T> : N extends 0 ? Array<T> : [...ReadonlyTuple<T, N>, ...Array<T>];
1060
+ /**
1061
+ * Checks if the given array has at least the defined number of elements, and
1062
+ * refines the output type accordingly so that those indices are defined when
1063
+ * accessing the array even when using typescript's 'noUncheckedIndexAccess'.
1064
+ *
1065
+ * @param data the input array
1066
+ * @param minimum the minimum number of elements the array must have
1067
+ * @return true if the array's length is *at least* `minimum`.
1068
+ * @signature
1069
+ * P.hasAtLeast(data, minimum)
1070
+ * @example
1071
+ * P.hasAtLeast([], 4); // => false
1072
+ *
1073
+ * const data: number[] = [1,2,3,4];
1074
+ * P.hasAtLeast(data, 1); // => true
1075
+ * data[0]; // 1, with type `number`
1076
+ * @dataFirst
1077
+ * @category Array
1078
+ */
1079
+ declare function hasAtLeast<T, N extends number>(data: ReadonlyArray<T>, minimum: N): data is ArrayMinN<T, N>;
1080
+ /**
1081
+ * Checks if the given array has at least the defined number of elements, and
1082
+ * refines the output type accordingly so that those indices are defined when
1083
+ * accessing the array even when using typescript's 'noUncheckedIndexAccess'.
1084
+ *
1085
+ * @param data the input array
1086
+ * @param minimum the minimum number of elements the array must have
1087
+ * @return true if the array's length is *at least* `minimum`.
1088
+ * @signature
1089
+ * P.hasAtLeast(minimum)(data)
1090
+ * @example
1091
+ * P.pipe([], P.hasAtLeast(4)); // => false
1092
+ *
1093
+ * const data = [[1,2], [3], [4,5]];
1094
+ * P.pipe(
1095
+ * data,
1096
+ * P.filter(P.hasAtLeast(2)),
1097
+ * P.map(([, second]) => second),
1098
+ * ); // => [2,5], with type `number[]`
1099
+ * @dataLast
1100
+ * @category Array
1101
+ */
1102
+ declare function hasAtLeast<N extends number>(minimum: N): <T>(data: ReadonlyArray<T>) => data is ArrayMinN<T, N>;
1103
+
859
1104
  /**
860
1105
  * Converts a list of objects into an object indexing the objects by the given key.
861
1106
  * @param array the array
@@ -1049,7 +1294,7 @@ type Enumerable<T> = ArrayLike<T> | Iterable<T>;
1049
1294
  declare function length<T>(items: Enumerable<T>): number;
1050
1295
  declare function length<T>(): (items: Enumerable<T>) => number;
1051
1296
 
1052
- interface Strict$5 {
1297
+ interface Strict$6 {
1053
1298
  <T extends IterableContainer, K>(items: T, mapper: Pred<T[number], K>): StrictOut$1<T, K>;
1054
1299
  <T extends IterableContainer, K>(mapper: Pred<T[number], K>): (items: T) => StrictOut$1<T, K>;
1055
1300
  readonly indexed: {
@@ -1101,11 +1346,11 @@ declare function map<T, K>(fn: Pred<T, K>): (array: ReadonlyArray<T>) => Array<K
1101
1346
  declare namespace map {
1102
1347
  function indexed<T, K>(array: ReadonlyArray<T>, fn: PredIndexed<T, K>): Array<K>;
1103
1348
  function indexed<T, K>(fn: PredIndexed<T, K>): (array: ReadonlyArray<T>) => Array<K>;
1104
- const lazy: <T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<K>;
1105
- const lazyIndexed: (<T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<K>) & {
1106
- indexed: true;
1349
+ const lazy: <T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<K>;
1350
+ const lazyIndexed: (<T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<K>) & {
1351
+ readonly indexed: true;
1107
1352
  };
1108
- const strict: Strict$5;
1353
+ const strict: Strict$6;
1109
1354
  }
1110
1355
 
1111
1356
  /**
@@ -1123,7 +1368,7 @@ declare namespace map {
1123
1368
  * @indexed
1124
1369
  * @category Array
1125
1370
  */
1126
- declare function mapToObj<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn: (element: T) => [K, V]): Record<K, V>;
1371
+ declare function mapToObj<T, K extends PropertyKey, V>(array: ReadonlyArray<T>, fn: (element: T) => [K, V]): Record<K, V>;
1127
1372
  /**
1128
1373
  * Map each element of an array into an object using a defined callback function.
1129
1374
  * @param fn The mapping function, which should return a tuple of [key, value], similar to Object.fromEntries
@@ -1144,10 +1389,10 @@ declare function mapToObj<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn
1144
1389
  * @indexed
1145
1390
  * @category Array
1146
1391
  */
1147
- declare function mapToObj<T, K extends keyof any, V>(fn: (element: T) => [K, V]): (array: ReadonlyArray<T>) => Record<K, V>;
1392
+ declare function mapToObj<T, K extends PropertyKey, V>(fn: (element: T) => [K, V]): (array: ReadonlyArray<T>) => Record<K, V>;
1148
1393
  declare namespace mapToObj {
1149
- function indexed<T, K extends keyof any, V>(array: ReadonlyArray<T>, fn: (element: T, index: number, array: ReadonlyArray<T>) => [K, V]): Record<K, V>;
1150
- function indexed<T, K extends keyof any, V>(fn: (element: T, index: number, array: ReadonlyArray<T>) => [K, V]): (array: ReadonlyArray<T>) => Record<K, V>;
1394
+ function indexed<T, K extends PropertyKey, V>(array: ReadonlyArray<T>, fn: (element: T, index: number, array: ReadonlyArray<T>) => [K, V]): Record<K, V>;
1395
+ function indexed<T, K extends PropertyKey, V>(fn: (element: T, index: number, array: ReadonlyArray<T>) => [K, V]): (array: ReadonlyArray<T>) => Record<K, V>;
1151
1396
  }
1152
1397
 
1153
1398
  /**
@@ -1280,6 +1525,83 @@ declare namespace minBy {
1280
1525
  function indexed<T>(fn: PredIndexed<T, number>): (array: ReadonlyArray<T>) => T | undefined;
1281
1526
  }
1282
1527
 
1528
+ /**
1529
+ * Retrieves the element that would be at the given index if the array were sorted according to specified rules.
1530
+ * This function uses the *QuickSelect* algorithm running at an average complexity of *O(n)*.
1531
+ * Semantically it is equivalent to `sortBy(data, ...rules).at(index)` which would run at *O(nlogn)*.
1532
+ *
1533
+ * See also `firstBy` which provides an even more efficient algorithm and a stricter return type,
1534
+ * but only for `index === 0`.
1535
+ * See `takeFirstBy` to get all the elements up to and including `index`.
1536
+ *
1537
+ * @param data - The input array.
1538
+ * @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.
1539
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
1540
+ * @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.
1541
+ * @signature
1542
+ * P.nthBy(data, index, ...rules);
1543
+ * @example
1544
+ * P.nthBy([2,1,4,5,3,], 2, identity); // => 3
1545
+ * @dataFirst
1546
+ * @category Array
1547
+ */
1548
+ declare function nthBy<T extends IterableContainer>(data: T, index: number, ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>): T[number] | undefined;
1549
+ /**
1550
+ * Retrieves the element that would be at the given index if the array were sorted according to specified rules.
1551
+ * This function uses the *QuickSelect* algorithm running at an average complexity of *O(n)*.
1552
+ * Semantically it is equivalent to `sortBy(data, ...rules)[index]` which would run at *O(nlogn)*.
1553
+ *
1554
+ * See also `firstBy` which provides an even more efficient algorithm and a stricter return type,
1555
+ * but only for `index === 0`.
1556
+ * See `takeFirstBy` to get all the elements up to and including `index`.
1557
+ *
1558
+ * @param data - The input array.
1559
+ * @param index - The zero-based index for selecting the element in the sorted order. Negative indices count backwards from the end.
1560
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
1561
+ * @returns The element at the specified index in the sorted order, or `undefined` if the index is out of bounds.
1562
+ * @signature
1563
+ * P.nthBy(index, ...rules)(data);
1564
+ * @example
1565
+ * P.pipe([2,1,4,5,3,], P.nthBy(2, identity)); // => 3
1566
+ * @dataLast
1567
+ * @category Array
1568
+ */
1569
+ declare function nthBy<T extends IterableContainer>(index: number, ...rules: Readonly<NonEmptyArray<OrderRule<T[number]>>>): (data: T) => T[number] | undefined;
1570
+
1571
+ type Only<T extends IterableContainer> = T extends readonly [...Array<unknown>, unknown, unknown] | readonly [] | readonly [unknown, ...Array<unknown>, unknown] | readonly [unknown, unknown, ...Array<unknown>] ? undefined : T extends readonly [unknown] ? T[number] : T[number] | undefined;
1572
+ /**
1573
+ * Returns the first and only element of `array`, or undefined otherwise.
1574
+ * Note: In `pipe`, use `only()` form instead of `only`. Otherwise, the
1575
+ * inferred type is lost.
1576
+ * @param array the target array
1577
+ * @signature
1578
+ * P.only(array)
1579
+ * @example
1580
+ * P.only([]) // => undefined
1581
+ * P.only([1]) // => 1
1582
+ * P.only([1, 2]) // => undefined
1583
+ * @pipeable
1584
+ * @category Array
1585
+ * @dataFirst
1586
+ */
1587
+ declare function only<T extends IterableContainer>(array: Readonly<T>): Only<T>;
1588
+ /**
1589
+ * Returns the first and only element of `array`, or undefined otherwise.
1590
+ * Note: In `pipe`, use `only()` form instead of `only`. Otherwise, the
1591
+ * inferred type is lost.
1592
+ * @param array the target array
1593
+ * @signature
1594
+ * P.only(array)
1595
+ * @example
1596
+ * P.only([]) // => undefined
1597
+ * P.only([1]) // => 1
1598
+ * P.only([1, 2]) // => undefined
1599
+ * @pipeable
1600
+ * @category Array
1601
+ * @dataLast
1602
+ */
1603
+ declare function only<T extends IterableContainer>(): (array: Readonly<T>) => Only<T>;
1604
+
1283
1605
  /**
1284
1606
  * Splits a collection into two groups, the first of which contains elements the `predicate` type guard passes, and the second one containing the rest.
1285
1607
  * @param items the items to split
@@ -1361,6 +1683,45 @@ declare function range(start: number, end: number): Array<number>;
1361
1683
  */
1362
1684
  declare function range(end: number): (start: number) => Array<number>;
1363
1685
 
1686
+ /**
1687
+ * Calculates the rank of an item in an array based on `rules`. The rank is the position where the item would appear in the sorted array. This function provides an efficient way to determine the rank in *O(n)* time, compared to *O(nlogn)* for the equivalent `sortedIndex(sortBy(data, ...rules), item)`.
1688
+ *
1689
+ * @param data - The input array.
1690
+ * @param item - The item whose rank is to be determined.
1691
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
1692
+ * @returns - The rank of the item in the sorted array in the range [0..data.length]
1693
+ * @signature
1694
+ * P.rankBy(data, item, ...rules)
1695
+ * @example
1696
+ * const DATA = [{ a: 5 }, { a: 1 }, { a: 3 }] as const;
1697
+ * P.rankBy(DATA, 0, P.prop('a')) // => 0
1698
+ * P.rankBy(DATA, 1, P.prop('a')) // => 1
1699
+ * P.rankBy(DATA, 2, P.prop('a')) // => 1
1700
+ * P.rankBy(DATA, 3, P.prop('a')) // => 2
1701
+ * @dataFirst
1702
+ * @category Array
1703
+ */
1704
+ declare function rankBy<T>(data: ReadonlyArray<T>, item: T, ...rules: Readonly<NonEmptyArray<OrderRule<T>>>): number;
1705
+ /**
1706
+ * Calculates the rank of an item in an array based on `rules`. The rank is the position where the item would appear in the sorted array. This function provides an efficient way to determine the rank in *O(n)* time, compared to *O(nlogn)* for the equivalent `sortedIndex(sortBy(data, ...rules), item)`.
1707
+ *
1708
+ * @param data - The input array.
1709
+ * @param item - The item whose rank is to be determined.
1710
+ * @param rules - A variadic array of order rules defining the sorting criteria. Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
1711
+ * @returns - The rank of the item in the sorted array in the range [0..data.length]
1712
+ * @signature
1713
+ * P.rankBy(item, ...rules)(data)
1714
+ * @example
1715
+ * const DATA = [{ a: 5 }, { a: 1 }, { a: 3 }] as const;
1716
+ * P.pipe(DATA, P.rankBy(0, P.prop('a'))) // => 0
1717
+ * P.pipe(DATA, P.rankBy(1, P.prop('a'))) // => 1
1718
+ * P.pipe(DATA, P.rankBy(2, P.prop('a'))) // => 1
1719
+ * P.pipe(DATA, P.rankBy(3, P.prop('a'))) // => 2
1720
+ * @dataLast
1721
+ * @category Array
1722
+ */
1723
+ declare function rankBy<T>(item: T, ...rules: Readonly<NonEmptyArray<OrderRule<T>>>): (data: ReadonlyArray<T>) => number;
1724
+
1364
1725
  /**
1365
1726
  * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
1366
1727
  * @param items the array to reduce
@@ -1430,9 +1791,9 @@ declare function reject<T>(fn: Pred<T, boolean>): (items: ReadonlyArray<T>) => A
1430
1791
  declare namespace reject {
1431
1792
  function indexed<T, K>(array: ReadonlyArray<T>, fn: PredIndexed<T, boolean>): Array<K>;
1432
1793
  function indexed<T, K>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => Array<K>;
1433
- const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>;
1434
- const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<T>) & {
1435
- indexed: true;
1794
+ const lazy: <T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>;
1795
+ const lazyIndexed: (<T>(fn: PredIndexedOptional<T, boolean>) => (value: T, index?: number | undefined, array?: readonly T[] | undefined) => LazyResult<T>) & {
1796
+ readonly indexed: true;
1436
1797
  };
1437
1798
  }
1438
1799
 
@@ -1534,7 +1895,7 @@ declare function shuffle<T>(items: ReadonlyArray<T>): Array<T>;
1534
1895
  */
1535
1896
  declare function shuffle<T>(): (items: ReadonlyArray<T>) => Array<T>;
1536
1897
 
1537
- interface Strict$4 {
1898
+ interface Strict$5 {
1538
1899
  <T extends IterableContainer>(items: T, cmp: (a: T[number], b: T[number]) => number): Sorted<T>;
1539
1900
  <T extends IterableContainer>(cmp: (a: T[number], b: T[number]) => number): (items: T) => Sorted<T>;
1540
1901
  }
@@ -1581,7 +1942,7 @@ declare function sort<T>(items: ReadonlyArray<T>, cmp: (a: T, b: T) => number):
1581
1942
  */
1582
1943
  declare function sort<T>(cmp: (a: T, b: T) => number): (items: ReadonlyArray<T>) => Array<T>;
1583
1944
  declare namespace sort {
1584
- const strict: Strict$4;
1945
+ const strict: Strict$5;
1585
1946
  }
1586
1947
 
1587
1948
  declare const ALL_DIRECTIONS: readonly ["asc", "desc"];
@@ -1596,7 +1957,7 @@ type SortPair<T> = readonly [
1596
1957
  direction: Direction
1597
1958
  ];
1598
1959
  type SortRule<T> = SortPair<T> | SortProjection<T>;
1599
- interface Strict$3 {
1960
+ interface Strict$4 {
1600
1961
  <T extends IterableContainer>(...sortRules: Readonly<NonEmptyArray<SortRule<T[number]>>>): (array: T) => SortedBy<T>;
1601
1962
  <T extends IterableContainer>(array: T, ...sortRules: Readonly<NonEmptyArray<SortRule<T[number]>>>): SortedBy<T>;
1602
1963
  }
@@ -1678,9 +2039,40 @@ declare function sortBy<T>(...sortRules: Readonly<NonEmptyArray<SortRule<T>>>):
1678
2039
  */
1679
2040
  declare function sortBy<T>(array: ReadonlyArray<T>, ...sortRules: Readonly<NonEmptyArray<SortRule<T>>>): Array<T>;
1680
2041
  declare namespace sortBy {
1681
- const strict: Strict$3;
2042
+ const strict: Strict$4;
1682
2043
  }
1683
2044
 
2045
+ /**
2046
+ * Removes elements from an array and, inserts new elements in their place.
2047
+ * @param items the array to splice.
2048
+ * @param start the index from which to start removing elements.
2049
+ * @param deleteCount the number of elements to remove.
2050
+ * @param replacement the elements to insert into the array in place of the deleted elements.
2051
+ * @signature
2052
+ * P.splice(items, start, deleteCount, replacement)
2053
+ * @example
2054
+ * P.splice([1,2,3,4,5,6,7,8], 2, 3, []); //=> [1,2,6,7,8]
2055
+ * P.splice([1,2,3,4,5,6,7,8], 2, 3, [9, 10]); //=> [1,2,9,10,6,7,8]
2056
+ * @dataFirst
2057
+ * @category Array
2058
+ */
2059
+ declare function splice<T>(items: ReadonlyArray<T>, start: number, deleteCount: number, replacement: ReadonlyArray<T>): Array<T>;
2060
+ /**
2061
+ * Removes elements from an array and, inserts new elements in their place.
2062
+ * @param items the array to splice.
2063
+ * @param start the index from which to start removing elements.
2064
+ * @param deleteCount the number of elements to remove.
2065
+ * @param replacement the elements to insert into the array in place of the deleted elements.
2066
+ * @signature
2067
+ * P.splice(start, deleteCount, replacement)(items)
2068
+ * @example
2069
+ * P.pipe([1,2,3,4,5,6,7,8], P.splice(2, 3, [])) // => [1,2,6,7,8]
2070
+ * P.pipe([1,2,3,4,5,6,7,8], P.splice(2, 3, [9, 10])) // => [1,2,9,10,6,7,8]
2071
+ * @dataLast
2072
+ * @category Array
2073
+ */
2074
+ declare function splice<T>(start: number, deleteCount: number, replacement: ReadonlyArray<T>): (items: ReadonlyArray<T>) => Array<T>;
2075
+
1684
2076
  /**
1685
2077
  * Splits a given array at a given index.
1686
2078
  * @param array the array to split
@@ -1863,6 +2255,47 @@ declare namespace take {
1863
2255
  function lazy<T>(n: number): (value: T) => LazyResult<T>;
1864
2256
  }
1865
2257
 
2258
+ /**
2259
+ * Take the first `n` items from `data` based on the provided ordering criteria.
2260
+ * This allows you to avoid sorting the array before taking the items.
2261
+ * The complexity of this function is *O(Nlogn)* where `N` is the length of the array.
2262
+ *
2263
+ * For the opposite operation (to drop `n` elements) see `dropFirstBy`.
2264
+ *
2265
+ * @params data - the input array
2266
+ * @params n - the number of items to take. If `n` is non-positive no items would be returned, if `n` is bigger then data.length a *clone* of `data` would be returned.
2267
+ * @param rules - A variadic array of order rules defining the sorting criteria.
2268
+ * Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
2269
+ * @returns a subset of the input array.
2270
+ * @signature
2271
+ * P.takeFirstBy(data, n, ...rules);
2272
+ * @example
2273
+ * P.takeFirstBy(['aa', 'aaaa', 'a', 'aaa'], 2, x => x.length); // => ['a', 'aa']
2274
+ * @dataFirst
2275
+ * @category Array
2276
+ */
2277
+ declare function takeFirstBy<T>(data: ReadonlyArray<T>, n: number, ...rules: Readonly<NonEmptyArray<OrderRule<T>>>): Array<T>;
2278
+ /**
2279
+ * Take the first `n` items from `data` based on the provided ordering criteria.
2280
+ * This allows you to avoid sorting the array before taking the items.
2281
+ * The complexity of this function is *O(Nlogn)* where `N` is the length of the array.
2282
+ *
2283
+ * For the opposite operation (to drop `n` elements) see `dropFirstBy`.
2284
+ *
2285
+ * @params data - the input array
2286
+ * @params n - the number of items to take. If `n` is non-positive no items would be returned, if `n` is bigger then data.length a *clone* of `data` would be returned.
2287
+ * @param rules - A variadic array of order rules defining the sorting criteria.
2288
+ * Each order rule is a projection function that extracts a comparable value from the data. Sorting is based on these extracted values using the native `<` and `>` operators. Earlier rules take precedence over later ones. Use the syntax `[projection, "desc"]` for descending order.
2289
+ * @returns a subset of the input array.
2290
+ * @signature
2291
+ * P.takeFirstBy(n, ...rules)(data);
2292
+ * @example
2293
+ * R.pipe(['aa', 'aaaa', 'a', 'aaa'], P.takeFirstBy(2, x => x.length)); // => ['a', 'aa']
2294
+ * @dataLast
2295
+ * @category Array
2296
+ */
2297
+ declare function takeFirstBy<T>(n: number, ...rules: Readonly<NonEmptyArray<OrderRule<T>>>): (data: ReadonlyArray<T>) => Array<T>;
2298
+
1866
2299
  /**
1867
2300
  * Returns elements from the array until predicate returns false.
1868
2301
  * @param array the array
@@ -1907,7 +2340,7 @@ declare function takeWhile<T>(fn: (item: T) => boolean): (array: ReadonlyArray<T
1907
2340
  declare function uniq<T>(array: ReadonlyArray<T>): Array<T>;
1908
2341
  declare function uniq<T>(): (array: ReadonlyArray<T>) => Array<T>;
1909
2342
  declare namespace uniq {
1910
- function lazy(): (value: any) => LazyResult<any>;
2343
+ function lazy<T>(): (value: T) => LazyResult<T>;
1911
2344
  }
1912
2345
 
1913
2346
  declare function uniqBy<T, K>(array: ReadonlyArray<T>, transformer: (item: T) => K): Array<T>;
@@ -1933,7 +2366,7 @@ declare function uniqBy<T, K>(array: ReadonlyArray<T>, transformer: (item: T) =>
1933
2366
  declare function uniqBy<T, K>(transformer: (item: T) => K): (array: ReadonlyArray<T>) => Array<T>;
1934
2367
 
1935
2368
  type IsEquals<T> = (a: T, b: T) => boolean;
1936
- declare function _lazy<T>(isEquals: IsEquals<T>): (value: T, index?: number, array?: Array<T>) => LazyResult<T>;
2369
+ declare function _lazy<T>(isEquals: IsEquals<T>): (value: T, index?: number, array?: ReadonlyArray<T>) => LazyResult<T>;
1937
2370
  /**
1938
2371
  * Returns a new array containing only one copy of each element in the original list.
1939
2372
  * Elements are compared by custom comparator isEquals.
@@ -1970,11 +2403,11 @@ declare function uniqWith<T>(array: ReadonlyArray<T>, isEquals: IsEquals<T>): Ar
1970
2403
  declare function uniqWith<T>(isEquals: IsEquals<T>): (array: ReadonlyArray<T>) => Array<T>;
1971
2404
  declare namespace uniqWith {
1972
2405
  const lazy: typeof _lazy & {
1973
- indexed: true;
2406
+ readonly indexed: true;
1974
2407
  };
1975
2408
  }
1976
2409
 
1977
- interface Strict$2 {
2410
+ interface Strict$3 {
1978
2411
  <F extends IterableContainer, S extends IterableContainer>(first: F, second: S): Zip<F, S>;
1979
2412
  <S extends IterableContainer>(second: S): <F extends IterableContainer>(first: F) => Zip<F, S>;
1980
2413
  }
@@ -2021,7 +2454,7 @@ declare function zip<F, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): A
2021
2454
  */
2022
2455
  declare function zip<S>(second: ReadonlyArray<S>): <F>(first: ReadonlyArray<F>) => Array<[F, S]>;
2023
2456
  declare namespace zip {
2024
- const strict: Strict$2;
2457
+ const strict: Strict$3;
2025
2458
  }
2026
2459
 
2027
2460
  /**
@@ -2050,6 +2483,7 @@ declare function zipObj<F extends number | string | symbol, S>(first: ReadonlyAr
2050
2483
  */
2051
2484
  declare function zipObj<S>(second: ReadonlyArray<S>): <F extends number | string | symbol>(first: ReadonlyArray<F>) => Record<F, S>;
2052
2485
 
2486
+ type ZippingFunction<F = unknown, S = unknown, R = unknown> = (f: F, s: S) => R;
2053
2487
  /**
2054
2488
  * Creates a new list from two supplied lists by calling the supplied function
2055
2489
  * with the same-positioned element from each list.
@@ -2063,7 +2497,7 @@ declare function zipObj<S>(second: ReadonlyArray<S>): <F extends number | string
2063
2497
  * @dataFirst
2064
2498
  * @category Array
2065
2499
  */
2066
- declare function zipWith<F, S, R>(first: Array<F>, second: Array<S>, fn: (f: F, s: S) => R): Array<R>;
2500
+ declare function zipWith<F, S, R>(first: ReadonlyArray<F>, second: ReadonlyArray<S>, fn: ZippingFunction<F, S, R>): Array<R>;
2067
2501
  /**
2068
2502
  * Creates a new list from two supplied lists by calling the supplied function
2069
2503
  * with the same-positioned element from each list.
@@ -2075,7 +2509,7 @@ declare function zipWith<F, S, R>(first: Array<F>, second: Array<S>, fn: (f: F,
2075
2509
  * @dataLast
2076
2510
  * @category Array
2077
2511
  */
2078
- declare function zipWith<F, S, R>(fn: (f: F, s: S) => R): (first: Array<F>, second: Array<S>) => Array<R>;
2512
+ declare function zipWith<F, S, R>(fn: ZippingFunction<F, S, R>): (first: ReadonlyArray<F>, second: ReadonlyArray<S>) => Array<R>;
2079
2513
  /**
2080
2514
  * Creates a new list from two supplied lists by calling the supplied function
2081
2515
  * with the same-positioned element from each list.
@@ -2088,7 +2522,114 @@ declare function zipWith<F, S, R>(fn: (f: F, s: S) => R): (first: Array<F>, seco
2088
2522
  * @dataLast
2089
2523
  * @category Array
2090
2524
  */
2091
- declare function zipWith<F, S, R>(fn: (f: F, s: S) => R, second: Array<S>): (first: Array<F>) => Array<R>;
2525
+ declare function zipWith<F, S, R>(fn: ZippingFunction<F, S, R>, second: ReadonlyArray<S>): (first: ReadonlyArray<F>) => Array<R>;
2526
+
2527
+ type Case<In, Out, Thru extends In = In> = readonly [
2528
+ when: ((data: In) => boolean) | ((data: In) => data is Thru),
2529
+ then: (data: Thru) => Out
2530
+ ];
2531
+ /**
2532
+ * Executes a transformer function based on the first matching predicate,
2533
+ * functioning like a series of `if...else if...` statements. It sequentially
2534
+ * evaluates each case and, upon finding a truthy predicate, runs the
2535
+ * corresponding transformer, and returns, ignoring any further cases, even if
2536
+ * they would match.
2537
+ *
2538
+ * !IMPORTANT! - Unlike similar implementations in frameworks like Lodash and
2539
+ * Ramda, this implementation does **NOT** return a default/fallback
2540
+ * `undefined` value when none of the cases match; and instead will **throw** an
2541
+ * exception in those cases.
2542
+ * To add a default case use the `conditional.defaultCase` helper as the final
2543
+ * case of your implementation. By default it returns `undefined`, but could be
2544
+ * provided a transformer in order to return something else.
2545
+ *
2546
+ * Due to TypeScript's inability to infer the result of negating a type-
2547
+ * predicate we can't refine the types used in subsequent cases based on
2548
+ * previous conditions. Using a `switch (true)` statement or ternary operators
2549
+ * is recommended for more precise type control when such type narrowing is
2550
+ * needed.
2551
+ *
2552
+ * @param data - The input data to be evaluated against the provided cases.
2553
+ * @param cases - A list of (up to 10) tuples, each defining a case. Each tuple
2554
+ * consists of a predicate (or a type-predicate) and a transformer function that
2555
+ * processes the data if its case matches.
2556
+ * @returns The output of the matched transformer. If no cases match, an
2557
+ * exception is thrown. The return type is a union of the return types of all
2558
+ * provided transformers.
2559
+ * @signature
2560
+ * P.conditional(...cases)(data);
2561
+ * @example
2562
+ * const nameOrId = 3 as string | number;
2563
+ * P.pipe(
2564
+ * nameOrId,
2565
+ * P.conditional(
2566
+ * [P.isString, (name) => `Hello ${name}`],
2567
+ * [P.isNumber, (id) => `Hello ID: ${id}`],
2568
+ * P.conditional.defaultCase(
2569
+ * (something) => `Hello something (${JSON.stringify(something)})`,
2570
+ * ),
2571
+ * ),
2572
+ * ); //=> 'Hello ID: 3'
2573
+ * @dataLast
2574
+ * @category Function
2575
+ */
2576
+ declare function conditional<T, Return0, Return1 = never, Return2 = never, Return3 = never, Return4 = never, Return5 = never, Return6 = never, Return7 = never, Return8 = never, Return9 = never, Thru0 extends T = T, Thru1 extends T = T, Thru2 extends T = T, Thru3 extends T = T, Thru4 extends T = T, Thru5 extends T = T, Thru6 extends T = T, Thru7 extends T = T, Thru8 extends T = T, Thru9 extends T = T>(case0: Case<T, Return0, Thru0>, case1?: Case<T, Return1, Thru1>, case2?: Case<T, Return2, Thru2>, case3?: Case<T, Return3, Thru3>, case4?: Case<T, Return4, Thru4>, case5?: Case<T, Return5, Thru5>, case6?: Case<T, Return6, Thru6>, case7?: Case<T, Return7, Thru7>, case8?: Case<T, Return8, Thru8>, case9?: Case<T, Return9, Thru9>): (data: T) => Return0 | Return1 | Return2 | Return3 | Return4 | Return5 | Return6 | Return7 | Return8 | Return9;
2577
+ /**
2578
+ * Executes a transformer function based on the first matching predicate,
2579
+ * functioning like a series of `if...else if...` statements. It sequentially
2580
+ * evaluates each case and, upon finding a truthy predicate, runs the
2581
+ * corresponding transformer, and returns, ignoring any further cases, even if
2582
+ * they would match.
2583
+ *
2584
+ * !IMPORTANT! - Unlike similar implementations in frameworks like Lodash and
2585
+ * Ramda, this implementation does **NOT** return a default/fallback
2586
+ * `undefined` value when none of the cases match; and instead will **throw** an
2587
+ * exception in those cases.
2588
+ * To add a default case use the `conditional.defaultCase` helper as the final
2589
+ * case of your implementation. By default it returns `undefined`, but could be
2590
+ * provided a transformer in order to return something else.
2591
+ *
2592
+ * Due to TypeScript's inability to infer the result of negating a type-
2593
+ * predicate we can't refine the types used in subsequent cases based on
2594
+ * previous conditions. Using a `switch (true)` statement or ternary operators
2595
+ * is recommended for more precise type control when such type narrowing is
2596
+ * needed.
2597
+ *
2598
+ * @param data - The input data to be evaluated against the provided cases.
2599
+ * @param cases - A list of (up to 10) tuples, each defining a case. Each tuple
2600
+ * consists of a predicate (or a type-predicate) and a transformer function that
2601
+ * processes the data if its case matches.
2602
+ * @returns The output of the matched transformer. If no cases match, an
2603
+ * exception is thrown. The return type is a union of the return types of all
2604
+ * provided transformers.
2605
+ * @signature
2606
+ * P.conditional(data, ...cases);
2607
+ * @example
2608
+ * const nameOrId = 3 as string | number;
2609
+ * P.conditional(
2610
+ * nameOrId,
2611
+ * [P.isString, (name) => `Hello ${name}`],
2612
+ * [P.isNumber, (id) => `Hello ID: ${id}`],
2613
+ * P.conditional.defaultCase(
2614
+ * (something) => `Hello something (${JSON.stringify(something)})`,
2615
+ * ),
2616
+ * ); //=> 'Hello ID: 3'
2617
+ * @dataFirst
2618
+ * @category Function
2619
+ */
2620
+ declare function conditional<T, Return0, Return1 = never, Return2 = never, Return3 = never, Return4 = never, Return5 = never, Return6 = never, Return7 = never, Return8 = never, Return9 = never, Thru0 extends T = T, Thru1 extends T = T, Thru2 extends T = T, Thru3 extends T = T, Thru4 extends T = T, Thru5 extends T = T, Thru6 extends T = T, Thru7 extends T = T, Thru8 extends T = T, Thru9 extends T = T>(data: T, case0: Case<T, Return0, Thru0>, case1?: Case<T, Return1, Thru1>, case2?: Case<T, Return2, Thru2>, case3?: Case<T, Return3, Thru3>, case4?: Case<T, Return4, Thru4>, case5?: Case<T, Return5, Thru5>, case6?: Case<T, Return6, Thru6>, case7?: Case<T, Return7, Thru7>, case8?: Case<T, Return8, Thru8>, case9?: Case<T, Return9, Thru9>): Return0 | Return1 | Return2 | Return3 | Return4 | Return5 | Return6 | Return7 | Return8 | Return9;
2621
+ declare namespace conditional {
2622
+ /**
2623
+ * A simplified case that accepts all data. Put this as the last case to
2624
+ * prevent an exception from being thrown when none of the previous cases
2625
+ * match.
2626
+ * If this is not the last case it will short-circuit anything after it.
2627
+ * @param then - You only need to provide the transformer, the predicate is
2628
+ * implicit. @default () => undefined, which is how Lodash and Ramda handle
2629
+ * the final fallback case.
2630
+ */
2631
+ function defaultCase<In>(then?: (data: In) => unknown): readonly [() => boolean, (data: In) => unknown];
2632
+ }
2092
2633
 
2093
2634
  /**
2094
2635
  * Creates a data-last pipe function. First function must be always annotated. Other functions are automatically inferred.
@@ -2309,7 +2850,6 @@ declare function purry(fn: any, args: IArguments | ReadonlyArray<any>, lazy?: an
2309
2850
  */
2310
2851
  declare function sleep(timeout: number): Promise<void>;
2311
2852
 
2312
- type DefinitelyArray<T> = Extract<T, Array<any> | ReadonlyArray<any>> extends never ? ReadonlyArray<unknown> : Extract<T, Array<any> | ReadonlyArray<any>>;
2313
2853
  /**
2314
2854
  * A function that checks if the passed parameter is an Array and narrows its type accordingly
2315
2855
  * @param data the variable to check
@@ -2322,9 +2862,8 @@ type DefinitelyArray<T> = Extract<T, Array<any> | ReadonlyArray<any>> extends ne
2322
2862
  * P.isArray('somethingElse') //=> false
2323
2863
  * @category Guard
2324
2864
  */
2325
- declare function isArray<T>(data: ReadonlyArray<unknown> | T): data is DefinitelyArray<T>;
2865
+ declare function isArray<T>(data: ReadonlyArray<unknown> | T): data is NarrowedTo<T, ReadonlyArray<unknown>>;
2326
2866
 
2327
- type DefinitelyBoolean<T> = Extract<T, boolean> extends never ? boolean : Extract<T, boolean> extends any ? boolean : Extract<T, number>;
2328
2867
  /**
2329
2868
  * A function that checks if the passed parameter is a boolean and narrows its type accordingly
2330
2869
  * @param data the variable to check
@@ -2337,7 +2876,7 @@ type DefinitelyBoolean<T> = Extract<T, boolean> extends never ? boolean : Extrac
2337
2876
  * P.isBoolean('somethingElse') //=> false
2338
2877
  * @category Guard
2339
2878
  */
2340
- declare function isBoolean<T>(data: T | boolean): data is DefinitelyBoolean<T>;
2879
+ declare function isBoolean<T>(data: T | boolean): data is NarrowedTo<T, boolean>;
2341
2880
 
2342
2881
  /**
2343
2882
  * A function that checks if the passed parameter is a Date and narrows its type accordingly
@@ -2465,36 +3004,45 @@ declare function isNonNull<T>(data: T | null): data is T;
2465
3004
  declare function isNot<T, S extends T>(predicate: (data: T) => data is S): (data: T) => data is Exclude<T, S>;
2466
3005
  declare function isNot<T>(predicate: (data: T) => any): (data: T) => boolean;
2467
3006
 
2468
- type DefinitelyNumber<T> = Extract<T, number> extends never ? number : Extract<T, number> extends any ? number : Extract<T, number>;
2469
3007
  /**
2470
3008
  * A function that checks if the passed parameter is a number and narrows its type accordingly
2471
3009
  * @param data the variable to check
2472
3010
  * @signature
2473
- * R.isNumber(data)
3011
+ * P.isNumber(data)
2474
3012
  * @returns true if the passed input is a number, false otherwise
2475
3013
  * @example
2476
- * R.isNumber(1) //=> true
2477
- * R.isNumber('notANumber') //=> false
3014
+ * P.isNumber(1) //=> true
3015
+ * P.isNumber('notANumber') //=> false
2478
3016
  * @category Guard
2479
3017
  */
2480
- declare function isNumber<T>(data: T | number): data is DefinitelyNumber<T>;
3018
+ declare function isNumber<T>(data: T | number): data is NarrowedTo<T, number>;
2481
3019
 
2482
- type DefinitelyObject<T> = Exclude<Extract<T, object>, Array<any> | Function | ReadonlyArray<any>> extends never ? Record<string, unknown> : Exclude<Extract<T, object>, Array<any> | Function | ReadonlyArray<any>>;
2483
3020
  /**
2484
- * A function that checks if the passed parameter is of type Object and narrows its type accordingly
2485
- * @param data the variable to check
3021
+ * Checks if `data` is a "plain" object. A plain object is defined as an object with string keys and values of any type, including primitives, other objects, functions, classes, etc (aka struct/shape/record/simple). Technically, a plain object is one whose prototype is either `Object.prototype` or `null`, ensuring it does not inherit properties or methods from other object types.
3022
+ *
3023
+ * This function is narrower in scope than `isObjectType`, which accepts any entity considered an `"object"` by JavaScript's `typeof`.
3024
+ *
3025
+ * Note that Maps, Arrays, and Sets are not considered plain objects and would return `false`.
3026
+ *
3027
+ * @param data - The variable to check.
3028
+ * @returns - The input type, narrowed to only plain objects.
2486
3029
  * @signature
2487
3030
  * P.isObject(data)
2488
- * @returns true if the passed input is an Object, Promise, Date or Error, false otherwise
2489
3031
  * @example
3032
+ * // true
2490
3033
  * P.isObject({}) //=> true
2491
- * P.isObject(Promise.resolve("something")) //=> true
2492
- * P.isObject(new Date()) //=> true
2493
- * P.isObject(new Error("error")) //=> true
3034
+ * P.isObject({ a: 123 }) //=> true
3035
+ *
3036
+ * // false
3037
+ * P.isObject([]) //=> false
3038
+ * P.isObject(Promise.resolve("something")) //=> false
3039
+ * P.isObject(new Date()) //=> false
3040
+ * P.isObject(new Error("error")) //=> false
2494
3041
  * P.isObject('somethingElse') //=> false
3042
+ * P.isObject(null) //=> false
2495
3043
  * @category Guard
2496
3044
  */
2497
- declare function isObject<T>(data: T | object): data is DefinitelyObject<T>;
3045
+ declare function isObject<T>(data: Record<PropertyKey, unknown> | T): data is NarrowedTo<T, Record<PropertyKey, unknown>>;
2498
3046
 
2499
3047
  /**
2500
3048
  * A function that checks if the passed parameter is a Promise and narrows its type accordingly
@@ -2510,7 +3058,6 @@ declare function isObject<T>(data: T | object): data is DefinitelyObject<T>;
2510
3058
  */
2511
3059
  declare function isPromise<T, S>(data: Promise<T> | S): data is Promise<T>;
2512
3060
 
2513
- type DefinitelyString<T> = Extract<T, string> extends never ? string : Extract<T, string> extends any ? string : Extract<T, string>;
2514
3061
  /**
2515
3062
  * A function that checks if the passed parameter is a string and narrows its type accordingly
2516
3063
  * @param data the variable to check
@@ -2522,7 +3069,20 @@ type DefinitelyString<T> = Extract<T, string> extends never ? string : Extract<T
2522
3069
  * P.isString(1) //=> false
2523
3070
  * @category Guard
2524
3071
  */
2525
- declare function isString<T>(data: T | string): data is DefinitelyString<T>;
3072
+ declare function isString<T>(data: T | string): data is NarrowedTo<T, string>;
3073
+
3074
+ /**
3075
+ * A function that checks if the passed parameter is a symbol and narrows its type accordingly
3076
+ * @param data the variable to check
3077
+ * @signature
3078
+ * P.isSymbol(data)
3079
+ * @returns true if the passed input is a symbol, false otherwise
3080
+ * @example
3081
+ * P.isSymbol(Symbol('foo')) //=> true
3082
+ * P.isSymbol(1) //=> false
3083
+ * @category Guard
3084
+ */
3085
+ declare function isSymbol<T>(data: T | symbol): data is NarrowedTo<T, symbol>;
2526
3086
 
2527
3087
  /**
2528
3088
  * A function that checks if the passed parameter is truthy and narrows its type accordingly
@@ -2541,6 +3101,70 @@ declare function isString<T>(data: T | string): data is DefinitelyString<T>;
2541
3101
  */
2542
3102
  declare function isTruthy<T>(data: T): data is Exclude<T, '' | 0 | false | null | undefined>;
2543
3103
 
3104
+ /**
3105
+ * Adds two numbers.
3106
+ * @param value The number.
3107
+ * @param addend The number to add to the value.
3108
+ * @signature
3109
+ * P.add(value, addend);
3110
+ * @example
3111
+ * P.add(10, 5) // => 15
3112
+ * P.add(10, -5) // => 5
3113
+ * P.reduce([1, 2, 3, 4], P.add, 0) // => 10
3114
+ * @dataFirst
3115
+ * @category Number
3116
+ */
3117
+ declare function add(value: number, addend: number): number;
3118
+ /**
3119
+ * Adds two numbers.
3120
+ * @param value The number.
3121
+ * @param addend The number to add to the value.
3122
+ * @signature
3123
+ * P.add(addend)(value);
3124
+ * @example
3125
+ * P.add(5)(10) // => 15
3126
+ * P.add(-5)(10) // => 5
3127
+ * P.map([1, 2, 3, 4], P.add(1)) // => [2, 3, 4, 5]
3128
+ * @dataLast
3129
+ * @category Number
3130
+ */
3131
+ declare function add(addend: number): (value: number) => number;
3132
+
3133
+ /**
3134
+ * Rounds up a given number to a specific precision.
3135
+ * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),
3136
+ * use `Math.ceil` instead, as it won't incur the additional library overhead.
3137
+ * @param value The number to round up.
3138
+ * @param precision The precision to round up to. Must be an integer between -15 and 15.
3139
+ * @signature
3140
+ * P.ceil(value, precision);
3141
+ * @example
3142
+ * P.ceil(123.9876, 3) // => 123.988
3143
+ * P.ceil(483.22243, 1) // => 483.3
3144
+ * P.ceil(8541, -1) // => 8550
3145
+ * P.ceil(456789, -3) // => 457000
3146
+ * @dataFirst
3147
+ * @category Number
3148
+ */
3149
+ declare function ceil(value: number, precision: number): number;
3150
+ /**
3151
+ * Rounds up a given number to a specific precision.
3152
+ * If you'd like to round up to an integer (i.e. use this function with constant `precision === 0`),
3153
+ * use `Math.ceil` instead, as it won't incur the additional library overhead.
3154
+ * @param value The number to round up.
3155
+ * @param precision The precision to round up to. Must be an integer between -15 and 15.
3156
+ * @signature
3157
+ * P.ceil(precision)(value);
3158
+ * @example
3159
+ * P.ceil(3)(123.9876) // => 123.988
3160
+ * P.ceil(1)(483.22243) // => 483.3
3161
+ * P.ceil(-1)(8541) // => 8550
3162
+ * P.ceil(-3)(456789) // => 457000
3163
+ * @dataLast
3164
+ * @category Number
3165
+ */
3166
+ declare function ceil(precision: number): (value: number) => number;
3167
+
2544
3168
  /**
2545
3169
  * Clamp the given value within the inclusive min and max bounds.
2546
3170
  * @param value the number
@@ -2579,6 +3203,159 @@ declare function clamp(limits: {
2579
3203
  min?: number;
2580
3204
  }): (value: number) => number;
2581
3205
 
3206
+ /**
3207
+ * Divides two numbers.
3208
+ * @param value The number.
3209
+ * @param divisor The number to divide the value by.
3210
+ * @signature
3211
+ * P.divide(value, divisor);
3212
+ * @example
3213
+ * P.divide(12, 3) // => 4
3214
+ * P.reduce([1, 2, 3, 4], P.divide, 24) // => 1
3215
+ * @dataFirst
3216
+ * @category Number
3217
+ */
3218
+ declare function divide(value: number, divisor: number): number;
3219
+ /**
3220
+ * Divides two numbers.
3221
+ * @param value The number.
3222
+ * @param divisor The number to divide the value by.
3223
+ * @signature
3224
+ * P.divide(divisor)(value);
3225
+ * @example
3226
+ * P.divide(3)(12) // => 4
3227
+ * P.map([2, 4, 6, 8], P.divide(2)) // => [1, 2, 3, 4]
3228
+ * @dataLast
3229
+ * @category Number
3230
+ */
3231
+ declare function divide(divisor: number): (value: number) => number;
3232
+
3233
+ /**
3234
+ * Rounds down a given number to a specific precision.
3235
+ * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),
3236
+ * use `Math.floor` instead, as it won't incur the additional library overhead.
3237
+ * @param value The number to round down.
3238
+ * @param precision The precision to round down to. Must be an integer between -15 and 15.
3239
+ * @signature
3240
+ * P.floor(value, precision);
3241
+ * @example
3242
+ * P.floor(123.9876, 3) // => 123.987
3243
+ * P.floor(483.22243, 1) // => 483.2
3244
+ * P.floor(8541, -1) // => 8540
3245
+ * P.floor(456789, -3) // => 456000
3246
+ * @dataFirst
3247
+ * @category Number
3248
+ */
3249
+ declare function floor(value: number, precision: number): number;
3250
+ /**
3251
+ * Rounds down a given number to a specific precision.
3252
+ * If you'd like to round down to an integer (i.e. use this function with constant `precision === 0`),
3253
+ * use `Math.floor` instead, as it won't incur the additional library overhead.
3254
+ * @param value The number to round down.
3255
+ * @param precision The precision to round down to. Must be an integer between -15 and 15.
3256
+ * @signature
3257
+ * P.floor(precision)(value);
3258
+ * @example
3259
+ * P.floor(3)(123.9876) // => 123.987
3260
+ * P.floor(1)(483.22243) // => 483.2
3261
+ * P.floor(-1)(8541) // => 8540
3262
+ * P.floor(-3)(456789) // => 456000
3263
+ * @dataLast
3264
+ * @category Number
3265
+ */
3266
+ declare function floor(precision: number): (value: number) => number;
3267
+
3268
+ /**
3269
+ * Multiplies two numbers.
3270
+ * @param value The number.
3271
+ * @param multiplicand The number to multiply the value by.
3272
+ * @signature
3273
+ * P.multiply(value, multiplicand);
3274
+ * @example
3275
+ * P.multiply(3, 4) // => 12
3276
+ * P.reduce([1, 2, 3, 4], P.multiply, 1) // => 24
3277
+ * @dataFirst
3278
+ * @category Number
3279
+ */
3280
+ declare function multiply(value: number, multiplicand: number): number;
3281
+ /**
3282
+ * Multiplies two numbers.
3283
+ * @param value The number.
3284
+ * @param multiplicand The number to multiply the value by.
3285
+ * @signature
3286
+ * P.multiply(multiplicand)(value);
3287
+ * @example
3288
+ * P.multiply(4)(3) // => 12
3289
+ * P.map([1, 2, 3, 4], P.multiply(2)) // => [2, 4, 6, 8]
3290
+ * @dataLast
3291
+ * @category Number
3292
+ */
3293
+ declare function multiply(multiplicand: number): (value: number) => number;
3294
+
3295
+ /**
3296
+ * Rounds a given number to a specific precision.
3297
+ * If you'd like to round to an integer (i.e. use this function with constant `precision === 0`),
3298
+ * use `Math.round` instead, as it won't incur the additional library overhead.
3299
+ * @param value The number to round.
3300
+ * @param precision The precision to round to. Must be an integer between -15 and 15.
3301
+ * @signature
3302
+ * P.round(value, precision);
3303
+ * @example
3304
+ * P.round(123.9876, 3) // => 123.988
3305
+ * P.round(483.22243, 1) // => 483.2
3306
+ * P.round(8541, -1) // => 8540
3307
+ * P.round(456789, -3) // => 457000
3308
+ * @dataFirst
3309
+ * @category Number
3310
+ */
3311
+ declare function round(value: number, precision: number): number;
3312
+ /**
3313
+ * Rounds a given number to a specific precision.
3314
+ * If you'd like to round to an integer (i.e. use this function with constant `precision === 0`),
3315
+ * use `Math.round` instead, as it won't incur the additional library overhead.
3316
+ * @param value The number to round.
3317
+ * @param precision The precision to round to. Must be an integer between -15 and 15.
3318
+ * @signature
3319
+ * P.round(precision)(value);
3320
+ * @example
3321
+ * P.round(3)(123.9876) // => 123.988
3322
+ * P.round(1)(483.22243) // => 483.2
3323
+ * P.round(-1)(8541) // => 8540
3324
+ * P.round(-3)(456789) // => 457000
3325
+ * @dataLast
3326
+ * @category Number
3327
+ */
3328
+ declare function round(precision: number): (value: number) => number;
3329
+
3330
+ /**
3331
+ * Subtracts two numbers.
3332
+ * @param value The number.
3333
+ * @param subtrahend The number to subtract from the value.
3334
+ * @signature
3335
+ * P.subtract(value, subtrahend);
3336
+ * @example
3337
+ * P.subtract(10, 5) // => 5
3338
+ * P.subtract(10, -5) // => 15
3339
+ * R.reduce([1, 2, 3, 4], P.subtract, 20) // => 10
3340
+ * @dataFirst
3341
+ * @category Number
3342
+ */
3343
+ declare function subtract(value: number, subtrahend: number): number;
3344
+ /**
3345
+ * Subtracts two numbers.
3346
+ * @param value The number.
3347
+ * @param subtrahend The number to subtract from the value.
3348
+ * @signature
3349
+ * P.subtract(subtrahend)(value);
3350
+ * @example
3351
+ * P.subtract(5)(10) // => 5
3352
+ * P.subtract(-5)(10) // => 15
3353
+ * P.map([1, 2, 3, 4], P.subtract(1)) // => [0, 1, 2, 3]
3354
+ * @dataLast
3355
+ * @category Number
3356
+ */
3357
+ declare function subtract(subtrahend: number): (value: number) => number;
3358
+
2582
3359
  /**
2583
3360
  * Add a new property to an object.
2584
3361
  * @param obj the target object
@@ -2695,7 +3472,7 @@ type Entry<Key extends PropertyKey = PropertyKey, Value = unknown> = readonly [
2695
3472
  key: Key,
2696
3473
  value: Value
2697
3474
  ];
2698
- type Strict$1 = <Entries extends IterableContainer<Entry>>(entries: Entries) => StrictOut<Entries>;
3475
+ type Strict$2 = <Entries extends IterableContainer<Entry>>(entries: Entries) => StrictOut<Entries>;
2699
3476
  type StrictOut<Entries> = Entries extends readonly [infer First, ...infer Tail] ? FromPairsTuple<First, Tail> : Entries extends readonly [...infer Head, infer Last] ? FromPairsTuple<Last, Head> : Entries extends IterableContainer<Entry> ? FromPairsArray<Entries> : 'ERROR: Entries array-like could not be infered';
2700
3477
  type FromPairsTuple<E, Rest> = E extends Entry ? Record<E[0], E[1]> & StrictOut<Rest> : 'ERROR: Array-like contains a non-entry element';
2701
3478
  type FromPairsArray<Entries extends IterableContainer<Entry>> = string extends AllKeys$1<Entries> ? Record<string, Entries[number][1]> : number extends AllKeys$1<Entries> ? Record<number, Entries[number][1]> : symbol extends AllKeys$1<Entries> ? Record<symbol, Entries[number][1]> : FromPairsArrayWithLiteralKeys<Entries>;
@@ -2724,7 +3501,7 @@ type ValueForKey<Entries extends IterableContainer<Entry>, K extends PropertyKey
2724
3501
  declare function fromPairs<V>(pairs: ReadonlyArray<Entry<number, V>>): Record<number, V>;
2725
3502
  declare function fromPairs<V>(pairs: ReadonlyArray<Entry<string, V>>): Record<string, V>;
2726
3503
  declare namespace fromPairs {
2727
- const strict: Strict$1;
3504
+ const strict: Strict$2;
2728
3505
  }
2729
3506
 
2730
3507
  type Inverted<T extends object> = T[keyof T] extends PropertyKey ? Record<T[keyof T], keyof T> : never;
@@ -2754,6 +3531,14 @@ declare function invert<T extends object>(object: T): Inverted<T>;
2754
3531
  */
2755
3532
  declare function invert<T extends object>(): (object: T) => Inverted<T>;
2756
3533
 
3534
+ type Strict$1 = <T extends object>(source: T) => Keys<T>;
3535
+ type Keys<T> = T extends IterableContainer ? ArrayKeys<T> : ObjectKeys<T>;
3536
+ type ArrayKeys<T extends IterableContainer> = {
3537
+ -readonly [Index in keyof T]: Index extends number | string ? `${IsIndexAfterSpread<T, Index> extends true ? number : Index}` : never;
3538
+ };
3539
+ type IsIndexAfterSpread<T extends IterableContainer, Index extends number | string> = IndicesAfterSpread<T> extends never ? false : Index extends `${IndicesAfterSpread<T>}` ? true : false;
3540
+ type IndicesAfterSpread<T extends [] | ReadonlyArray<unknown>, Iterations extends ReadonlyArray<unknown> = []> = T[number] extends never ? never : T extends readonly [unknown, ...infer Tail] ? IndicesAfterSpread<Tail, [unknown, ...Iterations]> : T extends readonly [...infer Head, unknown] ? IndicesAfterSpread<Head, [unknown, ...Iterations]> | Iterations['length'] : Iterations['length'];
3541
+ type ObjectKeys<T> = T extends Record<PropertyKey, never> ? [] : Array<`${Exclude<keyof T, symbol>}`>;
2757
3542
  /**
2758
3543
  * Returns a new array containing the keys of the array or object.
2759
3544
  * @param source Either an array or an object
@@ -2773,23 +3558,14 @@ declare function invert<T extends object>(): (object: T) => Inverted<T>;
2773
3558
  * @strict
2774
3559
  * @category Object
2775
3560
  */
2776
-
2777
- type Strict = <T extends object>(source: T) => Keys<T>;
2778
- type Keys<T> = T extends IterableContainer ? ArrayKeys<T> : ObjectKeys$1<T>;
2779
- type ArrayKeys<T extends IterableContainer> = {
2780
- -readonly [Index in keyof T]: Index extends number | string ? `${IsIndexAfterSpread<T, Index> extends true ? number : Index}` : never;
2781
- };
2782
- type IsIndexAfterSpread<T extends IterableContainer, Index extends number | string> = IndicesAfterSpread<T> extends never ? false : Index extends `${IndicesAfterSpread<T>}` ? true : false;
2783
- type IndicesAfterSpread<T extends [] | ReadonlyArray<unknown>, Iterations extends ReadonlyArray<unknown> = []> = T[number] extends never ? never : T extends readonly [unknown, ...infer Tail] ? IndicesAfterSpread<Tail, [unknown, ...Iterations]> : T extends readonly [...infer Head, unknown] ? IndicesAfterSpread<Head, [unknown, ...Iterations]> | Iterations['length'] : Iterations['length'];
2784
- type ObjectKeys$1<T> = T extends Record<PropertyKey, never> ? [] : Array<`${Exclude<keyof T, symbol>}`>;
2785
3561
  declare function keys(source: ArrayLike<unknown> | Record<PropertyKey, unknown>): Array<string>;
2786
3562
  declare namespace keys {
2787
- const strict: Strict;
3563
+ const strict: Strict$1;
2788
3564
  }
2789
3565
 
2790
3566
  /**
2791
3567
  * Maps keys of `object` and keeps the same values.
2792
- * @param object the object to map
3568
+ * @param data the object to map
2793
3569
  * @param fn the mapping function
2794
3570
  * @signature
2795
3571
  * P.mapKeys(object, fn)
@@ -2798,7 +3574,7 @@ declare namespace keys {
2798
3574
  * @dataFirst
2799
3575
  * @category Object
2800
3576
  */
2801
- declare function mapKeys<T, S extends keyof any>(object: T, fn: (key: keyof T, value: T[keyof T]) => S): Record<S, T[keyof T]>;
3577
+ declare function mapKeys<T, S extends PropertyKey>(data: T, fn: (key: keyof T, value: Required<T>[keyof T]) => S): Record<S, T[keyof T]>;
2802
3578
  /**
2803
3579
  * Maps keys of `object` and keeps the same values.
2804
3580
  * @param fn the mapping function
@@ -2809,11 +3585,11 @@ declare function mapKeys<T, S extends keyof any>(object: T, fn: (key: keyof T, v
2809
3585
  * @dataLast
2810
3586
  * @category Object
2811
3587
  */
2812
- declare function mapKeys<T, S extends keyof any>(fn: (key: keyof T, value: T[keyof T]) => S): (object: T) => Record<S, T[keyof T]>;
3588
+ declare function mapKeys<T, S extends PropertyKey>(fn: (key: keyof T, value: Required<T>[keyof T]) => S): (data: T) => Record<S, T[keyof T]>;
2813
3589
 
2814
3590
  /**
2815
3591
  * Maps values of `object` and keeps the same keys.
2816
- * @param object the object to map
3592
+ * @param data the object to map
2817
3593
  * @param fn the mapping function
2818
3594
  * @signature
2819
3595
  * P.mapValues(object, fn)
@@ -2822,7 +3598,7 @@ declare function mapKeys<T, S extends keyof any>(fn: (key: keyof T, value: T[key
2822
3598
  * @dataFirst
2823
3599
  * @category Object
2824
3600
  */
2825
- declare function mapValues<T extends Record<PropertyKey, any>, S>(object: T, fn: (value: T[keyof T], key: keyof T) => S): Record<keyof T, S>;
3601
+ declare function mapValues<T extends Record<PropertyKey, unknown>, S>(data: T, fn: (value: T[ObjectKeys$1<T>], key: ObjectKeys$1<T>) => S): Record<ObjectKeys$1<T>, S>;
2826
3602
  /**
2827
3603
  * Maps values of `object` and keeps the same keys.
2828
3604
  * @param fn the mapping function
@@ -2833,7 +3609,7 @@ declare function mapValues<T extends Record<PropertyKey, any>, S>(object: T, fn:
2833
3609
  * @dataLast
2834
3610
  * @category Object
2835
3611
  */
2836
- declare function mapValues<T extends Record<PropertyKey, any>, S>(fn: (value: T[keyof T], key: keyof T) => S): (object: T) => Record<keyof T, S>;
3612
+ declare function mapValues<T extends Record<PropertyKey, unknown>, S>(fn: (value: T[keyof T], key: keyof T) => S): (data: T) => Record<ObjectKeys$1<T>, S>;
2837
3613
 
2838
3614
  /**
2839
3615
  * Merges two objects. The same as `Object.assign`.
@@ -2893,27 +3669,27 @@ declare function mergeDeep<Destination extends Record<string, unknown>, Source e
2893
3669
 
2894
3670
  /**
2895
3671
  * Returns a partial copy of an object omitting the keys specified.
2896
- * @param data the object
2897
3672
  * @param propNames the property names
2898
3673
  * @signature
2899
- * P.omit(obj, names);
3674
+ * P.omit(propNames)(obj);
2900
3675
  * @example
2901
- * P.omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }
2902
- * @dataFirst
3676
+ * P.pipe({ a: 1, b: 2, c: 3, d: 4 }, P.omit(['a', 'd'])) // => { b: 2, c: 3 }
3677
+ * @dataLast
2903
3678
  * @category Object
2904
3679
  */
2905
- declare function omit<T extends object, K extends keyof T>(data: T, propNames: ReadonlyArray<K>): Omit<T, K>;
3680
+ declare function omit<T extends object, K extends keyof T>(propNames: ReadonlyArray<K>): (data: T) => Omit<T, K>;
2906
3681
  /**
2907
3682
  * Returns a partial copy of an object omitting the keys specified.
3683
+ * @param data the object
2908
3684
  * @param propNames the property names
2909
3685
  * @signature
2910
- * P.omit(propNames)(obj);
3686
+ * P.omit(obj, names);
2911
3687
  * @example
2912
- * P.pipe({ a: 1, b: 2, c: 3, d: 4 }, P.omit(['a', 'd'])) // => { b: 2, c: 3 }
2913
- * @dataLast
3688
+ * P.omit({ a: 1, b: 2, c: 3, d: 4 }, ['a', 'd']) // => { b: 2, c: 3 }
3689
+ * @dataFirst
2914
3690
  * @category Object
2915
3691
  */
2916
- declare function omit<T extends object, K extends keyof T>(propNames: ReadonlyArray<K>): (data: T) => Omit<T, K>;
3692
+ declare function omit<T extends object, K extends keyof T>(data: T, propNames: ReadonlyArray<K>): Omit<T, K>;
2917
3693
 
2918
3694
  /**
2919
3695
  * Returns a partial copy of an object omitting the keys matching predicate.
@@ -3222,13 +3998,12 @@ declare function swapProps<T extends object, K1 extends keyof T, K2 extends keyo
3222
3998
  */
3223
3999
  declare function swapProps<T extends object, K1 extends keyof T, K2 extends keyof T>(key1: K1, key2: K2): (data: T) => SwappedProps<T, K1, K2>;
3224
4000
 
3225
- type ObjectKeys<T extends object> = `${Exclude<keyof T, symbol>}`;
3226
- type ObjectValues<T extends Record<PropertyKey, unknown>> = Required<T>[ObjectKeys<T>];
3227
- type ObjectEntry<T extends Record<PropertyKey, unknown>> = [
3228
- ObjectKeys<T>,
3229
- ObjectValues<T>
3230
- ];
3231
- type ObjectEntries<T extends Record<PropertyKey, unknown>> = Array<ObjectEntry<T>>;
4001
+ type Pairs<T> = Array<{
4002
+ [K in keyof T]-?: [key: K, value: Required<T>[K]];
4003
+ }[keyof T]>;
4004
+ interface Strict {
4005
+ <T extends NonNullable<unknown>>(object: T): Pairs<T>;
4006
+ }
3232
4007
  /**
3233
4008
  * Returns an array of key/values of the enumerable properties of an object.
3234
4009
  * @param object
@@ -3238,12 +4013,21 @@ type ObjectEntries<T extends Record<PropertyKey, unknown>> = Array<ObjectEntry<T
3238
4013
  * @example
3239
4014
  * P.toPairs({ a: 1, b: 2, c: 3 }) // => [['a', 1], ['b', 2], ['c', 3]]
3240
4015
  * P.toPairs.strict({ a: 1 } as const) // => [['a', 1]] typed Array<['a', 1]>
4016
+ * P.pipe(
4017
+ * { a: 1, b: 2, c: 3 },
4018
+ * toPairs,
4019
+ * ); // => [['a', 1], ['b', 2], ['c', 3]]
4020
+ * P.pipe(
4021
+ * { a: 1 } as const,
4022
+ * toPairs.strict,
4023
+ * ); // => [['a', 1]] typed Array<['a', 1]>
3241
4024
  * @strict
3242
4025
  * @category Object
4026
+ * @dataFirst
3243
4027
  */
3244
4028
  declare function toPairs<T>(object: Record<string, T>): Array<[string, T]>;
3245
4029
  declare namespace toPairs {
3246
- function strict<T extends Record<PropertyKey, unknown>>(object: T): ObjectEntries<T>;
4030
+ const strict: Strict;
3247
4031
  }
3248
4032
 
3249
4033
  /**
@@ -3266,13 +4050,18 @@ type Values<T extends object> = T extends [] | ReadonlyArray<unknown> ? Array<T[
3266
4050
  declare function values<T extends object>(source: T): Values<T>;
3267
4051
 
3268
4052
  type Splitter = '.' | '/' | '_' | '-';
3269
- type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
3270
- type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
4053
+ type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
4054
+ type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
3271
4055
  type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
3272
4056
  type IsLower<S extends string> = S extends Lowercase<S> ? true : false;
3273
4057
  type SameLetterCase<X extends string, Y extends string> = IsUpper<X> extends IsUpper<Y> ? true : IsLower<X> extends IsLower<Y> ? true : false;
3274
- type FirstOfString<S extends string> = S extends `${infer F}${string}` ? F : never;
3275
- type RemoveFirstOfString<S extends string> = S extends `${string}${infer R}` ? R : never;
4058
+ type CapitalizedWords<T extends readonly string[], Accumulator extends string = '', Normalize extends boolean | undefined = false> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<Normalize extends true ? Lowercase<F> : F>}`, Normalize> : Accumulator;
4059
+ type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ''> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends '' ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
4060
+ type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
4061
+ type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
4062
+ interface CaseOptions {
4063
+ normalize?: boolean;
4064
+ }
3276
4065
  type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unknown[] = []> = string extends Separator ? string[] : T extends `${infer F}${infer R}` ? [LastOfArray<Accumulator>] extends [never] ? SplitByCase<R, Separator, [F]> : LastOfArray<Accumulator> extends string ? R extends '' ? SplitByCase<R, Separator, [
3277
4066
  ...RemoveLastOfArray<Accumulator>,
3278
4067
  `${LastOfArray<Accumulator>}${F}`
@@ -3287,26 +4076,34 @@ type SplitByCase<T, Separator extends string = Splitter, Accumulator extends unk
3287
4076
  `${LastOfArray<Accumulator>}${F}`,
3288
4077
  FirstOfString<R>
3289
4078
  ]> : SplitByCase<R, Separator, [...Accumulator, F]> : never : Accumulator extends [] ? T extends '' ? [] : string[] : Accumulator;
3290
- type CapitalizedWords<T extends readonly string[], Accumulator extends string = ''> = T extends readonly [infer F extends string, ...infer R extends string[]] ? CapitalizedWords<R, `${Accumulator}${Capitalize<F>}`> : Accumulator;
3291
- type JoinLowercaseWords<T extends readonly string[], Joiner extends string, Accumulator extends string = ''> = T extends readonly [infer F extends string, ...infer R extends string[]] ? Accumulator extends '' ? JoinLowercaseWords<R, Joiner, `${Accumulator}${Lowercase<F>}`> : JoinLowercaseWords<R, Joiner, `${Accumulator}${Joiner}${Lowercase<F>}`> : Accumulator;
3292
- type PascalCase<T> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>> : never : T extends readonly string[] ? CapitalizedWords<T> : never;
3293
- type CamelCase<T> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T>>;
3294
4079
  type JoinByCase<T, Joiner extends string> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? JoinLowercaseWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? JoinLowercaseWords<T, Joiner> : never;
4080
+ type PascalCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, '', Normalize> : never : T extends readonly string[] ? CapitalizedWords<T, '', Normalize> : never;
4081
+ type CamelCase<T, Normalize extends boolean | undefined = false> = string extends T ? string : string[] extends T ? string : Uncapitalize<PascalCase<T, Normalize>>;
4082
+ type KebabCase<T extends readonly string[] | string, Joiner extends string = '-'> = JoinByCase<T, Joiner>;
4083
+ type SnakeCase<T extends readonly string[] | string> = JoinByCase<T, '_'>;
4084
+ type TrainCase<T, Normalize extends boolean | undefined = false, Joiner extends string = '-'> = string extends T ? string : string[] extends T ? string : T extends string ? SplitByCase<T> extends readonly string[] ? CapitalizedWords<SplitByCase<T>, Joiner> : never : T extends readonly string[] ? CapitalizedWords<T, Joiner, Normalize> : never;
4085
+ type FlatCase<T extends readonly string[] | string, Joiner extends string = ''> = JoinByCase<T, Joiner>;
3295
4086
 
3296
4087
  declare function isUppercase(char?: string): boolean | undefined;
3297
- declare function splitByCase<T extends string>(string_: T): SplitByCase<T>;
3298
- declare function splitByCase<T extends string, Separator extends readonly string[]>(string_: T, separators: Separator): SplitByCase<T, Separator[number]>;
3299
- declare function toUpperFirst<S extends string>(string_: S): Capitalize<S>;
3300
- declare function toLowerFirst<S extends string>(string_: S): Uncapitalize<S>;
4088
+ declare function splitByCase<T extends string>(str: T): SplitByCase<T>;
4089
+ declare function splitByCase<T extends string, Separator extends readonly string[]>(str: T, separators: Separator): SplitByCase<T, Separator[number]>;
4090
+ declare function toUpperFirst<S extends string>(str: S): Capitalize<S>;
4091
+ declare function toLowerFirst<S extends string>(str: S): Uncapitalize<S>;
3301
4092
  declare function toPascalCase(): '';
3302
- declare function toPascalCase<T extends readonly string[] | string>(string_?: T): PascalCase<T>;
4093
+ declare function toPascalCase<T extends readonly string[] | string, UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: CaseOptions): PascalCase<T, UserCaseOptions['normalize']>;
3303
4094
  declare function toCamelCase(): '';
3304
- declare function toCamelCase<T extends readonly string[] | string>(string_?: T): CamelCase<T>;
4095
+ declare function toCamelCase<T extends readonly string[] | string, UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): CamelCase<T, UserCaseOptions['normalize']>;
3305
4096
  declare function toKebabCase(): '';
3306
- declare function toKebabCase<T extends readonly string[] | string>(string_?: T): JoinByCase<T, '-'>;
3307
- declare function toKebabCase<T extends readonly string[] | string, Joiner extends string>(string_: T, joiner: Joiner): JoinByCase<T, Joiner>;
4097
+ declare function toKebabCase<T extends readonly string[] | string>(str: T): KebabCase<T>;
4098
+ declare function toKebabCase<T extends readonly string[] | string, Joiner extends string>(str: T, joiner: Joiner): KebabCase<T, Joiner>;
3308
4099
  declare function toSnakeCase(): '';
3309
- declare function toSnakeCase<T extends readonly string[] | string>(string_?: T): JoinByCase<T, '_'>;
4100
+ declare function toSnakeCase<T extends readonly string[] | string>(str: T): SnakeCase<T>;
4101
+ declare function toFlatCase(): '';
4102
+ declare function toFlatCase<T extends readonly string[] | string>(str: T): FlatCase<T>;
4103
+ declare function toTrainCase(): '';
4104
+ declare function toTrainCase<T extends readonly string[] | string, UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions['normalize']>;
4105
+ declare function titleCase(): '';
4106
+ declare function titleCase<T extends readonly string[] | string, UserCaseOptions extends CaseOptions = CaseOptions>(str: T, opts?: UserCaseOptions): TrainCase<T, UserCaseOptions['normalize'], ' '>;
3310
4107
 
3311
4108
  /**
3312
4109
  * Returns human readable file size.
@@ -3371,8 +4168,8 @@ type StringToPath<T extends string> = T extends '' ? [] : T extends `[${infer He
3371
4168
  * P.type(undefined); //=> "Undefined"
3372
4169
  * @category Type
3373
4170
  */
3374
- declare function type(val: any): string;
4171
+ declare function type(val: unknown): string;
3375
4172
 
3376
4173
  declare const isBrowser: boolean;
3377
4174
 
3378
- export { type Joined, KEY_CODES, type StringToPath, _setPath, addProp, allPass, anyPass, chunk, clamp, clone, compact, concat, countBy, createPipe, debounce, difference, differenceWith, drop, dropLast, equals, filter, find, findIndex, findLast, findLastIndex, first, flatMap, flatMapToObj, flatten, flattenDeep, forEach, forEachObj, fromPairs, groupBy, humanReadableFileSize, identity, indexBy, intersection, intersectionWith, invert, isArray, isBoolean, isBrowser, isDate, isDefined, isEmpty, isError, isFunction, isNil, isNonNull, isNot, isNumber, isObject, isPromise, isString, isTruthy, isUppercase, join, keys, last, length, map, mapKeys, mapToObj, mapValues, maxBy, meanBy, merge, mergeAll, mergeDeep, minBy, noop, omit, omitBy, once, partition, pathOr, pick, pickBy, pipe, prop, purry, randomString, range, reduce, reject, reverse, sample, set, setPath, shuffle, sleep, slugify, sort, sortBy, splitAt, splitByCase, splitWhen, stringToPath, sumBy, swapIndices, swapProps, take, takeWhile, toCamelCase, toKebabCase, toLowerFirst, toPairs, toPascalCase, toSnakeCase, toUpperFirst, type, uniq, uniqBy, uniqWith, values, zip, zipObj, zipWith };
4175
+ export { type Joined, KEY_CODES, type StringToPath, _setPath, add, addProp, allPass, anyPass, ceil, chunk, clamp, clone, compact, concat, conditional, countBy, createPipe, debounce, difference, differenceWith, divide, drop, dropFirstBy, dropLast, dropLastWhile, dropWhile, equals, filter, find, findIndex, findLast, findLastIndex, first, firstBy, flatMap, flatMapToObj, flatten, flattenDeep, floor, forEach, forEachObj, fromPairs, groupBy, hasAtLeast, humanReadableFileSize, identity, indexBy, intersection, intersectionWith, invert, isArray, isBoolean, isBrowser, isDate, isDefined, isEmpty, isError, isFunction, isNil, isNonNull, isNot, isNumber, isObject, isPromise, isString, isSymbol, isTruthy, isUppercase, join, keys, last, length, map, mapKeys, mapToObj, mapValues, maxBy, meanBy, merge, mergeAll, mergeDeep, minBy, multiply, noop, nthBy, omit, omitBy, once, only, partition, pathOr, pick, pickBy, pipe, prop, purry, randomString, range, rankBy, reduce, reject, reverse, round, sample, set, setPath, shuffle, sleep, slugify, sort, sortBy, splice, splitAt, splitByCase, splitWhen, stringToPath, subtract, sumBy, swapIndices, swapProps, take, takeFirstBy, takeWhile, titleCase, toCamelCase, toFlatCase, toKebabCase, toLowerFirst, toPairs, toPascalCase, toSnakeCase, toTrainCase, toUpperFirst, type, uniq, uniqBy, uniqWith, values, zip, zipObj, zipWith };