@vinicunca/perkakas 0.0.10 → 0.1.0
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.cjs +150 -23
- package/dist/index.d.cts +229 -81
- package/dist/index.d.ts +229 -81
- package/dist/index.js +148 -23
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +3 -3
- package/package.json +7 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
+
import { MergeDeep } from 'type-fest';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Using event.code is not predictable since each machine may have different output
|
|
3
5
|
*/
|
|
4
6
|
declare const KEY_CODES: {
|
|
5
|
-
readonly
|
|
7
|
+
readonly ALT: "Alt";
|
|
6
8
|
readonly ARROW_DOWN: "ArrowDown";
|
|
7
|
-
readonly ARROW_UP: "ArrowUp";
|
|
8
9
|
readonly ARROW_LEFT: "ArrowLeft";
|
|
9
10
|
readonly ARROW_RIGHT: "ArrowRight";
|
|
11
|
+
readonly ARROW_UP: "ArrowUp";
|
|
12
|
+
readonly AT: "@";
|
|
13
|
+
readonly BACKSPACE: "Backspace";
|
|
14
|
+
readonly CTRL: "Control";
|
|
15
|
+
readonly DELETE: "Delete";
|
|
16
|
+
readonly END: "End";
|
|
10
17
|
readonly ENTER: "Enter";
|
|
11
18
|
readonly ESC: "Escape";
|
|
12
|
-
readonly
|
|
13
|
-
readonly SHIFT: "Shift";
|
|
19
|
+
readonly HOME: "Home";
|
|
14
20
|
readonly KEY_F: "KEY_F";
|
|
15
|
-
readonly CTRL: "Control";
|
|
16
|
-
readonly ALT: "Alt";
|
|
17
21
|
readonly META: "Meta";
|
|
18
|
-
readonly AT: "@";
|
|
19
|
-
readonly DELETE: "Delete";
|
|
20
|
-
readonly BACKSPACE: "Backspace";
|
|
21
|
-
readonly HOME: "Home";
|
|
22
|
-
readonly END: "End";
|
|
23
|
-
readonly PAGE_UP: "PageUp";
|
|
24
22
|
readonly PAGE_DOWN: "PageDown";
|
|
23
|
+
readonly PAGE_UP: "PageUp";
|
|
24
|
+
readonly SHIFT: "Shift";
|
|
25
|
+
readonly SPACE: "Space";
|
|
26
|
+
readonly TAB: "Tab";
|
|
25
27
|
};
|
|
26
28
|
|
|
27
29
|
/**
|
|
@@ -104,9 +106,9 @@ type NonEmptyArray<T> = [T, ...Array<T>];
|
|
|
104
106
|
*
|
|
105
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)
|
|
106
108
|
*/
|
|
107
|
-
type IterableContainer<T = unknown> = ReadonlyArray<T
|
|
109
|
+
type IterableContainer<T = unknown> = [] | ReadonlyArray<T>;
|
|
108
110
|
|
|
109
|
-
type Chunked<T extends IterableContainer> = T[number] extends never ? [] : T extends readonly [
|
|
111
|
+
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]>>;
|
|
110
112
|
/**
|
|
111
113
|
* Split an array into groups the length of `size`. If `array` can't be split evenly, the final chunk will be the remaining elements.
|
|
112
114
|
* @param array the array
|
|
@@ -143,7 +145,7 @@ declare function chunk<T extends IterableContainer>(size: number): (array: T) =>
|
|
|
143
145
|
* @category Array
|
|
144
146
|
* @pipeable
|
|
145
147
|
*/
|
|
146
|
-
declare function compact<T>(items: ReadonlyArray<
|
|
148
|
+
declare function compact<T>(items: ReadonlyArray<'' | 0 | T | false | null | undefined>): Array<T>;
|
|
147
149
|
|
|
148
150
|
/**
|
|
149
151
|
* Combines two arrays.
|
|
@@ -156,7 +158,7 @@ declare function compact<T>(items: ReadonlyArray<T | null | undefined | false |
|
|
|
156
158
|
* @dataFirst
|
|
157
159
|
* @category Array
|
|
158
160
|
*/
|
|
159
|
-
declare function concat<T, K>(arr1: ReadonlyArray<T>, arr2: ReadonlyArray<K>): Array<
|
|
161
|
+
declare function concat<T, K>(arr1: ReadonlyArray<T>, arr2: ReadonlyArray<K>): Array<K | T>;
|
|
160
162
|
/**
|
|
161
163
|
* Combines two arrays.
|
|
162
164
|
* @param arr2 the second array
|
|
@@ -167,7 +169,7 @@ declare function concat<T, K>(arr1: ReadonlyArray<T>, arr2: ReadonlyArray<K>): A
|
|
|
167
169
|
* @dataLast
|
|
168
170
|
* @category Array
|
|
169
171
|
*/
|
|
170
|
-
declare function concat<T, K>(arr2: ReadonlyArray<K>): (arr1: ReadonlyArray<T>) => Array<
|
|
172
|
+
declare function concat<T, K>(arr2: ReadonlyArray<K>): (arr1: ReadonlyArray<T>) => Array<K | T>;
|
|
171
173
|
|
|
172
174
|
/**
|
|
173
175
|
* Counts how many values of the collection pass the specified predicate.
|
|
@@ -188,23 +190,23 @@ declare namespace countBy {
|
|
|
188
190
|
function indexed<T>(fn: PredIndexed<T, boolean>): (array: ReadonlyArray<T>) => number;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
|
-
type LazyResult<T> = LazyEmpty |
|
|
193
|
+
type LazyResult<T> = LazyEmpty | LazyMany<T> | LazyNext<T>;
|
|
192
194
|
interface LazyEmpty {
|
|
193
195
|
done: boolean;
|
|
194
|
-
hasNext: false;
|
|
195
196
|
hasMany?: false | undefined;
|
|
197
|
+
hasNext: false;
|
|
196
198
|
next?: undefined;
|
|
197
199
|
}
|
|
198
200
|
interface LazyNext<T> {
|
|
199
201
|
done: boolean;
|
|
200
|
-
hasNext: true;
|
|
201
202
|
hasMany?: false | undefined;
|
|
203
|
+
hasNext: true;
|
|
202
204
|
next: T;
|
|
203
205
|
}
|
|
204
206
|
interface LazyMany<T> {
|
|
205
207
|
done: boolean;
|
|
206
|
-
hasNext: true;
|
|
207
208
|
hasMany: true;
|
|
209
|
+
hasNext: true;
|
|
208
210
|
next: Array<T>;
|
|
209
211
|
}
|
|
210
212
|
|
|
@@ -598,7 +600,7 @@ declare namespace find {
|
|
|
598
600
|
};
|
|
599
601
|
}
|
|
600
602
|
|
|
601
|
-
type FirstOut<T extends IterableContainer> = T extends [] ? undefined : T extends readonly [unknown, ...Array<unknown>] ? T[0] : T extends readonly [...infer Pre, infer Last] ? Pre[0]
|
|
603
|
+
type FirstOut<T extends IterableContainer> = T extends [] ? undefined : T extends readonly [unknown, ...Array<unknown>] ? T[0] : T extends readonly [...infer Pre, infer Last] ? Last | Pre[0] : T[0] | undefined;
|
|
602
604
|
/**
|
|
603
605
|
* Gets the first element of `array`.
|
|
604
606
|
* Note: In `pipe`, use `first()` form instead of `first`. Otherwise, the inferred type is lost.
|
|
@@ -693,7 +695,7 @@ declare namespace flatMapToObj {
|
|
|
693
695
|
* @pipeable
|
|
694
696
|
* @category Array
|
|
695
697
|
*/
|
|
696
|
-
declare function flatMap<T, K>(array: ReadonlyArray<T>, fn: (input: T) => K |
|
|
698
|
+
declare function flatMap<T, K>(array: ReadonlyArray<T>, fn: (input: T) => K | ReadonlyArray<K>): Array<K>;
|
|
697
699
|
/**
|
|
698
700
|
* Map each element of an array using a defined callback function and flatten the mapped result.
|
|
699
701
|
* @param fn The function mapper.
|
|
@@ -705,17 +707,17 @@ declare function flatMap<T, K>(array: ReadonlyArray<T>, fn: (input: T) => K | Ar
|
|
|
705
707
|
* @pipeable
|
|
706
708
|
* @category Array
|
|
707
709
|
*/
|
|
708
|
-
declare function flatMap<T, K>(fn: (input: T) => K |
|
|
710
|
+
declare function flatMap<T, K>(fn: (input: T) => K | ReadonlyArray<K>): (array: ReadonlyArray<T>) => Array<K>;
|
|
709
711
|
declare namespace flatMap {
|
|
710
|
-
function lazy<T, K>(fn: (input: T) => K |
|
|
712
|
+
function lazy<T, K>(fn: (input: T) => K | ReadonlyArray<K>): (value: T) => {
|
|
711
713
|
done: boolean;
|
|
712
|
-
hasNext: boolean;
|
|
713
714
|
hasMany: boolean;
|
|
714
|
-
|
|
715
|
+
hasNext: boolean;
|
|
716
|
+
next: K & any[];
|
|
715
717
|
} | {
|
|
716
718
|
done: boolean;
|
|
717
719
|
hasNext: boolean;
|
|
718
|
-
next: K;
|
|
720
|
+
next: K | readonly K[];
|
|
719
721
|
hasMany?: undefined;
|
|
720
722
|
};
|
|
721
723
|
}
|
|
@@ -820,12 +822,12 @@ declare namespace forEach {
|
|
|
820
822
|
};
|
|
821
823
|
}
|
|
822
824
|
|
|
823
|
-
interface Strict$
|
|
825
|
+
interface Strict$6 {
|
|
824
826
|
<Value, Key extends PropertyKey = PropertyKey>(items: ReadonlyArray<Value>, fn: (item: Value) => Key | undefined): StrictOut$2<Value, Key>;
|
|
825
827
|
<Value, Key extends PropertyKey = PropertyKey>(fn: (item: Value) => Key | undefined): (items: ReadonlyArray<Value>) => StrictOut$2<Value, Key>;
|
|
826
828
|
readonly indexed: {
|
|
827
|
-
<Value, Key extends PropertyKey = PropertyKey>(items: ReadonlyArray<Value>, fn: PredIndexed<Value, Key | undefined>): StrictOut$2<Value, Key>;
|
|
828
829
|
<Value, Key extends PropertyKey = PropertyKey>(fn: PredIndexed<Value, Key | undefined>): (items: ReadonlyArray<Value>) => StrictOut$2<Value, Key>;
|
|
830
|
+
<Value, Key extends PropertyKey = PropertyKey>(items: ReadonlyArray<Value>, fn: PredIndexed<Value, Key | undefined>): StrictOut$2<Value, Key>;
|
|
829
831
|
};
|
|
830
832
|
}
|
|
831
833
|
type StrictOut$2<Value, Key extends PropertyKey = PropertyKey> = string extends Key ? Record<Key, NonEmptyArray<Value>> : number extends Key ? Record<Key, NonEmptyArray<Value>> : symbol extends Key ? Record<Key, NonEmptyArray<Value>> : Partial<Record<Key, NonEmptyArray<Value>>>;
|
|
@@ -851,7 +853,7 @@ declare function groupBy<T>(fn: (item: T) => PropertyKey | undefined): (array: R
|
|
|
851
853
|
declare namespace groupBy {
|
|
852
854
|
function indexed<T>(array: ReadonlyArray<T>, fn: PredIndexed<T, PropertyKey | undefined>): Record<string, NonEmptyArray<T>>;
|
|
853
855
|
function indexed<T>(fn: PredIndexed<T, PropertyKey | undefined>): (array: ReadonlyArray<T>) => Record<string, NonEmptyArray<T>>;
|
|
854
|
-
const strict: Strict$
|
|
856
|
+
const strict: Strict$6;
|
|
855
857
|
}
|
|
856
858
|
|
|
857
859
|
/**
|
|
@@ -968,9 +970,9 @@ declare namespace intersectionWith {
|
|
|
968
970
|
function lazy<TFirst, TSecond>(other: Array<TSecond>, comparator: Comparator<TFirst, TSecond>): (value: TFirst) => LazyResult<TFirst>;
|
|
969
971
|
}
|
|
970
972
|
|
|
971
|
-
type Joinable = bigint | boolean |
|
|
973
|
+
type Joinable = bigint | boolean | null | number | string | undefined;
|
|
972
974
|
type Joined<T extends IterableContainer, Glue extends string> = T[number] extends never ? '' : T extends readonly [Joinable?] ? `${NullishCoalesce<T[0], ''>}` : T extends readonly [infer First, ...infer Tail] ? `${NullishCoalesce<First, ''>}${Glue}${Joined<Tail, Glue>}` : T extends readonly [...infer Head, infer Last] ? `${Joined<Head, Glue>}${Glue}${NullishCoalesce<Last, ''>}` : string;
|
|
973
|
-
type NullishCoalesce<T, Fallback> = T extends Joinable ? T extends
|
|
975
|
+
type NullishCoalesce<T, Fallback> = T extends Joinable ? T extends null | undefined ? Fallback | NonNullable<T> : T : never;
|
|
974
976
|
/**
|
|
975
977
|
* Joins the elements of the array by: casting them to a string and
|
|
976
978
|
* concatenating them one to the other, with the provided glue string in between
|
|
@@ -990,7 +992,7 @@ type NullishCoalesce<T, Fallback> = T extends Joinable ? T extends undefined | n
|
|
|
990
992
|
* @dataFirst
|
|
991
993
|
* @category Array
|
|
992
994
|
*/
|
|
993
|
-
declare function join<T extends ReadonlyArray<Joinable
|
|
995
|
+
declare function join<T extends [] | ReadonlyArray<Joinable>, Glue extends string>(data: T, glue: Glue): Joined<T, Glue>;
|
|
994
996
|
/**
|
|
995
997
|
* Joins the elements of the array by: casting them to a string and
|
|
996
998
|
* concatenating them one to the other, with the provided glue string in between
|
|
@@ -1009,7 +1011,7 @@ declare function join<T extends ReadonlyArray<Joinable> | [], Glue extends strin
|
|
|
1009
1011
|
* @dataLast
|
|
1010
1012
|
* @category Array
|
|
1011
1013
|
*/
|
|
1012
|
-
declare function join<T extends ReadonlyArray<Joinable
|
|
1014
|
+
declare function join<T extends [] | ReadonlyArray<Joinable>, Glue extends string>(glue: Glue): (data: T) => Joined<T, Glue>;
|
|
1013
1015
|
|
|
1014
1016
|
/**
|
|
1015
1017
|
* Gets the last element of `array`.
|
|
@@ -1047,7 +1049,7 @@ type Enumerable<T> = ArrayLike<T> | Iterable<T>;
|
|
|
1047
1049
|
declare function length<T>(items: Enumerable<T>): number;
|
|
1048
1050
|
declare function length<T>(): (items: Enumerable<T>) => number;
|
|
1049
1051
|
|
|
1050
|
-
interface Strict$
|
|
1052
|
+
interface Strict$5 {
|
|
1051
1053
|
<T extends IterableContainer, K>(items: T, mapper: Pred<T[number], K>): StrictOut$1<T, K>;
|
|
1052
1054
|
<T extends IterableContainer, K>(mapper: Pred<T[number], K>): (items: T) => StrictOut$1<T, K>;
|
|
1053
1055
|
readonly indexed: {
|
|
@@ -1103,7 +1105,7 @@ declare namespace map {
|
|
|
1103
1105
|
const lazyIndexed: (<T, K>(fn: PredIndexedOptional<T, K>) => (value: T, index?: number | undefined, array?: T[] | undefined) => LazyResult<K>) & {
|
|
1104
1106
|
indexed: true;
|
|
1105
1107
|
};
|
|
1106
|
-
const strict: Strict$
|
|
1108
|
+
const strict: Strict$5;
|
|
1107
1109
|
}
|
|
1108
1110
|
|
|
1109
1111
|
/**
|
|
@@ -1532,7 +1534,7 @@ declare function shuffle<T>(items: ReadonlyArray<T>): Array<T>;
|
|
|
1532
1534
|
*/
|
|
1533
1535
|
declare function shuffle<T>(): (items: ReadonlyArray<T>) => Array<T>;
|
|
1534
1536
|
|
|
1535
|
-
interface Strict$
|
|
1537
|
+
interface Strict$4 {
|
|
1536
1538
|
<T extends IterableContainer>(items: T, cmp: (a: T[number], b: T[number]) => number): Sorted<T>;
|
|
1537
1539
|
<T extends IterableContainer>(cmp: (a: T[number], b: T[number]) => number): (items: T) => Sorted<T>;
|
|
1538
1540
|
}
|
|
@@ -1579,22 +1581,22 @@ declare function sort<T>(items: ReadonlyArray<T>, cmp: (a: T, b: T) => number):
|
|
|
1579
1581
|
*/
|
|
1580
1582
|
declare function sort<T>(cmp: (a: T, b: T) => number): (items: ReadonlyArray<T>) => Array<T>;
|
|
1581
1583
|
declare namespace sort {
|
|
1582
|
-
const strict: Strict$
|
|
1584
|
+
const strict: Strict$4;
|
|
1583
1585
|
}
|
|
1584
1586
|
|
|
1585
1587
|
declare const ALL_DIRECTIONS: readonly ["asc", "desc"];
|
|
1586
1588
|
type Direction = (typeof ALL_DIRECTIONS)[number];
|
|
1587
|
-
type ComparablePrimitive =
|
|
1588
|
-
type Comparable =
|
|
1589
|
+
type ComparablePrimitive = boolean | number | string;
|
|
1590
|
+
type Comparable = {
|
|
1589
1591
|
valueOf(): ComparablePrimitive;
|
|
1590
|
-
};
|
|
1592
|
+
} | ComparablePrimitive;
|
|
1591
1593
|
type SortProjection<T> = (x: T) => Comparable;
|
|
1592
1594
|
type SortPair<T> = readonly [
|
|
1593
1595
|
projector: SortProjection<T>,
|
|
1594
1596
|
direction: Direction
|
|
1595
1597
|
];
|
|
1596
|
-
type SortRule<T> =
|
|
1597
|
-
interface Strict$
|
|
1598
|
+
type SortRule<T> = SortPair<T> | SortProjection<T>;
|
|
1599
|
+
interface Strict$3 {
|
|
1598
1600
|
<T extends IterableContainer>(...sortRules: Readonly<NonEmptyArray<SortRule<T[number]>>>): (array: T) => SortedBy<T>;
|
|
1599
1601
|
<T extends IterableContainer>(array: T, ...sortRules: Readonly<NonEmptyArray<SortRule<T[number]>>>): SortedBy<T>;
|
|
1600
1602
|
}
|
|
@@ -1676,7 +1678,7 @@ declare function sortBy<T>(...sortRules: Readonly<NonEmptyArray<SortRule<T>>>):
|
|
|
1676
1678
|
*/
|
|
1677
1679
|
declare function sortBy<T>(array: ReadonlyArray<T>, ...sortRules: Readonly<NonEmptyArray<SortRule<T>>>): Array<T>;
|
|
1678
1680
|
declare namespace sortBy {
|
|
1679
|
-
const strict: Strict$
|
|
1681
|
+
const strict: Strict$3;
|
|
1680
1682
|
}
|
|
1681
1683
|
|
|
1682
1684
|
/**
|
|
@@ -1972,31 +1974,55 @@ declare namespace uniqWith {
|
|
|
1972
1974
|
};
|
|
1973
1975
|
}
|
|
1974
1976
|
|
|
1977
|
+
interface Strict$2 {
|
|
1978
|
+
<F extends IterableContainer, S extends IterableContainer>(first: F, second: S): Zip<F, S>;
|
|
1979
|
+
<S extends IterableContainer>(second: S): <F extends IterableContainer>(first: F) => Zip<F, S>;
|
|
1980
|
+
}
|
|
1981
|
+
type Zip<Left extends IterableContainer, Right extends IterableContainer> = Left extends readonly [] ? [] : Right extends readonly [] ? [] : Left extends readonly [infer LeftHead, ...infer LeftRest] ? Right extends readonly [infer RightHead, ...infer RightRest] ? [
|
|
1982
|
+
[LeftHead, RightHead],
|
|
1983
|
+
...Zip<LeftRest, RightRest>
|
|
1984
|
+
] : [
|
|
1985
|
+
[LeftHead, Right[number]],
|
|
1986
|
+
...Zip<LeftRest, Right>
|
|
1987
|
+
] : Right extends readonly [infer RightHead, ...infer RightRest] ? [[Left[number], RightHead], ...Zip<Left, RightRest>] : Array<[Left[number], Right[number]]>;
|
|
1975
1988
|
/**
|
|
1976
1989
|
* Creates a new list from two supplied lists by pairing up equally-positioned items.
|
|
1977
1990
|
* The length of the returned list will match the shortest of the two inputs.
|
|
1991
|
+
*
|
|
1992
|
+
* If the input array are tuples, you can use the strict option
|
|
1993
|
+
* to get another tuple instead of a generic array type.
|
|
1978
1994
|
* @param first the first input list
|
|
1979
1995
|
* @param second the second input list
|
|
1980
1996
|
* @signature
|
|
1981
1997
|
* P.zip(first, second)
|
|
1982
1998
|
* @example
|
|
1983
|
-
* P.zip([1, 2], ['a', 'b']) // => [1, 'a'], [2, 'b']
|
|
1999
|
+
* P.zip([1, 2], ['a', 'b']) // => [[1, 'a'], [2, 'b']] (type: [number, string][])
|
|
2000
|
+
* P.zip.strict([1, 2] as const, ['a', 'b'] as const) // => [[1, 'a'], [2, 'b']] (type: [[1, 'a'], [2, 'b']])
|
|
1984
2001
|
* @dataFirst
|
|
1985
2002
|
* @category Array
|
|
2003
|
+
* @strict
|
|
1986
2004
|
*/
|
|
1987
2005
|
declare function zip<F, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): Array<[F, S]>;
|
|
1988
2006
|
/**
|
|
1989
2007
|
* Creates a new list from two supplied lists by pairing up equally-positioned items.
|
|
1990
2008
|
* The length of the returned list will match the shortest of the two inputs.
|
|
2009
|
+
*
|
|
2010
|
+
* If the input array are tuples, you can use the strict option
|
|
2011
|
+
* to get another tuple instead of a generic array type.
|
|
1991
2012
|
* @param second the second input list
|
|
1992
2013
|
* @signature
|
|
1993
2014
|
* P.zip(second)(first)
|
|
1994
2015
|
* @example
|
|
1995
|
-
* P.zip(['a', 'b'])([1, 2]) // => [[1, 'a'], [2, 'b']
|
|
2016
|
+
* P.zip(['a', 'b'])([1, 2]) // => [[1, 'a'], [2, 'b']] (type: [number, string][])
|
|
2017
|
+
* P.zip.strict(['a', 'b'] as const)([1, 2] as const) // => [[1, 'a'], [2, 'b']] (type: [[1, 'a'], [2, 'b']])
|
|
1996
2018
|
* @dataLast
|
|
1997
2019
|
* @category Array
|
|
2020
|
+
* @strict
|
|
1998
2021
|
*/
|
|
1999
2022
|
declare function zip<S>(second: ReadonlyArray<S>): <F>(first: ReadonlyArray<F>) => Array<[F, S]>;
|
|
2023
|
+
declare namespace zip {
|
|
2024
|
+
const strict: Strict$2;
|
|
2025
|
+
}
|
|
2000
2026
|
|
|
2001
2027
|
/**
|
|
2002
2028
|
* Creates a new object from two supplied lists by pairing up equally-positioned items.
|
|
@@ -2010,7 +2036,7 @@ declare function zip<S>(second: ReadonlyArray<S>): <F>(first: ReadonlyArray<F>)
|
|
|
2010
2036
|
* @dataFirst
|
|
2011
2037
|
* @category Array
|
|
2012
2038
|
*/
|
|
2013
|
-
declare function zipObj<F extends
|
|
2039
|
+
declare function zipObj<F extends number | string | symbol, S>(first: ReadonlyArray<F>, second: ReadonlyArray<S>): Record<F, S>;
|
|
2014
2040
|
/**
|
|
2015
2041
|
* Creates a new object from two supplied lists by pairing up equally-positioned items.
|
|
2016
2042
|
* Key/value pairing is truncated to the length of the shorter of the two lists
|
|
@@ -2022,7 +2048,7 @@ declare function zipObj<F extends string | number | symbol, S>(first: ReadonlyAr
|
|
|
2022
2048
|
* @dataLast
|
|
2023
2049
|
* @category Array
|
|
2024
2050
|
*/
|
|
2025
|
-
declare function zipObj<S>(second: ReadonlyArray<S>): <F extends
|
|
2051
|
+
declare function zipObj<S>(second: ReadonlyArray<S>): <F extends number | string | symbol>(first: ReadonlyArray<F>) => Record<F, S>;
|
|
2026
2052
|
|
|
2027
2053
|
/**
|
|
2028
2054
|
* Creates a new list from two supplied lists by calling the supplied function
|
|
@@ -2116,6 +2142,97 @@ declare function noop(): undefined;
|
|
|
2116
2142
|
*/
|
|
2117
2143
|
declare function once<T>(fn: () => T): () => T;
|
|
2118
2144
|
|
|
2145
|
+
interface Debouncer<F extends (...args: any) => unknown, IsNullable extends boolean = true> {
|
|
2146
|
+
/**
|
|
2147
|
+
* The last computed value of the debounced function.
|
|
2148
|
+
*/
|
|
2149
|
+
readonly cachedValue: ReturnType<F> | undefined;
|
|
2150
|
+
/**
|
|
2151
|
+
* Invoke the debounced function.
|
|
2152
|
+
* @param args - same as the args for the debounced function.
|
|
2153
|
+
* @returns - the last computed value of the debounced function with the
|
|
2154
|
+
* latest args provided to it. If `timing` does not include `leading` then the
|
|
2155
|
+
* the function would return `undefined` until the first cool-down period is
|
|
2156
|
+
* over, otherwise the function would always return the return type of the
|
|
2157
|
+
* debounced function.
|
|
2158
|
+
*/
|
|
2159
|
+
readonly call: (...args: Parameters<F>) => ReturnType<F> | (true extends IsNullable ? undefined : never);
|
|
2160
|
+
/**
|
|
2161
|
+
* Cancels any debounced functions without calling them, effectively resetting
|
|
2162
|
+
* the debouncer to the same state it is when initially created.
|
|
2163
|
+
*/
|
|
2164
|
+
readonly cancel: () => void;
|
|
2165
|
+
/**
|
|
2166
|
+
* Similar to `cancel`, but would also trigger the `trailing` invocation if
|
|
2167
|
+
* the debouncer would run one at the end of the cool-down period.
|
|
2168
|
+
*/
|
|
2169
|
+
readonly flush: () => ReturnType<F> | undefined;
|
|
2170
|
+
/**
|
|
2171
|
+
* Is `true` when there is an active cool-down period currently debouncing
|
|
2172
|
+
* invocations.
|
|
2173
|
+
*/
|
|
2174
|
+
readonly isPending: boolean;
|
|
2175
|
+
}
|
|
2176
|
+
interface DebounceOptions {
|
|
2177
|
+
readonly maxWaitMs?: number;
|
|
2178
|
+
readonly waitMs?: number;
|
|
2179
|
+
}
|
|
2180
|
+
/**
|
|
2181
|
+
* Wraps `func` with a debouncer object that "debounces" (delays) invocations of the function during a defined cool-down period (`waitMs`). It can be configured to invoke the function either at the start of the cool-down period, the end of it, or at both ends (`timing`).
|
|
2182
|
+
* It can also be configured to allow invocations during the cool-down period (`maxWaitMs`).
|
|
2183
|
+
* It stores the latest call's arguments so they could be used at the end of the cool-down period when invoking `func` (if configured to invoke the function at the end of the cool-down period).
|
|
2184
|
+
* It stores the value returned by `func` whenever its invoked. This value is returned on every call, and is accessible via the `cachedValue` property of the debouncer. Its important to note that the value might be different from the value that would be returned from running `func` with the current arguments as it is a cached value from a previous invocation.
|
|
2185
|
+
* **Important**: The cool-down period defines the minimum between two invocations, and not the maximum. The period will be **extended** each time a call is made until a full cool-down period has elapsed without any additional calls.
|
|
2186
|
+
* @param func The function to debounce, the returned `call` function will have
|
|
2187
|
+
* the exact same signature.
|
|
2188
|
+
* @param options An object allowing further customization of the debouncer:
|
|
2189
|
+
* - `timing?: 'leading' | 'trailing' |'both'`. The default is `'trailing'`.
|
|
2190
|
+
* `leading` would result in the function being invoked at the start of the
|
|
2191
|
+
* cool-down period; `trailing` would result in the function being invoked at
|
|
2192
|
+
* the end of the cool-down period (using the args from the last call to the
|
|
2193
|
+
* debouncer). When `both` is selected the `trailing` invocation would only
|
|
2194
|
+
* take place if there were more than one call to the debouncer during the
|
|
2195
|
+
* cool-down period. **DEFAULT: 'trailing'**
|
|
2196
|
+
* - `waitMs?: number`. The length of the cool-down period in milliseconds. The
|
|
2197
|
+
* debouncer would wait until this amount of time has passed without **any**
|
|
2198
|
+
* additional calls to the debouncer before triggering the end-of-cool-down-
|
|
2199
|
+
* period event. When this happens, the function would be invoked (if `timing`
|
|
2200
|
+
* isn't `'leading'`) and the debouncer state would be reset. **DEFAULT: 0**
|
|
2201
|
+
* - `maxWaitMs?: number`. The length of time since a debounced call (a call
|
|
2202
|
+
* that the debouncer prevented from being invoked) was made until it would be
|
|
2203
|
+
* invoked. Because the debouncer can be continually triggered and thus never
|
|
2204
|
+
* reach the end of the cool-down period, this allows the function to still
|
|
2205
|
+
* be invoked occasionally. IMPORTANT: This param is ignored when `timing` is
|
|
2206
|
+
* `'leading'`.
|
|
2207
|
+
* @returns a debouncer object. The main function is `call`. In addition to it
|
|
2208
|
+
* the debouncer comes with the following additional functions and properties:
|
|
2209
|
+
* - `cancel` method to cancel delayed `func` invocations
|
|
2210
|
+
* - `flush` method to end the cool-down period immediately.
|
|
2211
|
+
* - `cachedValue` the latest return value of an invocation (if one occurred).
|
|
2212
|
+
* - `isPending` flag to check if there is an inflight cool-down window.
|
|
2213
|
+
* @signature
|
|
2214
|
+
* P.debounce(func, options);
|
|
2215
|
+
* @example
|
|
2216
|
+
* const debouncer = debounce(identity, { timing: 'trailing', waitMs: 1000 });
|
|
2217
|
+
* const result1 = debouncer.call(1); // => undefined
|
|
2218
|
+
* const result2 = debouncer.call(2); // => undefined
|
|
2219
|
+
* // after 1 second
|
|
2220
|
+
* const result3 = debouncer.call(3); // => 2
|
|
2221
|
+
* // after 1 second
|
|
2222
|
+
* debouncer.cachedValue; // => 3
|
|
2223
|
+
* @dataFirst
|
|
2224
|
+
* @category Function
|
|
2225
|
+
* @see https://css-tricks.com/debouncing-throttling-explained-examples/
|
|
2226
|
+
*/
|
|
2227
|
+
declare function debounce<F extends (...args: any) => any>(func: F, options: {
|
|
2228
|
+
readonly timing?: 'trailing';
|
|
2229
|
+
} & DebounceOptions): Debouncer<F>;
|
|
2230
|
+
declare function debounce<F extends (...args: any) => any>(func: F, options: ({
|
|
2231
|
+
readonly timing: 'both';
|
|
2232
|
+
} & DebounceOptions) | ({
|
|
2233
|
+
readonly timing: 'leading';
|
|
2234
|
+
} & Omit<DebounceOptions, 'maxWaitMs'>)): Debouncer<F, false>;
|
|
2235
|
+
|
|
2119
2236
|
/**
|
|
2120
2237
|
* Perform left-to-right function composition.
|
|
2121
2238
|
* @param value The initial value.
|
|
@@ -2205,7 +2322,7 @@ type DefinitelyArray<T> = Extract<T, Array<any> | ReadonlyArray<any>> extends ne
|
|
|
2205
2322
|
* P.isArray('somethingElse') //=> false
|
|
2206
2323
|
* @category Guard
|
|
2207
2324
|
*/
|
|
2208
|
-
declare function isArray<T>(data:
|
|
2325
|
+
declare function isArray<T>(data: ReadonlyArray<unknown> | T): data is DefinitelyArray<T>;
|
|
2209
2326
|
|
|
2210
2327
|
type DefinitelyBoolean<T> = Extract<T, boolean> extends never ? boolean : Extract<T, boolean> extends any ? boolean : Extract<T, number>;
|
|
2211
2328
|
/**
|
|
@@ -2273,7 +2390,7 @@ declare namespace isDefined {
|
|
|
2273
2390
|
* @category Function
|
|
2274
2391
|
*/
|
|
2275
2392
|
declare function isEmpty(data: string): data is '';
|
|
2276
|
-
declare function isEmpty(data: ReadonlyArray<unknown>
|
|
2393
|
+
declare function isEmpty(data: [] | ReadonlyArray<unknown>): data is [];
|
|
2277
2394
|
declare function isEmpty<T extends Readonly<Record<PropertyKey, unknown>>>(data: T): data is Record<keyof T, never>;
|
|
2278
2395
|
|
|
2279
2396
|
type DefinitelyError<T> = Extract<T, Error> extends never ? Error : Extract<T, Error>;
|
|
@@ -2288,7 +2405,7 @@ type DefinitelyError<T> = Extract<T, Error> extends never ? Error : Extract<T, E
|
|
|
2288
2405
|
* P.isError('somethingElse') //=> false
|
|
2289
2406
|
* @category Guard
|
|
2290
2407
|
*/
|
|
2291
|
-
declare function isError<T>(data:
|
|
2408
|
+
declare function isError<T>(data: Error | T): data is DefinitelyError<T>;
|
|
2292
2409
|
|
|
2293
2410
|
type DefinitelyFunction<T> = Extract<T, Function> extends never ? Function : Extract<T, Function>;
|
|
2294
2411
|
/**
|
|
@@ -2302,7 +2419,7 @@ type DefinitelyFunction<T> = Extract<T, Function> extends never ? Function : Ext
|
|
|
2302
2419
|
* P.isFunction('somethingElse') //=> false
|
|
2303
2420
|
* @category Guard
|
|
2304
2421
|
*/
|
|
2305
|
-
declare function isFunction<T>(data:
|
|
2422
|
+
declare function isFunction<T>(data: Function | T): data is DefinitelyFunction<T>;
|
|
2306
2423
|
|
|
2307
2424
|
/**
|
|
2308
2425
|
* A function that checks if the passed parameter is Nil (null or undefined) and narrows its type accordingly
|
|
@@ -2422,7 +2539,7 @@ declare function isString<T>(data: T | string): data is DefinitelyString<T>;
|
|
|
2422
2539
|
* P.isTruthy('') //=> false
|
|
2423
2540
|
* @category Guard
|
|
2424
2541
|
*/
|
|
2425
|
-
declare function isTruthy<T>(data: T): data is Exclude<T,
|
|
2542
|
+
declare function isTruthy<T>(data: T): data is Exclude<T, '' | 0 | false | null | undefined>;
|
|
2426
2543
|
|
|
2427
2544
|
/**
|
|
2428
2545
|
* Clamp the given value within the inclusive min and max bounds.
|
|
@@ -2440,8 +2557,8 @@ declare function isTruthy<T>(data: T): data is Exclude<T, null | undefined | fal
|
|
|
2440
2557
|
* @category Number
|
|
2441
2558
|
*/
|
|
2442
2559
|
declare function clamp(value: number, limits: {
|
|
2443
|
-
min?: number;
|
|
2444
2560
|
max?: number;
|
|
2561
|
+
min?: number;
|
|
2445
2562
|
}): number;
|
|
2446
2563
|
/**
|
|
2447
2564
|
* Clamp the given value within the inclusive min and max bounds.
|
|
@@ -2458,8 +2575,8 @@ declare function clamp(value: number, limits: {
|
|
|
2458
2575
|
* @category Number
|
|
2459
2576
|
*/
|
|
2460
2577
|
declare function clamp(limits: {
|
|
2461
|
-
min?: number;
|
|
2462
2578
|
max?: number;
|
|
2579
|
+
min?: number;
|
|
2463
2580
|
}): (value: number) => number;
|
|
2464
2581
|
|
|
2465
2582
|
/**
|
|
@@ -2660,12 +2777,12 @@ declare function invert<T extends object>(): (object: T) => Inverted<T>;
|
|
|
2660
2777
|
type Strict = <T extends object>(source: T) => Keys<T>;
|
|
2661
2778
|
type Keys<T> = T extends IterableContainer ? ArrayKeys<T> : ObjectKeys$1<T>;
|
|
2662
2779
|
type ArrayKeys<T extends IterableContainer> = {
|
|
2663
|
-
-readonly [Index in keyof T]: Index extends
|
|
2780
|
+
-readonly [Index in keyof T]: Index extends number | string ? `${IsIndexAfterSpread<T, Index> extends true ? number : Index}` : never;
|
|
2664
2781
|
};
|
|
2665
|
-
type IsIndexAfterSpread<T extends IterableContainer, Index extends
|
|
2666
|
-
type IndicesAfterSpread<T extends ReadonlyArray<unknown
|
|
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'];
|
|
2667
2784
|
type ObjectKeys$1<T> = T extends Record<PropertyKey, never> ? [] : Array<`${Exclude<keyof T, symbol>}`>;
|
|
2668
|
-
declare function keys(source:
|
|
2785
|
+
declare function keys(source: ArrayLike<unknown> | Record<PropertyKey, unknown>): Array<string>;
|
|
2669
2786
|
declare namespace keys {
|
|
2670
2787
|
const strict: Strict;
|
|
2671
2788
|
}
|
|
@@ -2743,6 +2860,37 @@ declare function merge<A, B>(a: A, b: B): A & B;
|
|
|
2743
2860
|
*/
|
|
2744
2861
|
declare function merge<A, B>(b: B): (a: A) => A & B;
|
|
2745
2862
|
|
|
2863
|
+
/**
|
|
2864
|
+
* Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).
|
|
2865
|
+
*
|
|
2866
|
+
* @param destination - The object to merge into. In general, this object would have it's values overridden.
|
|
2867
|
+
* @param source - The object to merge from. In general, shared keys would be taken from this object.
|
|
2868
|
+
* @returns - The merged object.
|
|
2869
|
+
* @signature
|
|
2870
|
+
* P.mergeDeep(destination, source)
|
|
2871
|
+
* @example
|
|
2872
|
+
* P.mergeDeep({ foo: 'bar', x: 1 }, { foo: 'baz', y: 2 }) // => { foo: 'baz', x: 1, y: 2 }
|
|
2873
|
+
* @dataFirst
|
|
2874
|
+
* @category Object
|
|
2875
|
+
*/
|
|
2876
|
+
declare function mergeDeep<Destination extends Record<string, unknown>, Source extends Record<string, unknown>>(destination: Destination, source: Source): MergeDeep<Destination, Source>;
|
|
2877
|
+
/**
|
|
2878
|
+
* Merges the `source` object into the `destination` object. The merge is similar to performing `{ ...destination, ... source }` (where disjoint values from each object would be copied as-is, and for any overlapping props the value from `source` would be used); But for *each prop* (`p`), if **both** `destination` and `source` have a **plain-object** as a value, the value would be taken as the result of recursively deepMerging them (`result.p === deepMerge(destination.p, source.p)`).
|
|
2879
|
+
*
|
|
2880
|
+
* @param source - The object to merge from. In general, shared keys would be taken from this object.
|
|
2881
|
+
* @returns - The merged object.
|
|
2882
|
+
* @signature
|
|
2883
|
+
* P.mergeDeep(source)(destination)
|
|
2884
|
+
* @example
|
|
2885
|
+
* P.pipe(
|
|
2886
|
+
* { foo: 'bar', x: 1 },
|
|
2887
|
+
* P.mergeDeep({ foo: 'baz', y: 2 }),
|
|
2888
|
+
* ); // => { foo: 'baz', x: 1, y: 2 }
|
|
2889
|
+
* @dataLast
|
|
2890
|
+
* @category Object
|
|
2891
|
+
*/
|
|
2892
|
+
declare function mergeDeep<Destination extends Record<string, unknown>, Source extends Record<string, unknown>>(source: Source): (target: Destination) => MergeDeep<Destination, Source>;
|
|
2893
|
+
|
|
2746
2894
|
/**
|
|
2747
2895
|
* Returns a partial copy of an object omitting the keys specified.
|
|
2748
2896
|
* @param data the object
|
|
@@ -2765,7 +2913,7 @@ declare function omit<T extends object, K extends keyof T>(data: T, propNames: R
|
|
|
2765
2913
|
* @dataLast
|
|
2766
2914
|
* @category Object
|
|
2767
2915
|
*/
|
|
2768
|
-
declare function omit<K extends
|
|
2916
|
+
declare function omit<T extends object, K extends keyof T>(propNames: ReadonlyArray<K>): (data: T) => Omit<T, K>;
|
|
2769
2917
|
|
|
2770
2918
|
/**
|
|
2771
2919
|
* Returns a partial copy of an object omitting the keys matching predicate.
|
|
@@ -2884,7 +3032,7 @@ declare function pick<T extends object, K extends keyof T>(object: T, names: Rea
|
|
|
2884
3032
|
* @dataLast
|
|
2885
3033
|
* @category Object
|
|
2886
3034
|
*/
|
|
2887
|
-
declare function pick<K extends
|
|
3035
|
+
declare function pick<T extends object, K extends keyof T>(names: ReadonlyArray<K>): (object: T) => Pick<T, K>;
|
|
2888
3036
|
|
|
2889
3037
|
/**
|
|
2890
3038
|
* Creates an object composed of the picked `object` properties.
|
|
@@ -2945,14 +3093,6 @@ declare function set<T, K extends keyof T>(obj: T, prop: K, value: T[K]): T;
|
|
|
2945
3093
|
*/
|
|
2946
3094
|
declare function set<T, K extends keyof T>(prop: K, value: T[K]): (obj: T) => T;
|
|
2947
3095
|
|
|
2948
|
-
type Path<Obj, Prefix extends Array<PropertyKey> = []> = Obj extends Primitive ? Prefix : Obj extends Array<infer Item> ? Prefix | Path<Item, [...Prefix, number]> : Prefix | PathsOfObject<Obj, Prefix>;
|
|
2949
|
-
type PathsOfObject<Obj, Prefix extends Array<PropertyKey>> = {
|
|
2950
|
-
[K in keyof Obj]: Path<Obj[K], [...Prefix, K]>;
|
|
2951
|
-
}[keyof Obj];
|
|
2952
|
-
type ValueAtPath<Obj, ObjPath extends Array<PropertyKey> = []> = ObjPath extends [] ? Obj : ObjPath extends [infer Head, ...infer Tail] ? Tail extends Array<PropertyKey> ? Head extends keyof Obj ? ValueAtPath<Obj[Head], Tail> : never : never : never;
|
|
2953
|
-
type SupportsValueAtPath<Obj, Path extends Array<PropertyKey>, Value> = Value extends ValueAtPath<Obj, Path> ? Obj : never;
|
|
2954
|
-
type Primitive = string | number | boolean | null | undefined | symbol;
|
|
2955
|
-
|
|
2956
3096
|
/**
|
|
2957
3097
|
* Copied from ts-toolbelt
|
|
2958
3098
|
* https://github.com/millsp/ts-toolbelt/blob/master/sources/Function/Narrow.ts
|
|
@@ -2977,13 +3117,13 @@ type Try<A1, A2, Catch = never> = A1 extends A2 ? A1 : Catch;
|
|
|
2977
3117
|
/**
|
|
2978
3118
|
* Describes types that can be narrowed
|
|
2979
3119
|
*/
|
|
2980
|
-
type Narrowable =
|
|
3120
|
+
type Narrowable = bigint | boolean | number | string;
|
|
2981
3121
|
/**
|
|
2982
3122
|
* @hidden
|
|
2983
3123
|
*/
|
|
2984
|
-
type NarrowRaw<A> =
|
|
3124
|
+
type NarrowRaw<A> = {
|
|
2985
3125
|
[K in keyof A]: A[K] extends (...args: Array<any>) => any ? A[K] : NarrowRaw<A[K]>;
|
|
2986
|
-
};
|
|
3126
|
+
} | (A extends [] ? [] : never) | (A extends Narrowable ? A : never);
|
|
2987
3127
|
/**
|
|
2988
3128
|
* Prevent type widening on generic function parameters
|
|
2989
3129
|
* @param A to narrow
|
|
@@ -3004,6 +3144,14 @@ type NarrowRaw<A> = (A extends [] ? [] : never) | (A extends Narrowable ? A : ne
|
|
|
3004
3144
|
*/
|
|
3005
3145
|
type Narrow<A> = Try<A, [], NarrowRaw<A>>;
|
|
3006
3146
|
|
|
3147
|
+
type Path<Obj, Prefix extends Array<PropertyKey> = []> = Obj extends Primitive ? Prefix : Obj extends Array<infer Item> ? Path<Item, [...Prefix, number]> | Prefix : PathsOfObject<Obj, Prefix> | Prefix;
|
|
3148
|
+
type PathsOfObject<Obj, Prefix extends Array<PropertyKey>> = {
|
|
3149
|
+
[K in keyof Obj]: Path<Obj[K], [...Prefix, K]>;
|
|
3150
|
+
}[keyof Obj];
|
|
3151
|
+
type ValueAtPath<Obj, ObjPath extends Array<PropertyKey> = []> = ObjPath extends [] ? Obj : ObjPath extends [infer Head, ...infer Tail] ? Tail extends Array<PropertyKey> ? Head extends keyof Obj ? ValueAtPath<Obj[Head], Tail> : never : never : never;
|
|
3152
|
+
type SupportsValueAtPath<Obj, Path extends Array<PropertyKey>, Value> = Value extends ValueAtPath<Obj, Path> ? Obj : never;
|
|
3153
|
+
type Primitive = boolean | null | number | string | symbol | undefined;
|
|
3154
|
+
|
|
3007
3155
|
/**
|
|
3008
3156
|
* Sets the value at `path` of `object`. `path` can be an array or a path string.
|
|
3009
3157
|
* @param object the target method
|
|
@@ -3114,10 +3262,10 @@ declare namespace toPairs {
|
|
|
3114
3262
|
* @pipeable
|
|
3115
3263
|
* @category Object
|
|
3116
3264
|
*/
|
|
3117
|
-
type Values<T extends object> = T extends ReadonlyArray<unknown>
|
|
3265
|
+
type Values<T extends object> = T extends [] | ReadonlyArray<unknown> ? Array<T[number]> : Array<T[keyof T]>;
|
|
3118
3266
|
declare function values<T extends object>(source: T): Values<T>;
|
|
3119
3267
|
|
|
3120
|
-
type Splitter = '
|
|
3268
|
+
type Splitter = '.' | '/' | '_' | '-';
|
|
3121
3269
|
type LastOfArray<T extends any[]> = T extends [...any, infer R] ? R : never;
|
|
3122
3270
|
type RemoveLastOfArray<T extends any[]> = T extends [...infer F, any] ? F : never;
|
|
3123
3271
|
type IsUpper<S extends string> = S extends Uppercase<S> ? true : false;
|
|
@@ -3151,14 +3299,14 @@ declare function splitByCase<T extends string, Separator extends readonly string
|
|
|
3151
3299
|
declare function toUpperFirst<S extends string>(string_: S): Capitalize<S>;
|
|
3152
3300
|
declare function toLowerFirst<S extends string>(string_: S): Uncapitalize<S>;
|
|
3153
3301
|
declare function toPascalCase(): '';
|
|
3154
|
-
declare function toPascalCase<T extends string |
|
|
3302
|
+
declare function toPascalCase<T extends readonly string[] | string>(string_?: T): PascalCase<T>;
|
|
3155
3303
|
declare function toCamelCase(): '';
|
|
3156
|
-
declare function toCamelCase<T extends string |
|
|
3304
|
+
declare function toCamelCase<T extends readonly string[] | string>(string_?: T): CamelCase<T>;
|
|
3157
3305
|
declare function toKebabCase(): '';
|
|
3158
|
-
declare function toKebabCase<T extends string |
|
|
3159
|
-
declare function toKebabCase<T extends string |
|
|
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>;
|
|
3160
3308
|
declare function toSnakeCase(): '';
|
|
3161
|
-
declare function toSnakeCase<T extends string |
|
|
3309
|
+
declare function toSnakeCase<T extends readonly string[] | string>(string_?: T): JoinByCase<T, '_'>;
|
|
3162
3310
|
|
|
3163
3311
|
/**
|
|
3164
3312
|
* Returns human readable file size.
|
|
@@ -3227,4 +3375,4 @@ declare function type(val: any): string;
|
|
|
3227
3375
|
|
|
3228
3376
|
declare const isBrowser: boolean;
|
|
3229
3377
|
|
|
3230
|
-
export { Joined, KEY_CODES, StringToPath, _setPath, addProp, allPass, anyPass, chunk, clamp, clone, compact, concat, countBy, createPipe, 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, 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 };
|
|
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 };
|