domma-js 0.56.0 → 0.58.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/README.md +2 -2
- package/assets/types/generated/public/assets/flags/africa.d.ts +6 -0
- package/assets/types/generated/public/assets/flags/americas.d.ts +6 -0
- package/assets/types/generated/public/assets/flags/asia.d.ts +6 -0
- package/assets/types/generated/public/assets/flags/europe.d.ts +9 -0
- package/assets/types/generated/public/assets/flags/index.d.ts +11 -0
- package/assets/types/generated/public/assets/flags/oceania.d.ts +2 -0
- package/assets/types/generated/public/assets/icons/buildings.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/code.d.ts +2 -0
- package/assets/types/generated/public/assets/icons/commerce.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/communication.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/devices.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/emojis.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/files.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/finance.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/forms.d.ts +5 -0
- package/assets/types/generated/public/assets/icons/health.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/index.d.ts +24 -0
- package/assets/types/generated/public/assets/icons/media.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/navigation.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/seasonal.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/social.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/sport.d.ts +6 -0
- package/assets/types/generated/public/assets/icons/status.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/transport.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/ui.d.ts +7 -0
- package/assets/types/generated/public/assets/icons/weather.d.ts +6 -0
- package/assets/types/generated/src/auth.d.ts +424 -0
- package/assets/types/generated/src/avatar.d.ts +270 -0
- package/assets/types/generated/src/binding-source.d.ts +58 -0
- package/assets/types/generated/src/butterfly-drawing.d.ts +2 -0
- package/assets/types/generated/src/component-factory.d.ts +150 -0
- package/assets/types/generated/src/component.d.ts +162 -0
- package/assets/types/generated/src/components/back-to-top.d.ts +150 -0
- package/assets/types/generated/src/components/badge.d.ts +208 -0
- package/assets/types/generated/src/components/card.d.ts +189 -0
- package/assets/types/generated/src/components/command-palette.d.ts +352 -0
- package/assets/types/generated/src/components/dropzone.d.ts +342 -0
- package/assets/types/generated/src/components/focus-trap.d.ts +238 -0
- package/assets/types/generated/src/components/loader.d.ts +133 -0
- package/assets/types/generated/src/components/modal.d.ts +339 -0
- package/assets/types/generated/src/components/range-slider.d.ts +267 -0
- package/assets/types/generated/src/components/shared.d.ts +91 -0
- package/assets/types/generated/src/components/split-pane.d.ts +239 -0
- package/assets/types/generated/src/components/toast.d.ts +284 -0
- package/assets/types/generated/src/components/tooltip.d.ts +200 -0
- package/assets/types/generated/src/components/virtual-list.d.ts +340 -0
- package/assets/types/generated/src/config.d.ts +193 -0
- package/assets/types/generated/src/context-cursor.d.ts +69 -0
- package/assets/types/generated/src/context-menu.d.ts +596 -0
- package/assets/types/generated/src/dates.d.ts +367 -0
- package/assets/types/generated/src/dom.d.ts +1221 -0
- package/assets/types/generated/src/effects.d.ts +1281 -0
- package/assets/types/generated/src/elements.d.ts +4994 -0
- package/assets/types/generated/src/escape.d.ts +5 -0
- package/assets/types/generated/src/flags-bundle.d.ts +4 -0
- package/assets/types/generated/src/flags.d.ts +338 -0
- package/assets/types/generated/src/forms.d.ts +1060 -0
- package/assets/types/generated/src/globals.d.ts +45 -0
- package/assets/types/generated/src/http.d.ts +131 -0
- package/assets/types/generated/src/i18n.d.ts +261 -0
- package/assets/types/generated/src/icons.d.ts +213 -0
- package/assets/types/generated/src/index.d.ts +249 -0
- package/assets/types/generated/src/input-group.d.ts +135 -0
- package/assets/types/generated/src/models.d.ts +968 -0
- package/assets/types/generated/src/popover.d.ts +413 -0
- package/assets/types/generated/src/router.d.ts +344 -0
- package/assets/types/generated/src/safe-url.d.ts +10 -0
- package/assets/types/generated/src/sanitize.d.ts +97 -0
- package/assets/types/generated/src/schema-builder.d.ts +420 -0
- package/assets/types/generated/src/skeleton.d.ts +135 -0
- package/assets/types/generated/src/smooth-caret.d.ts +61 -0
- package/assets/types/generated/src/sortable.d.ts +368 -0
- package/assets/types/generated/src/storage.d.ts +93 -0
- package/assets/types/generated/src/tables.d.ts +901 -0
- package/assets/types/generated/src/theme.d.ts +262 -0
- package/assets/types/generated/src/ticker-tape-drawing.d.ts +2 -0
- package/assets/types/generated/src/treeview.d.ts +504 -0
- package/assets/types/generated/src/utils.d.ts +1667 -0
- package/assets/types/generated/src/web-components/base/domma-element.d.ts +134 -0
- package/assets/types/generated/src/web-components/index.d.ts +14 -0
- package/assets/types/generated/vendor/domma-reactive.d.ts +587 -0
- package/assets/types/index.d.ts +104 -226
- package/package.json +5 -2
- package/public/dist/bundles/domma-complete.css +20 -14
- package/public/dist/bundles/domma-data-focused.css +20 -14
- package/public/dist/bundles/domma-essentials.css +20 -14
- package/public/dist/bundles/domma-full.css +20 -14
- package/public/dist/bundles/domma-minimal.css +8 -8
- package/public/dist/domma-flags.esm.js +3 -3
- package/public/dist/domma-flags.esm.js.map +1 -1
- package/public/dist/domma-flags.min.js +3 -3
- package/public/dist/domma-flags.min.js.map +1 -1
- package/public/dist/domma-syntax.min.js +3 -3
- package/public/dist/domma.css +3 -3
- package/public/dist/domma.esm.js +5 -5
- package/public/dist/domma.esm.js.map +1 -1
- package/public/dist/domma.min.js +5 -5
- package/public/dist/domma.min.js.map +1 -1
- package/public/dist/elements.css +9 -3
- package/public/dist/grid.css +3 -3
- package/public/dist/syntax.css +3 -3
- package/public/dist/themes/domma-themes.css +3 -3
- package/templates/kickstart/.claude/snippets.md +1 -1
- package/templates/kickstart/CLAUDE.md +1 -1
- package/templates/kickstart/frontend/types/domma.d.ts +7 -4
- package/templates/kickstart-spa/.claude/snippets.md +1 -1
- package/assets/types/config.d.ts +0 -136
- package/assets/types/dates.d.ts +0 -209
- package/assets/types/dom.d.ts +0 -448
- package/assets/types/elements.d.ts +0 -1168
- package/assets/types/flags.d.ts +0 -130
- package/assets/types/http.d.ts +0 -97
- package/assets/types/i18n.d.ts +0 -99
- package/assets/types/icons.d.ts +0 -147
- package/assets/types/models.d.ts +0 -260
- package/assets/types/smooth-caret.d.ts +0 -12
- package/assets/types/storage.d.ts +0 -93
- package/assets/types/tables.d.ts +0 -327
- package/assets/types/theme.d.ts +0 -137
- package/assets/types/utils.d.ts +0 -675
|
@@ -0,0 +1,1667 @@
|
|
|
1
|
+
export namespace utils {
|
|
2
|
+
/**
|
|
3
|
+
* Creates an array of elements split into groups of the specified size.
|
|
4
|
+
* @template T
|
|
5
|
+
* @param {T[]} array
|
|
6
|
+
* @param {number} [size=1]
|
|
7
|
+
* @returns {T[][]}
|
|
8
|
+
*/
|
|
9
|
+
function chunk<T>(array: T[], size?: number): T[][];
|
|
10
|
+
/**
|
|
11
|
+
* Creates an array with all falsy values removed.
|
|
12
|
+
* @template T
|
|
13
|
+
* @param {T[]} array
|
|
14
|
+
* @returns {Exclude<T, false | null | 0 | '' | undefined>[]}
|
|
15
|
+
*/
|
|
16
|
+
function compact<T>(array: T[]): Exclude<T, false | null | 0 | "" | undefined>[];
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new array concatenating array with additional arrays/values.
|
|
19
|
+
* @template T
|
|
20
|
+
* @param {T[]} array
|
|
21
|
+
* @param {...(T | T[])} values
|
|
22
|
+
* @returns {T[]}
|
|
23
|
+
*/
|
|
24
|
+
function concat<T>(array: T[], ...values: (T | T[])[]): T[];
|
|
25
|
+
/**
|
|
26
|
+
* Creates an array of values not included in the other given arrays.
|
|
27
|
+
* @template T
|
|
28
|
+
* @param {T[]} array
|
|
29
|
+
* @param {...T[]} values
|
|
30
|
+
* @returns {T[]}
|
|
31
|
+
*/
|
|
32
|
+
function difference<T>(array: T[], ...values: T[][]): T[];
|
|
33
|
+
/**
|
|
34
|
+
* Like `difference`, but accepts an iteratee which is invoked for each element of array and values to generate the criterion by which they're compared.
|
|
35
|
+
* @template T
|
|
36
|
+
* @param {T[]} array
|
|
37
|
+
* @param {T[]} values
|
|
38
|
+
* @param {(value: T) => any} iteratee
|
|
39
|
+
* @returns {T[]}
|
|
40
|
+
*/
|
|
41
|
+
function differenceBy<T>(array: T[], values: T[], iteratee: (value: T) => any): T[];
|
|
42
|
+
/**
|
|
43
|
+
* Like `difference`, but accepts a comparator which is invoked to compare elements of array to values.
|
|
44
|
+
* @template T, U
|
|
45
|
+
* @param {T[]} array
|
|
46
|
+
* @param {U[]} values
|
|
47
|
+
* @param {(a: T, b: U) => boolean} comparator
|
|
48
|
+
* @returns {T[]}
|
|
49
|
+
*/
|
|
50
|
+
function differenceWith<T, U>(array: T[], values: U[], comparator: (a: T, b: U) => boolean): T[];
|
|
51
|
+
/**
|
|
52
|
+
* Creates a slice of array with n elements dropped from the beginning.
|
|
53
|
+
* @template T
|
|
54
|
+
* @param {T[]} array
|
|
55
|
+
* @param {number} [n=1]
|
|
56
|
+
* @returns {T[]}
|
|
57
|
+
*/
|
|
58
|
+
function drop<T>(array: T[], n?: number): T[];
|
|
59
|
+
/**
|
|
60
|
+
* Creates a slice of array with n elements dropped from the end.
|
|
61
|
+
* @template T
|
|
62
|
+
* @param {T[]} array
|
|
63
|
+
* @param {number} [n=1]
|
|
64
|
+
* @returns {T[]}
|
|
65
|
+
*/
|
|
66
|
+
function dropRight<T>(array: T[], n?: number): T[];
|
|
67
|
+
/**
|
|
68
|
+
* Creates a slice of array excluding elements dropped from the end.
|
|
69
|
+
* @template T
|
|
70
|
+
* @param {T[]} array
|
|
71
|
+
* @param {(value: T, index: number, array: T[]) => boolean} predicate
|
|
72
|
+
* @returns {T[]}
|
|
73
|
+
*/
|
|
74
|
+
function dropRightWhile<T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean): T[];
|
|
75
|
+
/**
|
|
76
|
+
* Creates a slice of array excluding elements dropped from the beginning.
|
|
77
|
+
* @template T
|
|
78
|
+
* @param {T[]} array
|
|
79
|
+
* @param {(value: T, index: number, array: T[]) => boolean} predicate
|
|
80
|
+
* @returns {T[]}
|
|
81
|
+
*/
|
|
82
|
+
function dropWhile<T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean): T[];
|
|
83
|
+
/**
|
|
84
|
+
* Performs a Same-value-zero comparison between two values to determine if they are equivalent.
|
|
85
|
+
* @param {any} value
|
|
86
|
+
* @param {any} other
|
|
87
|
+
* @returns {boolean}
|
|
88
|
+
*/
|
|
89
|
+
function eq(value: any, other: any): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Fills elements of array with value from start up to end.
|
|
92
|
+
* @template T
|
|
93
|
+
* @param {T[]} array
|
|
94
|
+
* @param {T} value
|
|
95
|
+
* @param {number} [start=0]
|
|
96
|
+
* @param {number} [end]
|
|
97
|
+
* @returns {T[]}
|
|
98
|
+
*/
|
|
99
|
+
function fill<T>(array: T[], value: T, start?: number, end?: number): T[];
|
|
100
|
+
/**
|
|
101
|
+
* Returns the index of the first element predicate returns truthy for.
|
|
102
|
+
* @template T
|
|
103
|
+
* @param {T[]} array
|
|
104
|
+
* @param {(value: T, index: number, array: T[]) => boolean} predicate
|
|
105
|
+
* @param {number} [fromIndex=0]
|
|
106
|
+
* @returns {number}
|
|
107
|
+
*/
|
|
108
|
+
function findIndex<T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean, fromIndex?: number): number;
|
|
109
|
+
/**
|
|
110
|
+
* Returns the index of the last element predicate returns truthy for.
|
|
111
|
+
* @template T
|
|
112
|
+
* @param {T[]} array
|
|
113
|
+
* @param {(value: T, index: number, array: T[]) => boolean} predicate
|
|
114
|
+
* @param {number} [fromIndex]
|
|
115
|
+
* @returns {number}
|
|
116
|
+
*/
|
|
117
|
+
function findLastIndex<T>(array: T[], predicate: (value: T, index: number, array: T[]) => boolean, fromIndex?: number): number;
|
|
118
|
+
/**
|
|
119
|
+
* Gets the first element of array.
|
|
120
|
+
* @template T
|
|
121
|
+
* @param {T[]} array
|
|
122
|
+
* @returns {T | undefined}
|
|
123
|
+
*/
|
|
124
|
+
function first<T>(array: T[]): T | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Alias for first.
|
|
127
|
+
* @template T
|
|
128
|
+
* @param {T[]} array
|
|
129
|
+
* @returns {T | undefined}
|
|
130
|
+
*/
|
|
131
|
+
function head<T>(array: T[]): T | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Flattens array a single level deep.
|
|
134
|
+
* @template T
|
|
135
|
+
* @param {(T | T[])[]} array
|
|
136
|
+
* @returns {T[]}
|
|
137
|
+
*/
|
|
138
|
+
function flatten<T>(array: (T | T[])[]): T[];
|
|
139
|
+
/**
|
|
140
|
+
* Recursively flattens array.
|
|
141
|
+
* @template T
|
|
142
|
+
* @param {any[]} array
|
|
143
|
+
* @returns {T[]}
|
|
144
|
+
*/
|
|
145
|
+
function flattenDeep<T>(array: any[]): T[];
|
|
146
|
+
/**
|
|
147
|
+
* Flattens array up to depth times.
|
|
148
|
+
* @template T
|
|
149
|
+
* @param {any[]} array
|
|
150
|
+
* @param {number} [depth=1]
|
|
151
|
+
* @returns {T[]}
|
|
152
|
+
*/
|
|
153
|
+
function flattenDepth<T>(array: any[], depth?: number): T[];
|
|
154
|
+
/**
|
|
155
|
+
* Returns an object composed from key-value pairs.
|
|
156
|
+
* @template T
|
|
157
|
+
* @param {[PropertyKey, T][]} pairs
|
|
158
|
+
* @returns {Record<string, T>}
|
|
159
|
+
*/
|
|
160
|
+
function fromPairs<T>(pairs: [PropertyKey, T][]): Record<string, T>;
|
|
161
|
+
/**
|
|
162
|
+
* Gets the index at which the first occurrence of value is found.
|
|
163
|
+
* @template T
|
|
164
|
+
* @param {T[]} array
|
|
165
|
+
* @param {T} value
|
|
166
|
+
* @param {number} [fromIndex=0]
|
|
167
|
+
* @returns {number}
|
|
168
|
+
*/
|
|
169
|
+
function indexOf<T>(array: T[], value: T, fromIndex?: number): number;
|
|
170
|
+
/**
|
|
171
|
+
* Gets all but the last element of array.
|
|
172
|
+
* @template T
|
|
173
|
+
* @param {T[]} array
|
|
174
|
+
* @returns {T[]}
|
|
175
|
+
*/
|
|
176
|
+
function initial<T>(array: T[]): T[];
|
|
177
|
+
/**
|
|
178
|
+
* Creates an array of unique values that are included in all given arrays.
|
|
179
|
+
* @template T
|
|
180
|
+
* @param {...T[]} arrays
|
|
181
|
+
* @returns {T[]}
|
|
182
|
+
*/
|
|
183
|
+
function intersection<T>(...arrays: T[][]): T[];
|
|
184
|
+
/**
|
|
185
|
+
* Converts all elements in array into a string separated by separator.
|
|
186
|
+
* @param {any[]} array
|
|
187
|
+
* @param {string} [separator=',']
|
|
188
|
+
* @returns {string}
|
|
189
|
+
*/
|
|
190
|
+
function join(array: any[], separator?: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* Gets the last element of array.
|
|
193
|
+
* @template T
|
|
194
|
+
* @param {T[]} array
|
|
195
|
+
* @returns {T | undefined}
|
|
196
|
+
*/
|
|
197
|
+
function last<T>(array: T[]): T | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* Gets the index at which the last occurrence of value is found.
|
|
200
|
+
* @template T
|
|
201
|
+
* @param {T[]} array
|
|
202
|
+
* @param {T} value
|
|
203
|
+
* @param {number} [fromIndex]
|
|
204
|
+
* @returns {number}
|
|
205
|
+
*/
|
|
206
|
+
function lastIndexOf<T>(array: T[], value: T, fromIndex?: number): number;
|
|
207
|
+
/**
|
|
208
|
+
* Gets the element at index n of array.
|
|
209
|
+
* @template T
|
|
210
|
+
* @param {T[]} array
|
|
211
|
+
* @param {number} [n=0]
|
|
212
|
+
* @returns {T | undefined}
|
|
213
|
+
*/
|
|
214
|
+
function nth<T>(array: T[], n?: number): T | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Removes all given values from array.
|
|
217
|
+
* @template T
|
|
218
|
+
* @param {T[]} array
|
|
219
|
+
* @param {...T} values
|
|
220
|
+
* @returns {T[]}
|
|
221
|
+
*/
|
|
222
|
+
function pull<T>(array: T[], ...values: T[]): T[];
|
|
223
|
+
/**
|
|
224
|
+
* Removes elements from array corresponding to indexes.
|
|
225
|
+
* @template T
|
|
226
|
+
* @param {T[]} array
|
|
227
|
+
* @param {...(number | number[])} indexes
|
|
228
|
+
* @returns {T[]}
|
|
229
|
+
*/
|
|
230
|
+
function pullAt<T>(array: T[], ...indexes: (number | number[])[]): T[];
|
|
231
|
+
/**
|
|
232
|
+
* Reverses array so that the first element becomes the last.
|
|
233
|
+
* @template T
|
|
234
|
+
* @param {T[]} array
|
|
235
|
+
* @returns {T[]}
|
|
236
|
+
*/
|
|
237
|
+
function reverse<T>(array: T[]): T[];
|
|
238
|
+
/**
|
|
239
|
+
* Creates a slice of array from start up to end.
|
|
240
|
+
* @template T
|
|
241
|
+
* @param {T[]} array
|
|
242
|
+
* @param {number} [start=0]
|
|
243
|
+
* @param {number} [end]
|
|
244
|
+
* @returns {T[]}
|
|
245
|
+
*/
|
|
246
|
+
function slice<T>(array: T[], start?: number, end?: number): T[];
|
|
247
|
+
/**
|
|
248
|
+
* Gets all but the first element of array.
|
|
249
|
+
* @template T
|
|
250
|
+
* @param {T[]} array
|
|
251
|
+
* @returns {T[]}
|
|
252
|
+
*/
|
|
253
|
+
function tail<T>(array: T[]): T[];
|
|
254
|
+
/**
|
|
255
|
+
* Creates a slice of array with n elements taken from the beginning.
|
|
256
|
+
* @template T
|
|
257
|
+
* @param {T[]} array
|
|
258
|
+
* @param {number} [n=1]
|
|
259
|
+
* @returns {T[]}
|
|
260
|
+
*/
|
|
261
|
+
function take<T>(array: T[], n?: number): T[];
|
|
262
|
+
/**
|
|
263
|
+
* Creates a slice of array with n elements taken from the end.
|
|
264
|
+
* @template T
|
|
265
|
+
* @param {T[]} array
|
|
266
|
+
* @param {number} [n=1]
|
|
267
|
+
* @returns {T[]}
|
|
268
|
+
*/
|
|
269
|
+
function takeRight<T>(array: T[], n?: number): T[];
|
|
270
|
+
/**
|
|
271
|
+
* Creates an array of unique values, in order, from all given arrays.
|
|
272
|
+
* @template T
|
|
273
|
+
* @param {...T[]} arrays
|
|
274
|
+
* @returns {T[]}
|
|
275
|
+
*/
|
|
276
|
+
function union<T>(...arrays: T[][]): T[];
|
|
277
|
+
/**
|
|
278
|
+
* Creates a duplicate-free version of an array.
|
|
279
|
+
* @template T
|
|
280
|
+
* @param {T[]} array
|
|
281
|
+
* @returns {T[]}
|
|
282
|
+
*/
|
|
283
|
+
function uniq<T>(array: T[]): T[];
|
|
284
|
+
/**
|
|
285
|
+
* Creates a duplicate-free version using iteratee.
|
|
286
|
+
* @template T
|
|
287
|
+
* @param {T[]} array
|
|
288
|
+
* @param {(value: T) => any} iteratee
|
|
289
|
+
* @returns {T[]}
|
|
290
|
+
*/
|
|
291
|
+
function uniqBy<T>(array: T[], iteratee: (value: T) => any): T[];
|
|
292
|
+
/**
|
|
293
|
+
* Creates an array excluding all given values.
|
|
294
|
+
* @template T
|
|
295
|
+
* @param {T[]} array
|
|
296
|
+
* @param {...T} values
|
|
297
|
+
* @returns {T[]}
|
|
298
|
+
*/
|
|
299
|
+
function without<T>(array: T[], ...values: T[]): T[];
|
|
300
|
+
/**
|
|
301
|
+
* Creates an array of unique values that is the symmetric difference.
|
|
302
|
+
* @template T
|
|
303
|
+
* @param {...T[]} arrays
|
|
304
|
+
* @returns {T[]}
|
|
305
|
+
*/
|
|
306
|
+
function xor<T>(...arrays: T[][]): T[];
|
|
307
|
+
/**
|
|
308
|
+
* Creates an array of grouped elements.
|
|
309
|
+
* @template T
|
|
310
|
+
* @param {...T[]} arrays
|
|
311
|
+
* @returns {(T | undefined)[][]}
|
|
312
|
+
*/
|
|
313
|
+
function zip<T>(...arrays: T[][]): (T | undefined)[][];
|
|
314
|
+
/**
|
|
315
|
+
* Creates an object composed from arrays of keys and values.
|
|
316
|
+
* @template T
|
|
317
|
+
* @param {PropertyKey[]} keys
|
|
318
|
+
* @param {T[]} [values]
|
|
319
|
+
* @returns {Record<string, T | undefined>}
|
|
320
|
+
*/
|
|
321
|
+
function zipObject<T>(keys: PropertyKey[], values?: T[]): Record<string, T | undefined>;
|
|
322
|
+
/**
|
|
323
|
+
* Invoke `iteratee` n times (with the index).
|
|
324
|
+
* @template T
|
|
325
|
+
* @overload
|
|
326
|
+
* @param {number} n
|
|
327
|
+
* @param {(index: number) => T} iteratee
|
|
328
|
+
* @returns {T[]}
|
|
329
|
+
*/
|
|
330
|
+
function times<T>(n: number, iteratee: (index: number) => T): T[];
|
|
331
|
+
/**
|
|
332
|
+
* Without an iteratee: the indexes `0 .. n-1`.
|
|
333
|
+
* @overload
|
|
334
|
+
* @param {number} n
|
|
335
|
+
* @returns {number[]}
|
|
336
|
+
*/
|
|
337
|
+
function times(n: number): number[];
|
|
338
|
+
/**
|
|
339
|
+
* Numbers from 0 up to, but not including, `end` (counts down for a negative end).
|
|
340
|
+
* @overload
|
|
341
|
+
* @param {number} end
|
|
342
|
+
* @returns {number[]}
|
|
343
|
+
*/
|
|
344
|
+
function range(end: number): number[];
|
|
345
|
+
/**
|
|
346
|
+
* Numbers from `start` up to, but not including, `end`.
|
|
347
|
+
* @overload
|
|
348
|
+
* @param {number} start
|
|
349
|
+
* @param {number} end
|
|
350
|
+
* @param {number} [step]
|
|
351
|
+
* @returns {number[]}
|
|
352
|
+
*/
|
|
353
|
+
function range(start: number, end: number, step?: number): number[];
|
|
354
|
+
function uniqueId(prefix?: string): string;
|
|
355
|
+
/**
|
|
356
|
+
* Creates an object composed of keys generated from the results of running each element through iteratee.
|
|
357
|
+
* @template T
|
|
358
|
+
* @param {Collection<T>} collection
|
|
359
|
+
* @param {(value: T) => PropertyKey} iteratee
|
|
360
|
+
* @returns {Record<string, number>}
|
|
361
|
+
*/
|
|
362
|
+
function countBy<T>(collection: Collection<T>, iteratee: (value: T) => PropertyKey): Record<string, number>;
|
|
363
|
+
/**
|
|
364
|
+
* Iterates over elements invoking iteratee for each element.
|
|
365
|
+
* @template {Collection<any>} C
|
|
366
|
+
* @param {C} collection
|
|
367
|
+
* @param {Iteratee<C extends Collection<infer T> ? T : never, unknown>} iteratee
|
|
368
|
+
* @returns {C}
|
|
369
|
+
*/
|
|
370
|
+
function each<C extends Collection<any>>(collection: C, iteratee: Iteratee<C extends Collection<infer T> ? T : never, unknown>): C;
|
|
371
|
+
/**
|
|
372
|
+
* Alias for each.
|
|
373
|
+
* @template {Collection<any>} C
|
|
374
|
+
* @param {C} collection
|
|
375
|
+
* @param {Iteratee<C extends Collection<infer T> ? T : never, unknown>} iteratee
|
|
376
|
+
* @returns {C}
|
|
377
|
+
*/
|
|
378
|
+
function forEach<C extends Collection<any>>(collection: C, iteratee: Iteratee<C extends Collection<infer T> ? T : never, unknown>): C;
|
|
379
|
+
/**
|
|
380
|
+
* Iterates over elements in reverse invoking iteratee for each element.
|
|
381
|
+
* @template {Collection<any>} C
|
|
382
|
+
* @param {C} collection
|
|
383
|
+
* @param {Iteratee<C extends Collection<infer T> ? T : never, unknown>} iteratee
|
|
384
|
+
* @returns {C}
|
|
385
|
+
*/
|
|
386
|
+
function eachRight<C extends Collection<any>>(collection: C, iteratee: Iteratee<C extends Collection<infer T> ? T : never, unknown>): C;
|
|
387
|
+
/**
|
|
388
|
+
* Alias for eachRight.
|
|
389
|
+
* @template {Collection<any>} C
|
|
390
|
+
* @param {C} collection
|
|
391
|
+
* @param {Iteratee<C extends Collection<infer T> ? T : never, unknown>} iteratee
|
|
392
|
+
* @returns {C}
|
|
393
|
+
*/
|
|
394
|
+
function forEachRight<C extends Collection<any>>(collection: C, iteratee: Iteratee<C extends Collection<infer T> ? T : never, unknown>): C;
|
|
395
|
+
/**
|
|
396
|
+
* Checks if predicate returns truthy for all elements of collection.
|
|
397
|
+
* @template T
|
|
398
|
+
* @param {Collection<T>} collection
|
|
399
|
+
* @param {Predicate<T>} predicate
|
|
400
|
+
* @returns {boolean}
|
|
401
|
+
*/
|
|
402
|
+
function every<T>(collection: Collection<T>, predicate: Predicate<T>): boolean;
|
|
403
|
+
/**
|
|
404
|
+
* Iterates over elements returning an array of all elements predicate returns truthy for.
|
|
405
|
+
* @template T
|
|
406
|
+
* @param {Collection<T>} collection
|
|
407
|
+
* @param {Predicate<T>} predicate
|
|
408
|
+
* @returns {T[]}
|
|
409
|
+
*/
|
|
410
|
+
function filter<T>(collection: Collection<T>, predicate: Predicate<T>): T[];
|
|
411
|
+
/**
|
|
412
|
+
* Iterates over elements returning the first element predicate returns truthy for.
|
|
413
|
+
* @template T
|
|
414
|
+
* @param {Collection<T>} collection
|
|
415
|
+
* @param {Predicate<T>} predicate
|
|
416
|
+
* @returns {T | undefined}
|
|
417
|
+
*/
|
|
418
|
+
function find<T>(collection: Collection<T>, predicate: Predicate<T>): T | undefined;
|
|
419
|
+
/**
|
|
420
|
+
* Iterates over elements returning the last element predicate returns truthy for.
|
|
421
|
+
* @template T
|
|
422
|
+
* @param {Collection<T>} collection
|
|
423
|
+
* @param {Predicate<T>} predicate
|
|
424
|
+
* @returns {T | undefined}
|
|
425
|
+
*/
|
|
426
|
+
function findLast<T>(collection: Collection<T>, predicate: Predicate<T>): T | undefined;
|
|
427
|
+
/**
|
|
428
|
+
* Creates a flattened array of values by running each element through iteratee.
|
|
429
|
+
* @template T, R
|
|
430
|
+
* @param {Collection<T>} collection
|
|
431
|
+
* @param {Iteratee<T, R | R[]>} iteratee
|
|
432
|
+
* @returns {R[]}
|
|
433
|
+
*/
|
|
434
|
+
function flatMap<T, R>(collection: Collection<T>, iteratee: Iteratee<T, R | R[]>): R[];
|
|
435
|
+
/**
|
|
436
|
+
* Recursively flattens the mapped results.
|
|
437
|
+
* @template T, R
|
|
438
|
+
* @param {Collection<T>} collection
|
|
439
|
+
* @param {Iteratee<T, any>} iteratee
|
|
440
|
+
* @returns {R[]}
|
|
441
|
+
*/
|
|
442
|
+
function flatMapDeep<T, R>(collection: Collection<T>, iteratee: Iteratee<T, any>): R[];
|
|
443
|
+
/**
|
|
444
|
+
* Creates an object composed of keys generated from the results of running each element through iteratee.
|
|
445
|
+
* @template T
|
|
446
|
+
* @param {Collection<T>} collection
|
|
447
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
448
|
+
* @returns {Record<string, T[]>}
|
|
449
|
+
*/
|
|
450
|
+
function groupBy<T>(collection: Collection<T>, iteratee: PropertyIteratee<T>): Record<string, T[]>;
|
|
451
|
+
/**
|
|
452
|
+
* Checks if value is in collection.
|
|
453
|
+
* @template T
|
|
454
|
+
* @param {Collection<T> | string} collection
|
|
455
|
+
* @param {T | string} value
|
|
456
|
+
* @param {number} [fromIndex=0]
|
|
457
|
+
* @returns {boolean}
|
|
458
|
+
*/
|
|
459
|
+
function includes<T>(collection: Collection<T> | string, value: T | string, fromIndex?: number): boolean;
|
|
460
|
+
/**
|
|
461
|
+
* Creates an object composed of keys generated from the results of running each element through iteratee.
|
|
462
|
+
* @template T
|
|
463
|
+
* @param {Collection<T>} collection
|
|
464
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
465
|
+
* @returns {Record<string, T>}
|
|
466
|
+
*/
|
|
467
|
+
function keyBy<T>(collection: Collection<T>, iteratee: PropertyIteratee<T>): Record<string, T>;
|
|
468
|
+
/**
|
|
469
|
+
* Creates an array of values by running each element through iteratee.
|
|
470
|
+
* @template T, R
|
|
471
|
+
* @param {Collection<T>} collection
|
|
472
|
+
* @param {Iteratee<T, R>} iteratee
|
|
473
|
+
* @returns {R[]}
|
|
474
|
+
*/
|
|
475
|
+
function map<T, R>(collection: Collection<T>, iteratee: Iteratee<T, R>): R[];
|
|
476
|
+
/**
|
|
477
|
+
* Creates an array of elements sorted in ascending order by the results of running each element through iteratee.
|
|
478
|
+
* @template T
|
|
479
|
+
* @param {Collection<T>} collection
|
|
480
|
+
* @param {PropertyIteratee<T> | PropertyIteratee<T>[]} iteratees
|
|
481
|
+
* @param {('asc' | 'desc') | ('asc' | 'desc')[]} [orders]
|
|
482
|
+
* @returns {T[]}
|
|
483
|
+
*/
|
|
484
|
+
function orderBy<T>(collection: Collection<T>, iteratees: PropertyIteratee<T> | PropertyIteratee<T>[], orders?: ("asc" | "desc") | ("asc" | "desc")[]): T[];
|
|
485
|
+
/**
|
|
486
|
+
* Creates an array of elements split into two groups.
|
|
487
|
+
* @template T
|
|
488
|
+
* @param {Collection<T>} collection
|
|
489
|
+
* @param {Predicate<T>} predicate
|
|
490
|
+
* @returns {[T[], T[]]}
|
|
491
|
+
*/
|
|
492
|
+
function partition<T>(collection: Collection<T>, predicate: Predicate<T>): [T[], T[]];
|
|
493
|
+
/**
|
|
494
|
+
* Reduces collection to a value which is the accumulated result of running each element through iteratee.
|
|
495
|
+
* @template T, R
|
|
496
|
+
* @param {Collection<T>} collection
|
|
497
|
+
* @param {(accumulator: R, value: T, index: number | string, collection: Collection<T>) => R} iteratee
|
|
498
|
+
* @param {R} [accumulator]
|
|
499
|
+
* @returns {R}
|
|
500
|
+
*/
|
|
501
|
+
function reduce<T, R>(collection: Collection<T>, iteratee: (accumulator: R, value: T, index: number | string, collection: Collection<T>) => R, accumulator?: R): R;
|
|
502
|
+
/**
|
|
503
|
+
* Reduces collection from right to left.
|
|
504
|
+
* @template T, R
|
|
505
|
+
* @param {Collection<T>} collection
|
|
506
|
+
* @param {(accumulator: R, value: T, index: number | string, collection: Collection<T>) => R} iteratee
|
|
507
|
+
* @param {R} [accumulator]
|
|
508
|
+
* @returns {R}
|
|
509
|
+
*/
|
|
510
|
+
function reduceRight<T, R>(collection: Collection<T>, iteratee: (accumulator: R, value: T, index: number | string, collection: Collection<T>) => R, accumulator?: R): R;
|
|
511
|
+
/**
|
|
512
|
+
* The opposite of filter; returns elements predicate does not return truthy for.
|
|
513
|
+
* @template T
|
|
514
|
+
* @param {Collection<T>} collection
|
|
515
|
+
* @param {Predicate<T>} predicate
|
|
516
|
+
* @returns {T[]}
|
|
517
|
+
*/
|
|
518
|
+
function reject<T>(collection: Collection<T>, predicate: Predicate<T>): T[];
|
|
519
|
+
/**
|
|
520
|
+
* Gets a random element from collection.
|
|
521
|
+
* @template T
|
|
522
|
+
* @param {Collection<T>} collection
|
|
523
|
+
* @returns {T | undefined}
|
|
524
|
+
*/
|
|
525
|
+
function sample<T>(collection: Collection<T>): T | undefined;
|
|
526
|
+
/**
|
|
527
|
+
* Gets n random elements from collection.
|
|
528
|
+
* @template T
|
|
529
|
+
* @param {Collection<T>} collection
|
|
530
|
+
* @param {number} [n=1]
|
|
531
|
+
* @returns {T[]}
|
|
532
|
+
*/
|
|
533
|
+
function sampleSize<T>(collection: Collection<T>, n?: number): T[];
|
|
534
|
+
/**
|
|
535
|
+
* Creates a shuffled array using Fisher-Yates shuffle.
|
|
536
|
+
* @template T
|
|
537
|
+
* @param {Collection<T>} collection
|
|
538
|
+
* @returns {T[]}
|
|
539
|
+
*/
|
|
540
|
+
function shuffle<T>(collection: Collection<T>): T[];
|
|
541
|
+
/**
|
|
542
|
+
* Gets the size of collection.
|
|
543
|
+
* @param {Collection<any> | string | null | undefined} collection
|
|
544
|
+
* @returns {number}
|
|
545
|
+
*/
|
|
546
|
+
function size(collection: Collection<any> | string | null | undefined): number;
|
|
547
|
+
/**
|
|
548
|
+
* Checks if predicate returns truthy for any element of collection.
|
|
549
|
+
* @template T
|
|
550
|
+
* @param {Collection<T>} collection
|
|
551
|
+
* @param {Predicate<T>} predicate
|
|
552
|
+
* @returns {boolean}
|
|
553
|
+
*/
|
|
554
|
+
function some<T>(collection: Collection<T>, predicate: Predicate<T>): boolean;
|
|
555
|
+
/**
|
|
556
|
+
* Creates an array of elements sorted by iteratee.
|
|
557
|
+
* @template T
|
|
558
|
+
* @param {Collection<T>} collection
|
|
559
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
560
|
+
* @returns {T[]}
|
|
561
|
+
*/
|
|
562
|
+
function sortBy<T>(collection: Collection<T>, iteratee: PropertyIteratee<T>): T[];
|
|
563
|
+
/**
|
|
564
|
+
* Creates a function that invokes func once it's called n or more times.
|
|
565
|
+
* @template {(...args: any[]) => any} T
|
|
566
|
+
* @param {number} n
|
|
567
|
+
* @param {T} func
|
|
568
|
+
* @returns {(...args: Parameters<T>) => ReturnType<T> | undefined}
|
|
569
|
+
*/
|
|
570
|
+
function after<T extends (...args: any[]) => any>(n: number, func: T): (...args: Parameters<T>) => ReturnType<T> | undefined;
|
|
571
|
+
/**
|
|
572
|
+
* Creates a function that invokes func, with up to n arguments.
|
|
573
|
+
* @template {(...args: any[]) => any} T
|
|
574
|
+
* @param {T} func
|
|
575
|
+
* @param {number} [n=func.length]
|
|
576
|
+
* @returns {(...args: any[]) => ReturnType<T>}
|
|
577
|
+
*/
|
|
578
|
+
function ary<T extends (...args: any[]) => any>(func: T, n?: number): (...args: any[]) => ReturnType<T>;
|
|
579
|
+
/**
|
|
580
|
+
* Creates a function that invokes func while it's called less than n times.
|
|
581
|
+
* @template {(...args: any[]) => any} T
|
|
582
|
+
* @param {number} n
|
|
583
|
+
* @param {T} func
|
|
584
|
+
* @returns {(...args: Parameters<T>) => ReturnType<T> | undefined}
|
|
585
|
+
*/
|
|
586
|
+
function before<T extends (...args: any[]) => any>(n: number, func: T): (...args: Parameters<T>) => ReturnType<T> | undefined;
|
|
587
|
+
/**
|
|
588
|
+
* Creates a function that invokes func with the this binding of thisArg.
|
|
589
|
+
* @template {(...args: any[]) => any} T
|
|
590
|
+
* @param {T} func
|
|
591
|
+
* @param {any} thisArg
|
|
592
|
+
* @param {...any} partials
|
|
593
|
+
* @returns {(...args: any[]) => ReturnType<T>}
|
|
594
|
+
*/
|
|
595
|
+
function bind<T extends (...args: any[]) => any>(func: T, thisArg: any, ...partials: any[]): (...args: any[]) => ReturnType<T>;
|
|
596
|
+
/**
|
|
597
|
+
* Creates a function that accepts arguments of func and returns a function.
|
|
598
|
+
* @param {(...args: any[]) => any} func
|
|
599
|
+
* @param {number} [arity=func.length]
|
|
600
|
+
* @returns {(...args: any[]) => any}
|
|
601
|
+
*/
|
|
602
|
+
function curry(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any;
|
|
603
|
+
/**
|
|
604
|
+
* Creates a function that accepts arguments of func and returns a function (right to left).
|
|
605
|
+
* @param {(...args: any[]) => any} func
|
|
606
|
+
* @param {number} [arity=func.length]
|
|
607
|
+
* @returns {(...args: any[]) => any}
|
|
608
|
+
*/
|
|
609
|
+
function curryRight(func: (...args: any[]) => any, arity?: number): (...args: any[]) => any;
|
|
610
|
+
/**
|
|
611
|
+
* Creates a debounced function that delays invoking func until after wait ms.
|
|
612
|
+
* @template {(...args: any[]) => any} T
|
|
613
|
+
* @param {T} func
|
|
614
|
+
* @param {number} [wait=0]
|
|
615
|
+
* @param {DebounceOptions} [options]
|
|
616
|
+
* @returns {DebouncedFunction<T>}
|
|
617
|
+
*/
|
|
618
|
+
function debounce<T extends (...args: any[]) => any>(func: T, wait?: number, options?: DebounceOptions): DebouncedFunction<T>;
|
|
619
|
+
/**
|
|
620
|
+
* Defers invoking the func until the current call stack has cleared.
|
|
621
|
+
* @template {(...args: any[]) => any} T
|
|
622
|
+
* @param {T} func
|
|
623
|
+
* @param {Parameters<T>} args
|
|
624
|
+
* @returns {ReturnType<typeof setTimeout>}
|
|
625
|
+
*/
|
|
626
|
+
function defer<T extends (...args: any[]) => any>(func: T, ...args: Parameters<T>): ReturnType<typeof setTimeout>;
|
|
627
|
+
/**
|
|
628
|
+
* Invokes func after wait milliseconds.
|
|
629
|
+
* @template {(...args: any[]) => any} T
|
|
630
|
+
* @param {T} func
|
|
631
|
+
* @param {number} wait
|
|
632
|
+
* @param {Parameters<T>} args
|
|
633
|
+
* @returns {ReturnType<typeof setTimeout>}
|
|
634
|
+
*/
|
|
635
|
+
function delay<T extends (...args: any[]) => any>(func: T, wait: number, ...args: Parameters<T>): ReturnType<typeof setTimeout>;
|
|
636
|
+
/**
|
|
637
|
+
* Creates a function that invokes func with arguments reversed.
|
|
638
|
+
* @template {(...args: any[]) => any} T
|
|
639
|
+
* @param {T} func
|
|
640
|
+
* @returns {(...args: any[]) => ReturnType<T>}
|
|
641
|
+
*/
|
|
642
|
+
function flip<T extends (...args: any[]) => any>(func: T): (...args: any[]) => ReturnType<T>;
|
|
643
|
+
/**
|
|
644
|
+
* Creates a function that performs a left-to-right function composition.
|
|
645
|
+
* The result of each function is passed as the argument to the next.
|
|
646
|
+
* @param {...((...args: any[]) => any)} funcs - Functions to compose
|
|
647
|
+
* @returns {(...args: any[]) => any}
|
|
648
|
+
* @example
|
|
649
|
+
* const calculate = _.flow(
|
|
650
|
+
* x => x * 2,
|
|
651
|
+
* x => x + 10,
|
|
652
|
+
* x => x / 3
|
|
653
|
+
* );
|
|
654
|
+
* calculate(5); // ((5 * 2) + 10) / 3 = 6.67
|
|
655
|
+
*/
|
|
656
|
+
function flow(...funcs: ((...args: any[]) => any)[]): (...args: any[]) => any;
|
|
657
|
+
/**
|
|
658
|
+
* Creates a function that performs a right-to-left function composition.
|
|
659
|
+
* The result of each function is passed as the argument to the next (in reverse order).
|
|
660
|
+
* @param {...((...args: any[]) => any)} funcs - Functions to compose
|
|
661
|
+
* @returns {(...args: any[]) => any}
|
|
662
|
+
* @example
|
|
663
|
+
* const calculate = _.compose(
|
|
664
|
+
* x => x / 3,
|
|
665
|
+
* x => x + 10,
|
|
666
|
+
* x => x * 2
|
|
667
|
+
* );
|
|
668
|
+
* calculate(5); // ((5 * 2) + 10) / 3 = 6.67
|
|
669
|
+
*/
|
|
670
|
+
function compose(...funcs: ((...args: any[]) => any)[]): (...args: any[]) => any;
|
|
671
|
+
/**
|
|
672
|
+
* Creates a function that memoizes the result of func.
|
|
673
|
+
* @template {(...args: any[]) => any} T
|
|
674
|
+
* @param {T} func
|
|
675
|
+
* @param {(...args: Parameters<T>) => any} [resolver]
|
|
676
|
+
* @returns {MemoizedFunction<T>}
|
|
677
|
+
*/
|
|
678
|
+
function memoize<T extends (...args: any[]) => any>(func: T, resolver?: (...args: Parameters<T>) => any): MemoizedFunction<T>;
|
|
679
|
+
/**
|
|
680
|
+
* Creates a function that negates the result of the predicate func.
|
|
681
|
+
* @template {(...args: any[]) => any} T
|
|
682
|
+
* @param {T} predicate
|
|
683
|
+
* @returns {(...args: Parameters<T>) => boolean}
|
|
684
|
+
*/
|
|
685
|
+
function negate<T extends (...args: any[]) => any>(predicate: T): (...args: Parameters<T>) => boolean;
|
|
686
|
+
/**
|
|
687
|
+
* Creates a function that is restricted to invoking func once.
|
|
688
|
+
* @template {(...args: any[]) => any} T
|
|
689
|
+
* @param {T} func
|
|
690
|
+
* @returns {(...args: Parameters<T>) => ReturnType<T>}
|
|
691
|
+
*/
|
|
692
|
+
function once<T extends (...args: any[]) => any>(func: T): (...args: Parameters<T>) => ReturnType<T>;
|
|
693
|
+
/**
|
|
694
|
+
* Creates a function that invokes func with partials prepended.
|
|
695
|
+
* @template {(...args: any[]) => any} T
|
|
696
|
+
* @param {T} func
|
|
697
|
+
* @param {...any} partials
|
|
698
|
+
* @returns {(...args: any[]) => ReturnType<T>}
|
|
699
|
+
*/
|
|
700
|
+
function partial<T extends (...args: any[]) => any>(func: T, ...partials: any[]): (...args: any[]) => ReturnType<T>;
|
|
701
|
+
/**
|
|
702
|
+
* Creates a function that invokes func with partials appended.
|
|
703
|
+
* @template {(...args: any[]) => any} T
|
|
704
|
+
* @param {T} func
|
|
705
|
+
* @param {...any} partials
|
|
706
|
+
* @returns {(...args: any[]) => ReturnType<T>}
|
|
707
|
+
*/
|
|
708
|
+
function partialRight<T extends (...args: any[]) => any>(func: T, ...partials: any[]): (...args: any[]) => ReturnType<T>;
|
|
709
|
+
/**
|
|
710
|
+
* Creates a throttled function that only invokes func at most once per every wait ms.
|
|
711
|
+
* @template {(...args: any[]) => any} T
|
|
712
|
+
* @param {T} func
|
|
713
|
+
* @param {number} [wait=0]
|
|
714
|
+
* @param {ThrottleOptions} [options]
|
|
715
|
+
* @returns {DebouncedFunction<T>}
|
|
716
|
+
*/
|
|
717
|
+
function throttle<T extends (...args: any[]) => any>(func: T, wait?: number, options?: ThrottleOptions): DebouncedFunction<T>;
|
|
718
|
+
/**
|
|
719
|
+
* Creates a function that accepts up to one argument.
|
|
720
|
+
* @template {(...args: any[]) => any} T
|
|
721
|
+
* @param {T} func
|
|
722
|
+
* @returns {(arg: Parameters<T>[0]) => ReturnType<T>}
|
|
723
|
+
*/
|
|
724
|
+
function unary<T extends (...args: any[]) => any>(func: T): (arg: Parameters<T>[0]) => ReturnType<T>;
|
|
725
|
+
/**
|
|
726
|
+
* Creates a function that provides value to wrapper as its first argument.
|
|
727
|
+
* @template T, R
|
|
728
|
+
* @param {T} value
|
|
729
|
+
* @param {(value: T, ...args: any[]) => R} wrapper
|
|
730
|
+
* @returns {(...args: any[]) => R}
|
|
731
|
+
*/
|
|
732
|
+
function wrap<T, R>(value: T, wrapper: (value: T, ...args: any[]) => R): (...args: any[]) => R;
|
|
733
|
+
/**
|
|
734
|
+
* Assigns own enumerable string keyed properties of source objects to the destination object.
|
|
735
|
+
* @template {Record<PropertyKey, any>} T
|
|
736
|
+
* @param {T} object
|
|
737
|
+
* @param {...any} sources
|
|
738
|
+
* @returns {T}
|
|
739
|
+
*/
|
|
740
|
+
function assign<T extends Record<PropertyKey, any>>(object: T, ...sources: any[]): T;
|
|
741
|
+
/**
|
|
742
|
+
* Like assign but iterates over own and inherited source properties.
|
|
743
|
+
* @template {Record<PropertyKey, any>} T
|
|
744
|
+
* @param {T} object
|
|
745
|
+
* @param {...any} sources
|
|
746
|
+
* @returns {T}
|
|
747
|
+
*/
|
|
748
|
+
function assignIn<T extends Record<PropertyKey, any>>(object: T, ...sources: any[]): T;
|
|
749
|
+
/**
|
|
750
|
+
* Alias for assignIn.
|
|
751
|
+
* @template {Record<PropertyKey, any>} T
|
|
752
|
+
* @param {T} object
|
|
753
|
+
* @param {...any} sources
|
|
754
|
+
* @returns {T}
|
|
755
|
+
*/
|
|
756
|
+
function extend<T extends Record<PropertyKey, any>>(object: T, ...sources: any[]): T;
|
|
757
|
+
/**
|
|
758
|
+
* Creates an array of values corresponding to paths of object.
|
|
759
|
+
* @template {Record<PropertyKey, any>} T
|
|
760
|
+
* @param {T} object
|
|
761
|
+
* @param {...(string | string[])} paths
|
|
762
|
+
* @returns {any[]}
|
|
763
|
+
*/
|
|
764
|
+
function at<T extends Record<PropertyKey, any>>(object: T, ...paths: (string | string[])[]): any[];
|
|
765
|
+
/**
|
|
766
|
+
* Creates a shallow clone of value.
|
|
767
|
+
* @template T
|
|
768
|
+
* @param {T} value
|
|
769
|
+
* @returns {T}
|
|
770
|
+
*/
|
|
771
|
+
function clone<T>(value: T): T;
|
|
772
|
+
/**
|
|
773
|
+
* Creates a deep clone of value.
|
|
774
|
+
* @template T
|
|
775
|
+
* @param {T} value
|
|
776
|
+
* @returns {T}
|
|
777
|
+
*/
|
|
778
|
+
function cloneDeep<T>(value: T): T;
|
|
779
|
+
/**
|
|
780
|
+
* Assigns own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to undefined.
|
|
781
|
+
* @template {Record<PropertyKey, any>} T
|
|
782
|
+
* @param {T} object
|
|
783
|
+
* @param {...any} sources
|
|
784
|
+
* @returns {T}
|
|
785
|
+
*/
|
|
786
|
+
function defaults<T extends Record<PropertyKey, any>>(object: T, ...sources: any[]): T;
|
|
787
|
+
/**
|
|
788
|
+
* Like defaults but recursively assigns default properties.
|
|
789
|
+
* @template {Record<PropertyKey, any>} T
|
|
790
|
+
* @param {T} object
|
|
791
|
+
* @param {...any} sources
|
|
792
|
+
* @returns {T}
|
|
793
|
+
*/
|
|
794
|
+
function defaultsDeep<T extends Record<PropertyKey, any>>(object: T, ...sources: any[]): T;
|
|
795
|
+
/**
|
|
796
|
+
* Creates an array of own enumerable string keyed-value pairs.
|
|
797
|
+
* @template {Record<PropertyKey, any>} T
|
|
798
|
+
* @param {T} object
|
|
799
|
+
* @returns {[string, T[keyof T]][]}
|
|
800
|
+
*/
|
|
801
|
+
function entries<T extends Record<PropertyKey, any>>(object: T): [string, T[keyof T]][];
|
|
802
|
+
/**
|
|
803
|
+
* Alias for entries.
|
|
804
|
+
* @template {Record<PropertyKey, any>} T
|
|
805
|
+
* @param {T} object
|
|
806
|
+
* @returns {[string, T[keyof T]][]}
|
|
807
|
+
*/
|
|
808
|
+
function toPairs<T extends Record<PropertyKey, any>>(object: T): [string, T[keyof T]][];
|
|
809
|
+
/**
|
|
810
|
+
* Returns the key of the first element predicate returns truthy for.
|
|
811
|
+
* @template {Record<PropertyKey, any>} T
|
|
812
|
+
* @param {T} object
|
|
813
|
+
* @param {(value: T[keyof T], key: string, object: T) => boolean} predicate
|
|
814
|
+
* @returns {string | undefined}
|
|
815
|
+
*/
|
|
816
|
+
function findKey<T extends Record<PropertyKey, any>>(object: T, predicate: (value: T[keyof T], key: string, object: T) => boolean): string | undefined;
|
|
817
|
+
/**
|
|
818
|
+
* Returns the key of the last element predicate returns truthy for.
|
|
819
|
+
* @template {Record<PropertyKey, any>} T
|
|
820
|
+
* @param {T} object
|
|
821
|
+
* @param {(value: T[keyof T], key: string, object: T) => boolean} predicate
|
|
822
|
+
* @returns {string | undefined}
|
|
823
|
+
*/
|
|
824
|
+
function findLastKey<T extends Record<PropertyKey, any>>(object: T, predicate: (value: T[keyof T], key: string, object: T) => boolean): string | undefined;
|
|
825
|
+
/**
|
|
826
|
+
* Iterates over own and inherited enumerable string keyed properties of an object.
|
|
827
|
+
* @template {Record<PropertyKey, any>} T
|
|
828
|
+
* @param {T} object
|
|
829
|
+
* @param {(value: T[keyof T], key: string, object: T) => unknown} iteratee - Return `false` to stop
|
|
830
|
+
* @returns {T}
|
|
831
|
+
*/
|
|
832
|
+
function forIn<T extends Record<PropertyKey, any>>(object: T, iteratee: (value: T[keyof T], key: string, object: T) => unknown): T;
|
|
833
|
+
/**
|
|
834
|
+
* Iterates over own enumerable string keyed properties of an object.
|
|
835
|
+
* @template {Record<PropertyKey, any>} T
|
|
836
|
+
* @param {T} object
|
|
837
|
+
* @param {(value: T[keyof T], key: string, object: T) => unknown} iteratee - Return `false` to stop
|
|
838
|
+
* @returns {T}
|
|
839
|
+
*/
|
|
840
|
+
function forOwn<T extends Record<PropertyKey, any>>(object: T, iteratee: (value: T[keyof T], key: string, object: T) => unknown): T;
|
|
841
|
+
/**
|
|
842
|
+
* Gets the value at path of object.
|
|
843
|
+
* @template [T=any]
|
|
844
|
+
* @param {any} object
|
|
845
|
+
* @param {string | PropertyKey[]} path - Dot path (`'a.b[0].c'`) or array of keys
|
|
846
|
+
* @param {T} [defaultValue]
|
|
847
|
+
* @returns {T}
|
|
848
|
+
*/
|
|
849
|
+
function get<T = any>(object: any, path: string | PropertyKey[], defaultValue?: T): T;
|
|
850
|
+
/**
|
|
851
|
+
* Checks if path is a direct property of object.
|
|
852
|
+
* @param {any} object
|
|
853
|
+
* @param {string | PropertyKey[]} path
|
|
854
|
+
* @returns {boolean}
|
|
855
|
+
*/
|
|
856
|
+
function has(object: any, path: string | PropertyKey[]): boolean;
|
|
857
|
+
/**
|
|
858
|
+
* Creates an object composed of the inverted keys and values of object.
|
|
859
|
+
* @template {Record<PropertyKey, any>} T
|
|
860
|
+
* @param {T} object
|
|
861
|
+
* @returns {Record<string, string>}
|
|
862
|
+
*/
|
|
863
|
+
function invert<T extends Record<PropertyKey, any>>(object: T): Record<string, string>;
|
|
864
|
+
/**
|
|
865
|
+
* Like invert but accepts iteratee which is invoked for each element.
|
|
866
|
+
* @template {Record<PropertyKey, any>} T
|
|
867
|
+
* @param {T} object
|
|
868
|
+
* @param {(value: T[keyof T]) => PropertyKey} [iteratee]
|
|
869
|
+
* @returns {Record<string, string[]>}
|
|
870
|
+
*/
|
|
871
|
+
function invertBy<T extends Record<PropertyKey, any>>(object: T, iteratee?: (value: T[keyof T]) => PropertyKey): Record<string, string[]>;
|
|
872
|
+
/**
|
|
873
|
+
* Creates an array of the own enumerable property names of object.
|
|
874
|
+
* @template {Record<PropertyKey, any>} T
|
|
875
|
+
* @param {T} object
|
|
876
|
+
* @returns {string[]}
|
|
877
|
+
*/
|
|
878
|
+
function keys<T extends Record<PropertyKey, any>>(object: T): string[];
|
|
879
|
+
/**
|
|
880
|
+
* Creates an array of own and inherited enumerable property names.
|
|
881
|
+
* @template {Record<PropertyKey, any>} T
|
|
882
|
+
* @param {T} object
|
|
883
|
+
* @returns {string[]}
|
|
884
|
+
*/
|
|
885
|
+
function keysIn<T extends Record<PropertyKey, any>>(object: T): string[];
|
|
886
|
+
/**
|
|
887
|
+
* Creates an object with the same values as object and keys generated by running each own enumerable property through iteratee.
|
|
888
|
+
* @template {Record<PropertyKey, any>} T
|
|
889
|
+
* @param {T} object
|
|
890
|
+
* @param {(value: T[keyof T], key: string, object: T) => PropertyKey} iteratee
|
|
891
|
+
* @returns {Record<string, T[keyof T]>}
|
|
892
|
+
*/
|
|
893
|
+
function mapKeys<T extends Record<PropertyKey, any>>(object: T, iteratee: (value: T[keyof T], key: string, object: T) => PropertyKey): Record<string, T[keyof T]>;
|
|
894
|
+
/**
|
|
895
|
+
* Creates an object with the same keys as object and values generated by running each own enumerable property through iteratee.
|
|
896
|
+
* @template {Record<PropertyKey, any>} T, R
|
|
897
|
+
* @param {T} object
|
|
898
|
+
* @param {(value: T[keyof T], key: string, object: T) => R} iteratee
|
|
899
|
+
* @returns {{[K in keyof T]: R}}
|
|
900
|
+
*/
|
|
901
|
+
function mapValues<T extends Record<PropertyKey, any>, R>(object: T, iteratee: (value: T[keyof T], key: string, object: T) => R): { [K in keyof T]: R; };
|
|
902
|
+
/**
|
|
903
|
+
* Recursively merges own and inherited enumerable properties of source objects into the destination object.
|
|
904
|
+
* @template {Record<PropertyKey, any>} T
|
|
905
|
+
* @param {T} object
|
|
906
|
+
* @param {...any} sources
|
|
907
|
+
* @returns {T}
|
|
908
|
+
*/
|
|
909
|
+
function merge<T extends Record<PropertyKey, any>>(object: T, ...sources: any[]): T;
|
|
910
|
+
/**
|
|
911
|
+
* Creates an object composed of the own enumerable properties of object that are not omitted.
|
|
912
|
+
* @template {Record<PropertyKey, any>} T
|
|
913
|
+
* @template {keyof T} K
|
|
914
|
+
* @param {T} object
|
|
915
|
+
* @param {...(K | K[])} paths
|
|
916
|
+
* @returns {Omit<T, K>}
|
|
917
|
+
*/
|
|
918
|
+
function omit<T extends Record<PropertyKey, any>, K extends keyof T>(object: T, ...paths: (K | K[])[]): Omit<T, K>;
|
|
919
|
+
/**
|
|
920
|
+
* Creates an object composed of the properties predicate doesn't return truthy for.
|
|
921
|
+
* @template {Record<PropertyKey, any>} T
|
|
922
|
+
* @param {T} object
|
|
923
|
+
* @param {(value: T[keyof T], key: string) => boolean} predicate
|
|
924
|
+
* @returns {Partial<T>}
|
|
925
|
+
*/
|
|
926
|
+
function omitBy<T extends Record<PropertyKey, any>>(object: T, predicate: (value: T[keyof T], key: string) => boolean): Partial<T>;
|
|
927
|
+
/**
|
|
928
|
+
* Creates an object composed of the picked object properties.
|
|
929
|
+
* @template {Record<PropertyKey, any>} T
|
|
930
|
+
* @template {keyof T} K
|
|
931
|
+
* @param {T} object
|
|
932
|
+
* @param {...(K | K[])} paths
|
|
933
|
+
* @returns {Pick<T, K>}
|
|
934
|
+
*/
|
|
935
|
+
function pick<T extends Record<PropertyKey, any>, K extends keyof T>(object: T, ...paths: (K | K[])[]): Pick<T, K>;
|
|
936
|
+
/**
|
|
937
|
+
* Creates an object composed of the properties predicate returns truthy for.
|
|
938
|
+
* @template {Record<PropertyKey, any>} T
|
|
939
|
+
* @param {T} object
|
|
940
|
+
* @param {(value: T[keyof T], key: string) => boolean} predicate
|
|
941
|
+
* @returns {Partial<T>}
|
|
942
|
+
*/
|
|
943
|
+
function pickBy<T extends Record<PropertyKey, any>>(object: T, predicate: (value: T[keyof T], key: string) => boolean): Partial<T>;
|
|
944
|
+
/**
|
|
945
|
+
* Sets the value at path of object.
|
|
946
|
+
* @template {Record<PropertyKey, any>} T
|
|
947
|
+
* @param {T} object
|
|
948
|
+
* @param {string | PropertyKey[]} path
|
|
949
|
+
* @param {any} value
|
|
950
|
+
* @returns {T}
|
|
951
|
+
*/
|
|
952
|
+
function set<T extends Record<PropertyKey, any>>(object: T, path: string | PropertyKey[], value: any): T;
|
|
953
|
+
/**
|
|
954
|
+
* Removes the property at path of object.
|
|
955
|
+
* @param {any} object
|
|
956
|
+
* @param {string | PropertyKey[]} path
|
|
957
|
+
* @returns {boolean}
|
|
958
|
+
*/
|
|
959
|
+
function unset(object: any, path: string | PropertyKey[]): boolean;
|
|
960
|
+
/**
|
|
961
|
+
* Sets the value at path of object if the resolved value is undefined.
|
|
962
|
+
* @template {Record<PropertyKey, any>} T
|
|
963
|
+
* @param {T} object
|
|
964
|
+
* @param {string | PropertyKey[]} path
|
|
965
|
+
* @param {any} value
|
|
966
|
+
* @returns {T}
|
|
967
|
+
*/
|
|
968
|
+
function setIfUndefined<T extends Record<PropertyKey, any>>(object: T, path: string | PropertyKey[], value: any): T;
|
|
969
|
+
/**
|
|
970
|
+
* Creates an array of own enumerable string keyed property values of object.
|
|
971
|
+
* @template {Record<PropertyKey, any>} T
|
|
972
|
+
* @param {T} object
|
|
973
|
+
* @returns {T[keyof T][]}
|
|
974
|
+
*/
|
|
975
|
+
function values<T extends Record<PropertyKey, any>>(object: T): T[keyof T][];
|
|
976
|
+
/**
|
|
977
|
+
* Creates an array of own and inherited enumerable property values.
|
|
978
|
+
* @param {object} object
|
|
979
|
+
* @returns {any[]}
|
|
980
|
+
*/
|
|
981
|
+
function valuesIn(object: object): any[];
|
|
982
|
+
/**
|
|
983
|
+
* Checks if value is an Array.
|
|
984
|
+
* @param {unknown} value
|
|
985
|
+
* @returns {value is any[]}
|
|
986
|
+
*/
|
|
987
|
+
function isArray(value: unknown): value is any[];
|
|
988
|
+
/**
|
|
989
|
+
* Checks if value is a boolean primitive or object.
|
|
990
|
+
* @param {unknown} value
|
|
991
|
+
* @returns {value is boolean | Boolean}
|
|
992
|
+
*/
|
|
993
|
+
function isBoolean(value: unknown): value is boolean | boolean;
|
|
994
|
+
/**
|
|
995
|
+
* Checks if value is a Date object.
|
|
996
|
+
* @param {unknown} value
|
|
997
|
+
* @returns {value is Date}
|
|
998
|
+
*/
|
|
999
|
+
function isDate(value: unknown): value is Date;
|
|
1000
|
+
/**
|
|
1001
|
+
* Checks if value is an empty object, collection, map, or set.
|
|
1002
|
+
* @param {unknown} value
|
|
1003
|
+
* @returns {boolean}
|
|
1004
|
+
*/
|
|
1005
|
+
function isEmpty(value: unknown): boolean;
|
|
1006
|
+
/**
|
|
1007
|
+
* Performs a deep comparison between two values.
|
|
1008
|
+
* @param {any} value
|
|
1009
|
+
* @param {any} other
|
|
1010
|
+
* @returns {boolean}
|
|
1011
|
+
*/
|
|
1012
|
+
function isEqual(value: any, other: any): boolean;
|
|
1013
|
+
/**
|
|
1014
|
+
* Performs a partial deep comparison to determine if object contains equivalent property values.
|
|
1015
|
+
* @param {any} object - The object to inspect
|
|
1016
|
+
* @param {any} source - The object of property values to match
|
|
1017
|
+
* @returns {boolean} Returns true if object is a match
|
|
1018
|
+
*/
|
|
1019
|
+
function isMatch(object: any, source: any): boolean;
|
|
1020
|
+
/**
|
|
1021
|
+
* Checks if value is a finite number.
|
|
1022
|
+
* @param {unknown} value
|
|
1023
|
+
* @returns {value is number}
|
|
1024
|
+
*/
|
|
1025
|
+
function isFinite(value: unknown): value is number;
|
|
1026
|
+
/**
|
|
1027
|
+
* Checks if value is a Function object.
|
|
1028
|
+
* @param {unknown} value
|
|
1029
|
+
* @returns {value is (...args: any[]) => any}
|
|
1030
|
+
*/
|
|
1031
|
+
function isFunction(value: unknown): value is (...args: any[]) => any;
|
|
1032
|
+
/**
|
|
1033
|
+
* Checks if value is an integer.
|
|
1034
|
+
* @param {unknown} value
|
|
1035
|
+
* @returns {value is number}
|
|
1036
|
+
*/
|
|
1037
|
+
function isInteger(value: unknown): value is number;
|
|
1038
|
+
/**
|
|
1039
|
+
* Checks if value is NaN.
|
|
1040
|
+
* @param {unknown} value
|
|
1041
|
+
* @returns {boolean}
|
|
1042
|
+
*/
|
|
1043
|
+
function isNaN(value: unknown): boolean;
|
|
1044
|
+
/**
|
|
1045
|
+
* Checks if value is null or undefined.
|
|
1046
|
+
* @param {unknown} value
|
|
1047
|
+
* @returns {value is null | undefined}
|
|
1048
|
+
*/
|
|
1049
|
+
function isNil(value: unknown): value is null | undefined;
|
|
1050
|
+
/**
|
|
1051
|
+
* Checks if value is null.
|
|
1052
|
+
* @param {unknown} value
|
|
1053
|
+
* @returns {value is null}
|
|
1054
|
+
*/
|
|
1055
|
+
function isNull(value: unknown): value is null;
|
|
1056
|
+
/**
|
|
1057
|
+
* Checks if value is a number primitive or object.
|
|
1058
|
+
* @param {unknown} value
|
|
1059
|
+
* @returns {value is number | Number}
|
|
1060
|
+
*/
|
|
1061
|
+
function isNumber(value: unknown): value is number | number;
|
|
1062
|
+
/**
|
|
1063
|
+
* Checks if value is the language type of Object.
|
|
1064
|
+
* @param {unknown} value
|
|
1065
|
+
* @returns {value is object}
|
|
1066
|
+
*/
|
|
1067
|
+
function isObject(value: unknown): value is object;
|
|
1068
|
+
/**
|
|
1069
|
+
* Checks if value is a plain object.
|
|
1070
|
+
* @param {unknown} value
|
|
1071
|
+
* @returns {value is Record<string, any>}
|
|
1072
|
+
*/
|
|
1073
|
+
function isPlainObject(value: unknown): value is Record<string, any>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Checks if value is a RegExp object.
|
|
1076
|
+
* @param {unknown} value
|
|
1077
|
+
* @returns {value is RegExp}
|
|
1078
|
+
*/
|
|
1079
|
+
function isRegExp(value: unknown): value is RegExp;
|
|
1080
|
+
/**
|
|
1081
|
+
* Checks if value is a string primitive or object.
|
|
1082
|
+
* @param {unknown} value
|
|
1083
|
+
* @returns {value is string | String}
|
|
1084
|
+
*/
|
|
1085
|
+
function isString(value: unknown): value is string | string;
|
|
1086
|
+
/**
|
|
1087
|
+
* Checks if value is a Symbol primitive.
|
|
1088
|
+
* @param {unknown} value
|
|
1089
|
+
* @returns {value is symbol}
|
|
1090
|
+
*/
|
|
1091
|
+
function isSymbol(value: unknown): value is symbol;
|
|
1092
|
+
/**
|
|
1093
|
+
* Checks if value is undefined.
|
|
1094
|
+
* @param {unknown} value
|
|
1095
|
+
* @returns {value is undefined}
|
|
1096
|
+
*/
|
|
1097
|
+
function isUndefined(value: unknown): value is undefined;
|
|
1098
|
+
/**
|
|
1099
|
+
* Converts string to an integer of the specified radix.
|
|
1100
|
+
* @param {string | number | null | undefined} string - The string to convert
|
|
1101
|
+
* @param {number} [radix] - The radix to interpret the value
|
|
1102
|
+
* @returns {number} The converted integer
|
|
1103
|
+
*/
|
|
1104
|
+
function parseInt(string: string | number | null | undefined, radix?: number): number;
|
|
1105
|
+
/**
|
|
1106
|
+
* Converts value to a number.
|
|
1107
|
+
* @param {any} value - The value to process
|
|
1108
|
+
* @returns {number} The number
|
|
1109
|
+
*/
|
|
1110
|
+
function toNumber(value: any): number;
|
|
1111
|
+
/**
|
|
1112
|
+
* Converts value to an integer.
|
|
1113
|
+
* @param {any} value - The value to convert
|
|
1114
|
+
* @returns {number} The converted integer
|
|
1115
|
+
*/
|
|
1116
|
+
function toInteger(value: any): number;
|
|
1117
|
+
/**
|
|
1118
|
+
* Converts value to a finite number.
|
|
1119
|
+
* @param {any} value - The value to convert
|
|
1120
|
+
* @returns {number} The converted number
|
|
1121
|
+
*/
|
|
1122
|
+
function toFinite(value: any): number;
|
|
1123
|
+
/**
|
|
1124
|
+
* Converts value to a safe integer.
|
|
1125
|
+
* @param {any} value - The value to convert
|
|
1126
|
+
* @returns {number} The converted safe integer
|
|
1127
|
+
*/
|
|
1128
|
+
function toSafeInteger(value: any): number;
|
|
1129
|
+
/**
|
|
1130
|
+
* Converts value to a string.
|
|
1131
|
+
* @param {any} value - The value to convert
|
|
1132
|
+
* @returns {string} The converted string
|
|
1133
|
+
*/
|
|
1134
|
+
function toString(value: any): string;
|
|
1135
|
+
/**
|
|
1136
|
+
* A string becomes its characters.
|
|
1137
|
+
* @overload
|
|
1138
|
+
* @param {string} value
|
|
1139
|
+
* @returns {string[]}
|
|
1140
|
+
*/
|
|
1141
|
+
function toArray(value: string): string[];
|
|
1142
|
+
/**
|
|
1143
|
+
* An array, iterable or object becomes an array of its values.
|
|
1144
|
+
* @template T
|
|
1145
|
+
* @overload
|
|
1146
|
+
* @param {T[] | Iterable<T> | Record<string, T> | null | undefined} value
|
|
1147
|
+
* @returns {T[]}
|
|
1148
|
+
*/
|
|
1149
|
+
function toArray<T>(value: T[] | Iterable<T> | Record<string, T> | null | undefined): T[];
|
|
1150
|
+
/**
|
|
1151
|
+
* Casts value as an array if it's not one.
|
|
1152
|
+
* @template T
|
|
1153
|
+
* @param {...(T | T[])} args - Only the first is used
|
|
1154
|
+
* @returns {T[]} The cast array
|
|
1155
|
+
*/
|
|
1156
|
+
function castArray<T>(...args: (T | T[])[]): T[];
|
|
1157
|
+
/**
|
|
1158
|
+
* Converts value to an integer suitable for use as the length of an array-like object.
|
|
1159
|
+
* @param {any} value - The value to convert
|
|
1160
|
+
* @returns {number} The converted integer
|
|
1161
|
+
*/
|
|
1162
|
+
function toLength(value: any): number;
|
|
1163
|
+
/**
|
|
1164
|
+
* Converts value to a plain object flattening inherited enumerable string keyed properties.
|
|
1165
|
+
* @param {any} value - The value to convert
|
|
1166
|
+
* @returns {Record<string, any>} The converted plain object
|
|
1167
|
+
*/
|
|
1168
|
+
function toPlainObject(value: any): Record<string, any>;
|
|
1169
|
+
/**
|
|
1170
|
+
* Adds two numbers.
|
|
1171
|
+
* @param {number} augend
|
|
1172
|
+
* @param {number} addend
|
|
1173
|
+
* @returns {number}
|
|
1174
|
+
*/
|
|
1175
|
+
function add(augend: number, addend: number): number;
|
|
1176
|
+
/**
|
|
1177
|
+
* Computes number rounded up to precision.
|
|
1178
|
+
* @param {number} number
|
|
1179
|
+
* @param {number} [precision=0]
|
|
1180
|
+
* @returns {number}
|
|
1181
|
+
*/
|
|
1182
|
+
function ceil(number: number, precision?: number): number;
|
|
1183
|
+
/**
|
|
1184
|
+
* Divide two numbers.
|
|
1185
|
+
* @param {number} dividend
|
|
1186
|
+
* @param {number} divisor
|
|
1187
|
+
* @returns {number}
|
|
1188
|
+
*/
|
|
1189
|
+
function divide(dividend: number, divisor: number): number;
|
|
1190
|
+
/**
|
|
1191
|
+
* Computes number rounded down to precision.
|
|
1192
|
+
* @param {number} number
|
|
1193
|
+
* @param {number} [precision=0]
|
|
1194
|
+
* @returns {number}
|
|
1195
|
+
*/
|
|
1196
|
+
function floor(number: number, precision?: number): number;
|
|
1197
|
+
/**
|
|
1198
|
+
* Computes the maximum value of array.
|
|
1199
|
+
* @param {number[]} array
|
|
1200
|
+
* @returns {number | undefined}
|
|
1201
|
+
*/
|
|
1202
|
+
function max(array: number[]): number | undefined;
|
|
1203
|
+
/**
|
|
1204
|
+
* Computes the maximum value of array with iteratee.
|
|
1205
|
+
* @template T
|
|
1206
|
+
* @param {T[]} array
|
|
1207
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
1208
|
+
* @returns {T | undefined}
|
|
1209
|
+
*/
|
|
1210
|
+
function maxBy<T>(array: T[], iteratee: PropertyIteratee<T>): T | undefined;
|
|
1211
|
+
/**
|
|
1212
|
+
* Computes the mean of the values in array.
|
|
1213
|
+
* @param {number[]} array
|
|
1214
|
+
* @returns {number}
|
|
1215
|
+
*/
|
|
1216
|
+
function mean(array: number[]): number;
|
|
1217
|
+
/**
|
|
1218
|
+
* Computes the mean using iteratee.
|
|
1219
|
+
* @template T
|
|
1220
|
+
* @param {T[]} array
|
|
1221
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
1222
|
+
* @returns {number}
|
|
1223
|
+
*/
|
|
1224
|
+
function meanBy<T>(array: T[], iteratee: PropertyIteratee<T>): number;
|
|
1225
|
+
/**
|
|
1226
|
+
* Computes the minimum value of array.
|
|
1227
|
+
* @param {number[]} array
|
|
1228
|
+
* @returns {number | undefined}
|
|
1229
|
+
*/
|
|
1230
|
+
function min(array: number[]): number | undefined;
|
|
1231
|
+
/**
|
|
1232
|
+
* Computes the minimum value of array with iteratee.
|
|
1233
|
+
* @template T
|
|
1234
|
+
* @param {T[]} array
|
|
1235
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
1236
|
+
* @returns {T | undefined}
|
|
1237
|
+
*/
|
|
1238
|
+
function minBy<T>(array: T[], iteratee: PropertyIteratee<T>): T | undefined;
|
|
1239
|
+
/**
|
|
1240
|
+
* Multiply two numbers.
|
|
1241
|
+
* @param {number} multiplier
|
|
1242
|
+
* @param {number} multiplicand
|
|
1243
|
+
* @returns {number}
|
|
1244
|
+
*/
|
|
1245
|
+
function multiply(multiplier: number, multiplicand: number): number;
|
|
1246
|
+
/**
|
|
1247
|
+
* Computes number rounded to precision.
|
|
1248
|
+
* @param {number} number
|
|
1249
|
+
* @param {number} [precision=0]
|
|
1250
|
+
* @returns {number}
|
|
1251
|
+
*/
|
|
1252
|
+
function round(number: number, precision?: number): number;
|
|
1253
|
+
/**
|
|
1254
|
+
* Subtract two numbers.
|
|
1255
|
+
* @param {number} minuend
|
|
1256
|
+
* @param {number} subtrahend
|
|
1257
|
+
* @returns {number}
|
|
1258
|
+
*/
|
|
1259
|
+
function subtract(minuend: number, subtrahend: number): number;
|
|
1260
|
+
/**
|
|
1261
|
+
* Computes the sum of the values in array.
|
|
1262
|
+
* @param {number[]} array
|
|
1263
|
+
* @returns {number}
|
|
1264
|
+
*/
|
|
1265
|
+
function sum(array: number[]): number;
|
|
1266
|
+
/**
|
|
1267
|
+
* Computes the sum using iteratee.
|
|
1268
|
+
* @template T
|
|
1269
|
+
* @param {T[]} array
|
|
1270
|
+
* @param {PropertyIteratee<T>} iteratee
|
|
1271
|
+
* @returns {number}
|
|
1272
|
+
*/
|
|
1273
|
+
function sumBy<T>(array: T[], iteratee: PropertyIteratee<T>): number;
|
|
1274
|
+
/**
|
|
1275
|
+
* Clamp to an upper bound only.
|
|
1276
|
+
* @overload
|
|
1277
|
+
* @param {number} number
|
|
1278
|
+
* @param {number} upper
|
|
1279
|
+
* @returns {number}
|
|
1280
|
+
*/
|
|
1281
|
+
function clamp(number: number, upper: number): number;
|
|
1282
|
+
/**
|
|
1283
|
+
* Clamp to the inclusive lower and upper bounds.
|
|
1284
|
+
* @overload
|
|
1285
|
+
* @param {number} number
|
|
1286
|
+
* @param {number | undefined} lower
|
|
1287
|
+
* @param {number} upper
|
|
1288
|
+
* @returns {number}
|
|
1289
|
+
*/
|
|
1290
|
+
function clamp(number: number, lower: number | undefined, upper: number): number;
|
|
1291
|
+
/**
|
|
1292
|
+
* Is the number in `[0, end)`?
|
|
1293
|
+
* @overload
|
|
1294
|
+
* @param {number} number
|
|
1295
|
+
* @param {number} end
|
|
1296
|
+
* @returns {boolean}
|
|
1297
|
+
*/
|
|
1298
|
+
function inRange(number: number, end: number): boolean;
|
|
1299
|
+
/**
|
|
1300
|
+
* Is the number in `[start, end)` (the bounds are swapped when start > end)?
|
|
1301
|
+
* @overload
|
|
1302
|
+
* @param {number} number
|
|
1303
|
+
* @param {number} start
|
|
1304
|
+
* @param {number} end
|
|
1305
|
+
* @returns {boolean}
|
|
1306
|
+
*/
|
|
1307
|
+
function inRange(number: number, start: number, end: number): boolean;
|
|
1308
|
+
/**
|
|
1309
|
+
* Between 0 and 1 (a float when `floating`).
|
|
1310
|
+
* @overload
|
|
1311
|
+
* @param {boolean} [floating]
|
|
1312
|
+
* @returns {number}
|
|
1313
|
+
*/
|
|
1314
|
+
function random(floating?: boolean): number;
|
|
1315
|
+
/**
|
|
1316
|
+
* Between 0 and `upper` when `floating` is given; `random(n)` alone is between `n` and 1 (the bounds are swapped).
|
|
1317
|
+
* @overload
|
|
1318
|
+
* @param {number} upper
|
|
1319
|
+
* @param {boolean} floating
|
|
1320
|
+
* @returns {number}
|
|
1321
|
+
*/
|
|
1322
|
+
function random(upper: number, floating: boolean): number;
|
|
1323
|
+
/**
|
|
1324
|
+
* Between the inclusive bounds; a float when `floating` or either bound is fractional.
|
|
1325
|
+
* @overload
|
|
1326
|
+
* @param {number} lower
|
|
1327
|
+
* @param {number} [upper]
|
|
1328
|
+
* @param {boolean} [floating]
|
|
1329
|
+
* @returns {number}
|
|
1330
|
+
*/
|
|
1331
|
+
function random(lower: number, upper?: number, floating?: boolean): number;
|
|
1332
|
+
/**
|
|
1333
|
+
* Converts string to camel case.
|
|
1334
|
+
* @param {string} string
|
|
1335
|
+
* @returns {string}
|
|
1336
|
+
*/
|
|
1337
|
+
function camelCase(string: string): string;
|
|
1338
|
+
/**
|
|
1339
|
+
* Converts the first character of string to upper case and the remaining to lower case.
|
|
1340
|
+
* @param {string} string
|
|
1341
|
+
* @returns {string}
|
|
1342
|
+
*/
|
|
1343
|
+
function capitalize(string: string): string;
|
|
1344
|
+
/**
|
|
1345
|
+
* Checks if string ends with the given target string.
|
|
1346
|
+
* @param {string} string
|
|
1347
|
+
* @param {string} target
|
|
1348
|
+
* @param {number} [position]
|
|
1349
|
+
* @returns {boolean}
|
|
1350
|
+
*/
|
|
1351
|
+
function endsWith(string: string, target: string, position?: number): boolean;
|
|
1352
|
+
/**
|
|
1353
|
+
* Converts the characters "&", "<", ">", '"', and "'" to HTML entities.
|
|
1354
|
+
* @param {string} string
|
|
1355
|
+
* @returns {string}
|
|
1356
|
+
*/
|
|
1357
|
+
function escape(string: string): string;
|
|
1358
|
+
/**
|
|
1359
|
+
* Converts string to kebab case.
|
|
1360
|
+
* @param {string} string
|
|
1361
|
+
* @returns {string}
|
|
1362
|
+
*/
|
|
1363
|
+
function kebabCase(string: string): string;
|
|
1364
|
+
/**
|
|
1365
|
+
* Converts string, as space separated words, to lower case.
|
|
1366
|
+
* @param {string} string
|
|
1367
|
+
* @returns {string}
|
|
1368
|
+
*/
|
|
1369
|
+
function lowerCase(string: string): string;
|
|
1370
|
+
/**
|
|
1371
|
+
* Converts the first character of string to lower case.
|
|
1372
|
+
* @param {string} string
|
|
1373
|
+
* @returns {string}
|
|
1374
|
+
*/
|
|
1375
|
+
function lowerFirst(string: string): string;
|
|
1376
|
+
/**
|
|
1377
|
+
* Pads string on the left and right sides if it's shorter than length.
|
|
1378
|
+
* @param {string} [string='']
|
|
1379
|
+
* @param {number} [length=0]
|
|
1380
|
+
* @param {string} [chars=' ']
|
|
1381
|
+
* @returns {string}
|
|
1382
|
+
*/
|
|
1383
|
+
function pad(string?: string, length?: number, chars?: string): string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Pads string on the right side if it's shorter than length.
|
|
1386
|
+
* @param {string} [string='']
|
|
1387
|
+
* @param {number} [length=0]
|
|
1388
|
+
* @param {string} [chars=' ']
|
|
1389
|
+
* @returns {string}
|
|
1390
|
+
*/
|
|
1391
|
+
function padEnd(string?: string, length?: number, chars?: string): string;
|
|
1392
|
+
/**
|
|
1393
|
+
* Pads string on the left side if it's shorter than length.
|
|
1394
|
+
* @param {string} [string='']
|
|
1395
|
+
* @param {number} [length=0]
|
|
1396
|
+
* @param {string} [chars=' ']
|
|
1397
|
+
* @returns {string}
|
|
1398
|
+
*/
|
|
1399
|
+
function padStart(string?: string, length?: number, chars?: string): string;
|
|
1400
|
+
/**
|
|
1401
|
+
* Repeats the given string n times.
|
|
1402
|
+
* @param {string} [string='']
|
|
1403
|
+
* @param {number} [n=1]
|
|
1404
|
+
* @returns {string}
|
|
1405
|
+
*/
|
|
1406
|
+
function repeat(string?: string, n?: number): string;
|
|
1407
|
+
/**
|
|
1408
|
+
* Replaces matches for pattern in string with replacement.
|
|
1409
|
+
* @param {string} [string='']
|
|
1410
|
+
* @param {string | RegExp} [pattern]
|
|
1411
|
+
* @param {string | ((substring: string, ...args: any[]) => string)} [replacement]
|
|
1412
|
+
* @returns {string}
|
|
1413
|
+
*/
|
|
1414
|
+
function replace(string?: string, pattern?: string | RegExp, replacement?: string | ((substring: string, ...args: any[]) => string)): string;
|
|
1415
|
+
/**
|
|
1416
|
+
* Converts string to snake case.
|
|
1417
|
+
* @param {string} string
|
|
1418
|
+
* @returns {string}
|
|
1419
|
+
*/
|
|
1420
|
+
function snakeCase(string: string): string;
|
|
1421
|
+
/**
|
|
1422
|
+
* Splits string by separator.
|
|
1423
|
+
* @param {string} [string='']
|
|
1424
|
+
* @param {string | RegExp} [separator]
|
|
1425
|
+
* @param {number} [limit]
|
|
1426
|
+
* @returns {string[]}
|
|
1427
|
+
*/
|
|
1428
|
+
function split(string?: string, separator?: string | RegExp, limit?: number): string[];
|
|
1429
|
+
/**
|
|
1430
|
+
* Converts string to start case.
|
|
1431
|
+
* @param {string} string
|
|
1432
|
+
* @returns {string}
|
|
1433
|
+
*/
|
|
1434
|
+
function startCase(string: string): string;
|
|
1435
|
+
/**
|
|
1436
|
+
* Checks if string starts with the given target string.
|
|
1437
|
+
* @param {string} string
|
|
1438
|
+
* @param {string} target
|
|
1439
|
+
* @param {number} [position=0]
|
|
1440
|
+
* @returns {boolean}
|
|
1441
|
+
*/
|
|
1442
|
+
function startsWith(string: string, target: string, position?: number): boolean;
|
|
1443
|
+
/**
|
|
1444
|
+
* Converts string to lowercase.
|
|
1445
|
+
* @param {string} string
|
|
1446
|
+
* @returns {string}
|
|
1447
|
+
*/
|
|
1448
|
+
function toLower(string: string): string;
|
|
1449
|
+
/**
|
|
1450
|
+
* Converts string to uppercase.
|
|
1451
|
+
* @param {string} string
|
|
1452
|
+
* @returns {string}
|
|
1453
|
+
*/
|
|
1454
|
+
function toUpper(string: string): string;
|
|
1455
|
+
/**
|
|
1456
|
+
* Removes leading and trailing whitespace or specified characters from string.
|
|
1457
|
+
* @param {string} [string='']
|
|
1458
|
+
* @param {string} [chars]
|
|
1459
|
+
* @returns {string}
|
|
1460
|
+
*/
|
|
1461
|
+
function trim(string?: string, chars?: string): string;
|
|
1462
|
+
/**
|
|
1463
|
+
* Removes trailing whitespace or specified characters from string.
|
|
1464
|
+
* @param {string} [string='']
|
|
1465
|
+
* @param {string} [chars]
|
|
1466
|
+
* @returns {string}
|
|
1467
|
+
*/
|
|
1468
|
+
function trimEnd(string?: string, chars?: string): string;
|
|
1469
|
+
/**
|
|
1470
|
+
* Removes leading whitespace or specified characters from string.
|
|
1471
|
+
* @param {string} [string='']
|
|
1472
|
+
* @param {string} [chars]
|
|
1473
|
+
* @returns {string}
|
|
1474
|
+
*/
|
|
1475
|
+
function trimStart(string?: string, chars?: string): string;
|
|
1476
|
+
/**
|
|
1477
|
+
* Truncates string if it's longer than the given maximum string length.
|
|
1478
|
+
* @param {string} [string='']
|
|
1479
|
+
* @param {TruncateOptions} [options]
|
|
1480
|
+
* @returns {string}
|
|
1481
|
+
*/
|
|
1482
|
+
function truncate(string?: string, options?: TruncateOptions): string;
|
|
1483
|
+
/**
|
|
1484
|
+
* The inverse of escape; converts HTML entities to their corresponding characters.
|
|
1485
|
+
* @param {string} string
|
|
1486
|
+
* @returns {string}
|
|
1487
|
+
*/
|
|
1488
|
+
function unescape(string: string): string;
|
|
1489
|
+
/**
|
|
1490
|
+
* Converts string, as space separated words, to upper case.
|
|
1491
|
+
* @param {string} string
|
|
1492
|
+
* @returns {string}
|
|
1493
|
+
*/
|
|
1494
|
+
function upperCase(string: string): string;
|
|
1495
|
+
/**
|
|
1496
|
+
* Converts the first character of string to upper case.
|
|
1497
|
+
* @param {string} string
|
|
1498
|
+
* @returns {string}
|
|
1499
|
+
*/
|
|
1500
|
+
function upperFirst(string: string): string;
|
|
1501
|
+
/**
|
|
1502
|
+
* Splits string into an array of its words.
|
|
1503
|
+
* @param {string} [string='']
|
|
1504
|
+
* @param {string | RegExp} [pattern]
|
|
1505
|
+
* @returns {string[]}
|
|
1506
|
+
*/
|
|
1507
|
+
function words(string?: string, pattern?: string | RegExp): string[];
|
|
1508
|
+
/**
|
|
1509
|
+
* Returns a formatted string using printf-style format specifiers.
|
|
1510
|
+
* Supports: %s (string), %d/%i (integer), %f (float), %o (object), %j (JSON), %% (literal %)
|
|
1511
|
+
* Also supports width, precision, and flags: %10s, %-10s, %010d, %.2f, %10.2f
|
|
1512
|
+
* @param {string} format - The format string
|
|
1513
|
+
* @param {...any} args - Values to substitute
|
|
1514
|
+
* @returns {string}
|
|
1515
|
+
*/
|
|
1516
|
+
function sprintf(format: string, ...args: any[]): string;
|
|
1517
|
+
/**
|
|
1518
|
+
* Alias for sprintf - returns formatted string.
|
|
1519
|
+
* @param {string} format - The format string
|
|
1520
|
+
* @param {...any} args - Values to substitute
|
|
1521
|
+
* @returns {string}
|
|
1522
|
+
*/
|
|
1523
|
+
function format(format: string, ...args: any[]): string;
|
|
1524
|
+
/**
|
|
1525
|
+
* Compiles a template string into a reusable function.
|
|
1526
|
+
* Supports Mustache-style syntax with extensions.
|
|
1527
|
+
*
|
|
1528
|
+
* Syntax:
|
|
1529
|
+
* - {{variable}} - Escaped output
|
|
1530
|
+
* - {{{variable}}} - Raw/unescaped output
|
|
1531
|
+
* - {{obj.prop}} - Dot notation access
|
|
1532
|
+
* - {{#if condition}}...{{/if}} - Conditionals
|
|
1533
|
+
* - {{#unless condition}}...{{/unless}} - Negative conditionals
|
|
1534
|
+
* - {{#each items}}...{{/each}} - Loops (use {{.}} for current item, {{@index}} for index)
|
|
1535
|
+
* - {{#with obj}}...{{/with}} - Context shifting
|
|
1536
|
+
* - {{> partialName}} - Partial inclusion (if registered)
|
|
1537
|
+
*
|
|
1538
|
+
* @param {string} template - The template string
|
|
1539
|
+
* @param {TemplateOptions} [options] - Compilation options
|
|
1540
|
+
* @returns {(data?: Record<string, any>) => string} Compiled template function that accepts data
|
|
1541
|
+
*/
|
|
1542
|
+
function template(template: string, options?: TemplateOptions): (data?: Record<string, any>) => string;
|
|
1543
|
+
/**
|
|
1544
|
+
* Renders a template string with the given data (one-shot).
|
|
1545
|
+
* @param {string} template - The template string
|
|
1546
|
+
* @param {Record<string, any>} data - The data object
|
|
1547
|
+
* @param {TemplateOptions} [options] - Template options (partials, helpers)
|
|
1548
|
+
* @returns {string} Rendered output
|
|
1549
|
+
*/
|
|
1550
|
+
function render(template: string, data: Record<string, any>, options?: TemplateOptions): string;
|
|
1551
|
+
/**
|
|
1552
|
+
* Copy text to clipboard.
|
|
1553
|
+
* Uses modern Clipboard API with fallback for older browsers.
|
|
1554
|
+
* @param {string} text - Text to copy
|
|
1555
|
+
* @returns {Promise<boolean>} True if copy succeeded
|
|
1556
|
+
*/
|
|
1557
|
+
function copyToClipboard(text: string): Promise<boolean>;
|
|
1558
|
+
/**
|
|
1559
|
+
* Escape HTML special characters to prevent XSS attacks.
|
|
1560
|
+
* @param {any} str - String to escape
|
|
1561
|
+
* @returns {string} Escaped string
|
|
1562
|
+
*/
|
|
1563
|
+
function escapeHtml(str: any): string;
|
|
1564
|
+
/**
|
|
1565
|
+
* Creates a lodash-style wrapper for explicit chaining.
|
|
1566
|
+
* Allows method chaining with .value() to extract the final result.
|
|
1567
|
+
* @param {any} value - The value to wrap
|
|
1568
|
+
* @returns {UtilsChain} Chainable wrapper object
|
|
1569
|
+
* @example
|
|
1570
|
+
* _.chain([1, 2, 3, 4])
|
|
1571
|
+
* .map(x => x * 2)
|
|
1572
|
+
* .filter(x => x > 4)
|
|
1573
|
+
* .sum()
|
|
1574
|
+
* .value(); // 14
|
|
1575
|
+
*/
|
|
1576
|
+
function chain(value: any): UtilsChain;
|
|
1577
|
+
}
|
|
1578
|
+
export default utils;
|
|
1579
|
+
/**
|
|
1580
|
+
* An array, or an object whose values are the items.
|
|
1581
|
+
*/
|
|
1582
|
+
export type Collection<T> = T[] | Record<string, T>;
|
|
1583
|
+
/**
|
|
1584
|
+
* Called with each item, its index (or key, for an object) and the collection.
|
|
1585
|
+
*/
|
|
1586
|
+
export type Iteratee<T, R> = (value: T, index: number | string, collection: Collection<T>) => R;
|
|
1587
|
+
export type Predicate<T> = (value: T, index: number | string, collection: Collection<T>) => boolean;
|
|
1588
|
+
/**
|
|
1589
|
+
* A function of the item, or the name of one of its properties.
|
|
1590
|
+
*/
|
|
1591
|
+
export type PropertyIteratee<T> = ((value: T) => any) | keyof T;
|
|
1592
|
+
export type DebounceOptions = {
|
|
1593
|
+
/**
|
|
1594
|
+
* - Invoke on the leading edge of the timeout
|
|
1595
|
+
*/
|
|
1596
|
+
leading?: boolean;
|
|
1597
|
+
/**
|
|
1598
|
+
* - Invoke on the trailing edge of the timeout
|
|
1599
|
+
*/
|
|
1600
|
+
trailing?: boolean;
|
|
1601
|
+
/**
|
|
1602
|
+
* - Longest time func may be delayed before it is invoked
|
|
1603
|
+
*/
|
|
1604
|
+
maxWait?: number;
|
|
1605
|
+
};
|
|
1606
|
+
export type ThrottleOptions = {
|
|
1607
|
+
/**
|
|
1608
|
+
* - Invoke on the leading edge of the timeout
|
|
1609
|
+
*/
|
|
1610
|
+
leading?: boolean;
|
|
1611
|
+
/**
|
|
1612
|
+
* - Invoke on the trailing edge of the timeout
|
|
1613
|
+
*/
|
|
1614
|
+
trailing?: boolean;
|
|
1615
|
+
};
|
|
1616
|
+
export type TruncateOptions = {
|
|
1617
|
+
/**
|
|
1618
|
+
* - Maximum string length, omission included
|
|
1619
|
+
*/
|
|
1620
|
+
length?: number;
|
|
1621
|
+
/**
|
|
1622
|
+
* - Appended to a truncated string
|
|
1623
|
+
*/
|
|
1624
|
+
omission?: string;
|
|
1625
|
+
/**
|
|
1626
|
+
* - Truncate back to the last match of this
|
|
1627
|
+
*/
|
|
1628
|
+
separator?: string | RegExp;
|
|
1629
|
+
};
|
|
1630
|
+
export type TemplateOptions = {
|
|
1631
|
+
/**
|
|
1632
|
+
* - Named partial templates, for `{{> name}}`
|
|
1633
|
+
*/
|
|
1634
|
+
partials?: Record<string, string>;
|
|
1635
|
+
/**
|
|
1636
|
+
* - Helper functions, for `{{helperName arg ...}}`
|
|
1637
|
+
*/
|
|
1638
|
+
helpers?: Record<string, (...args: any[]) => any>;
|
|
1639
|
+
};
|
|
1640
|
+
/**
|
|
1641
|
+
* A debounced (or throttled) function. Until func has run once a call returns undefined;
|
|
1642
|
+
* after that it returns the result of the latest invocation.
|
|
1643
|
+
*/
|
|
1644
|
+
export type DebouncedFunction<T extends (...args: any[]) => any> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {
|
|
1645
|
+
cancel: () => void;
|
|
1646
|
+
flush: () => ReturnType<T> | undefined;
|
|
1647
|
+
};
|
|
1648
|
+
/**
|
|
1649
|
+
* A memoised function; `cache` is keyed by the first argument (or the resolver's result).
|
|
1650
|
+
*/
|
|
1651
|
+
export type MemoizedFunction<T extends (...args: any[]) => any> = ((...args: Parameters<T>) => ReturnType<T>) & {
|
|
1652
|
+
cache: Map<any, ReturnType<T>>;
|
|
1653
|
+
};
|
|
1654
|
+
/**
|
|
1655
|
+
* The wrapper `chain()` returns. Each chainable utility is a method that takes the remaining
|
|
1656
|
+
* arguments and returns the wrapper; `sum`, `mean`, `min`, `max`, `toArray` and `toString` return
|
|
1657
|
+
* their result; `value()` returns the wrapped value.
|
|
1658
|
+
*/
|
|
1659
|
+
export type UtilsChain = {
|
|
1660
|
+
value: () => any;
|
|
1661
|
+
} & {
|
|
1662
|
+
[method: string]: (...args: any[]) => any;
|
|
1663
|
+
};
|
|
1664
|
+
/**
|
|
1665
|
+
* The utilities object (`Domma.utils`, `_`).
|
|
1666
|
+
*/
|
|
1667
|
+
export type Utils = typeof utils;
|