@ntnyq/utils 0.10.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +585 -487
- package/dist/index.js +179 -147
- package/package.json +35 -37
package/dist/index.d.ts
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
//#region src/fn/noop.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* A function that does nothing.
|
|
4
|
-
*/
|
|
3
|
+
* A function that does nothing.
|
|
4
|
+
*/
|
|
5
5
|
declare function noop(): void;
|
|
6
6
|
/**
|
|
7
|
-
* Alias of {@link noop}.
|
|
8
|
-
*/
|
|
7
|
+
* Alias of {@link noop}.
|
|
8
|
+
*/
|
|
9
9
|
declare const NOOP: typeof noop;
|
|
10
10
|
//#endregion
|
|
11
11
|
//#region src/fn/once.d.ts
|
|
12
12
|
/**
|
|
13
|
-
* Creates a function that is restricted to invoking `func` once. Repeat calls to the function return `false`.
|
|
14
|
-
*
|
|
15
|
-
* @param func - The function to restrict.
|
|
16
|
-
* @returns A new function that returns `true` when `func` is invoked for the first time and `false` on subsequent calls.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
*
|
|
20
|
-
* ```ts
|
|
21
|
-
* const initialize = once(() => {
|
|
22
|
-
* console.log('Initialized')
|
|
23
|
-
* })
|
|
24
|
-
*
|
|
25
|
-
* initialize() // Logs: 'Initialized', returns true
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
13
|
+
* Creates a function that is restricted to invoking `func` once. Repeat calls to the function return `false`.
|
|
14
|
+
*
|
|
15
|
+
* @param func - The function to restrict.
|
|
16
|
+
* @returns A new function that returns `true` when `func` is invoked for the first time and `false` on subsequent calls.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* const initialize = once(() => {
|
|
22
|
+
* console.log('Initialized')
|
|
23
|
+
* })
|
|
24
|
+
*
|
|
25
|
+
* initialize() // Logs: 'Initialized', returns true
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
28
|
declare function once<T extends unknown[]>(func: (...args: T) => void): (this: unknown, ...args: T) => boolean;
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/is/dom.d.ts
|
|
31
31
|
/**
|
|
32
|
-
* @file is/dom.ts
|
|
33
|
-
*/
|
|
32
|
+
* @file is/dom.ts
|
|
33
|
+
*/
|
|
34
34
|
/**
|
|
35
|
-
* Check if given value is an HTMLElement
|
|
36
|
-
* @param value - The value to check
|
|
37
|
-
* @returns True if the value is an HTMLElement, false otherwise
|
|
38
|
-
*/
|
|
35
|
+
* Check if given value is an HTMLElement
|
|
36
|
+
* @param value - The value to check
|
|
37
|
+
* @returns True if the value is an HTMLElement, false otherwise
|
|
38
|
+
*/
|
|
39
39
|
declare function isHTMLElement(value: unknown): value is HTMLElement;
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region src/is/core.d.ts
|
|
42
42
|
/**
|
|
43
|
-
* @file is utils
|
|
44
|
-
* @module is
|
|
45
|
-
* @copyright {@link https://github.com/sindresorhus/is}
|
|
46
|
-
*/
|
|
47
|
-
type Whitespace =
|
|
43
|
+
* @file is utils
|
|
44
|
+
* @module is
|
|
45
|
+
* @copyright {@link https://github.com/sindresorhus/is}
|
|
46
|
+
*/
|
|
47
|
+
type Whitespace = ' ';
|
|
48
48
|
type NonEmptyString = string & {
|
|
49
|
-
0:
|
|
49
|
+
0: '';
|
|
50
50
|
};
|
|
51
51
|
declare function getObjectType(value: unknown): string;
|
|
52
52
|
declare function isUndefined(value: unknown): value is undefined;
|
|
@@ -54,10 +54,10 @@ declare function isNull(value: unknown): value is null;
|
|
|
54
54
|
declare function isNil(value: unknown): value is null | undefined;
|
|
55
55
|
declare const isNullOrUndefined: typeof isNil;
|
|
56
56
|
declare function isString(value: unknown): value is string;
|
|
57
|
-
declare function isEmptyString(value: unknown): value is
|
|
57
|
+
declare function isEmptyString(value: unknown): value is '';
|
|
58
58
|
declare function isNonEmptyString(value: unknown): value is NonEmptyString;
|
|
59
59
|
declare function isWhitespaceString(value: unknown): value is Whitespace;
|
|
60
|
-
declare function isEmptyStringOrWhitespace(value: unknown): value is
|
|
60
|
+
declare function isEmptyStringOrWhitespace(value: unknown): value is '' | Whitespace;
|
|
61
61
|
declare function isNumbericString(value: unknown): value is `${number}`;
|
|
62
62
|
declare function isNumber(value: unknown): value is number;
|
|
63
63
|
declare function isZero(value: unknown): value is 0;
|
|
@@ -70,12 +70,12 @@ declare function isFunction(value: unknown): value is Function;
|
|
|
70
70
|
declare function isArray(value: unknown): value is unknown[];
|
|
71
71
|
declare function isEmptyArray(value: unknown): value is [];
|
|
72
72
|
declare function isNonEmptyArray<T = unknown, Item = unknown>(value: T | Item[]): value is [Item, ...Item[]];
|
|
73
|
-
declare function isObject(value: unknown): value is object;
|
|
74
|
-
declare function isEmptyObject(value: unknown): value is {};
|
|
75
73
|
declare function isMap<Key = unknown, Value = unknown>(value: unknown): value is Map<Key, Value>;
|
|
76
|
-
declare function isEmptyMap(value: unknown): value is Map<never, never>;
|
|
77
74
|
declare function isSet<Value = unknown>(value: unknown): value is Set<Value>;
|
|
78
75
|
declare function isEmptySet(value: unknown): value is Set<never>;
|
|
76
|
+
declare function isObject(value: unknown): value is object;
|
|
77
|
+
declare function isEmptyObject(value: unknown): value is {};
|
|
78
|
+
declare function isEmptyMap(value: unknown): value is Map<never, never>;
|
|
79
79
|
declare function isRegExp(value: unknown): value is RegExp;
|
|
80
80
|
declare function isError(value: unknown): value is Error;
|
|
81
81
|
declare function isNativePromise<T = unknown>(value: unknown): value is Promise<T>;
|
|
@@ -85,29 +85,29 @@ declare function isBlob(value: unknown): value is Blob;
|
|
|
85
85
|
declare function isFormData(value: unknown): value is FormData;
|
|
86
86
|
declare function isFile(value: unknown): value is File;
|
|
87
87
|
type UrlString = string & {
|
|
88
|
-
readonly __brand:
|
|
88
|
+
readonly __brand: 'UrlString';
|
|
89
89
|
};
|
|
90
90
|
declare function isUrlString(value: unknown): value is UrlString;
|
|
91
91
|
//#endregion
|
|
92
92
|
//#region src/is/isDeepEqual.d.ts
|
|
93
93
|
/**
|
|
94
|
-
* check if two values are deeply equal
|
|
95
|
-
*/
|
|
94
|
+
* check if two values are deeply equal
|
|
95
|
+
*/
|
|
96
96
|
declare function isDeepEqual(value1: any, value2: any): boolean;
|
|
97
97
|
//#endregion
|
|
98
98
|
//#region src/dom/scrollIntoView.d.ts
|
|
99
99
|
interface Options extends ScrollIntoViewOptions {
|
|
100
100
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
* @default `document.body`
|
|
102
|
+
*/
|
|
103
103
|
parent?: HTMLElement;
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
-
* Scroll element into view if it is out of view.
|
|
107
|
-
*
|
|
108
|
-
* @param element - element to scroll
|
|
109
|
-
* @param options - scroll options
|
|
110
|
-
*/
|
|
106
|
+
* Scroll element into view if it is out of view.
|
|
107
|
+
*
|
|
108
|
+
* @param element - element to scroll
|
|
109
|
+
* @param options - scroll options
|
|
110
|
+
*/
|
|
111
111
|
declare function scrollElementIntoView(element: HTMLElement, options?: Options): void;
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/types/base.d.ts
|
|
@@ -118,12 +118,12 @@ type Callable<T> = AnyFn<any, T> | T;
|
|
|
118
118
|
type MayBe<T> = T | undefined;
|
|
119
119
|
type Nullable<T> = T | null;
|
|
120
120
|
/**
|
|
121
|
-
* Overwrite some keys type
|
|
122
|
-
*/
|
|
123
|
-
type Overwrite<T, U
|
|
121
|
+
* Overwrite some keys type
|
|
122
|
+
*/
|
|
123
|
+
type Overwrite<T, U> = Pick<T, Exclude<keyof T, keyof U>> & U;
|
|
124
124
|
/**
|
|
125
|
-
* Prettify object type
|
|
126
|
-
*/
|
|
125
|
+
* Prettify object type
|
|
126
|
+
*/
|
|
127
127
|
type Prettify<T> = { [K in keyof T]: T[K] } & {};
|
|
128
128
|
type PrettifyV2<T> = Omit<T, never>;
|
|
129
129
|
type Primitive = bigint | boolean | number | string | symbol | AnyFn | null | undefined;
|
|
@@ -136,166 +136,172 @@ type JsonArray = JsonValue[] | readonly JsonValue[];
|
|
|
136
136
|
type JsonObject = { [Key in string]: JsonValue } & { [Key in string]?: JsonValue | undefined };
|
|
137
137
|
type JsonPrimitive = boolean | number | string | null;
|
|
138
138
|
/**
|
|
139
|
-
* @copyright {@link https://github.com/sindresorhus/type-fest/blob/main/source/basic.d.ts}
|
|
140
|
-
*/
|
|
139
|
+
* @copyright {@link https://github.com/sindresorhus/type-fest/blob/main/source/basic.d.ts}
|
|
140
|
+
*/
|
|
141
141
|
type JsonValue = JsonArray | JsonObject | JsonPrimitive;
|
|
142
142
|
//#endregion
|
|
143
143
|
//#region src/types/utils.d.ts
|
|
144
144
|
/**
|
|
145
|
-
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
|
|
146
|
-
*
|
|
147
|
-
* @see {@link https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609}
|
|
148
|
-
*/
|
|
145
|
+
* A literal type that supports custom further strings but preserves autocompletion in IDEs.
|
|
146
|
+
*
|
|
147
|
+
* @see {@link https://github.com/microsoft/TypeScript/issues/29729#issuecomment-471566609}
|
|
148
|
+
*/
|
|
149
149
|
type LiteralUnion<Union extends Base, Base = string> = Union | (Base & {
|
|
150
150
|
zz_IGNORE_ME?: never;
|
|
151
151
|
});
|
|
152
152
|
/**
|
|
153
|
-
* @see {@link TODO:}
|
|
154
|
-
*/
|
|
155
|
-
type Merge<T, U
|
|
153
|
+
* @see {@link TODO:}
|
|
154
|
+
*/
|
|
155
|
+
type Merge<T, U> = keyof T & keyof U extends never ? T & U : Omit<T, keyof T & keyof U> & U;
|
|
156
156
|
/**
|
|
157
|
-
* Non empty object `{}`
|
|
158
|
-
*/
|
|
157
|
+
* Non empty object `{}`
|
|
158
|
+
*/
|
|
159
159
|
type NonEmptyObject<T> = T extends Record<string, never> ? never : T;
|
|
160
160
|
/**
|
|
161
|
-
* A type that represents the values of an object type.
|
|
162
|
-
*/
|
|
161
|
+
* A type that represents the values of an object type.
|
|
162
|
+
*/
|
|
163
163
|
type ValueOf<T> = T[keyof T];
|
|
164
164
|
/**
|
|
165
|
-
* A type that represents the elements of an array type.
|
|
166
|
-
*/
|
|
167
|
-
type ElementOf<T extends unknown[] | null | undefined> = T extends
|
|
165
|
+
* A type that represents the elements of an array type.
|
|
166
|
+
*/
|
|
167
|
+
type ElementOf<T extends unknown[] | null | undefined> = T extends (infer U)[] ? U : never;
|
|
168
168
|
//#endregion
|
|
169
169
|
//#region src/types/module.d.ts
|
|
170
170
|
/**
|
|
171
|
-
* interop module
|
|
172
|
-
*/
|
|
171
|
+
* interop module
|
|
172
|
+
*/
|
|
173
173
|
type InteropModuleDefault<T> = T extends {
|
|
174
174
|
default: infer U;
|
|
175
175
|
} ? U : T;
|
|
176
176
|
/**
|
|
177
|
-
* Resolve `boolean | Options` to `Options`
|
|
178
|
-
*/
|
|
177
|
+
* Resolve `boolean | Options` to `Options`
|
|
178
|
+
*/
|
|
179
179
|
type ResolvedOptions<T> = T extends boolean ? never : NonNullable<T>;
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region src/dom/openExternalURL.d.ts
|
|
182
182
|
interface OpenExternalURLOptions {
|
|
183
183
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
target?: LiteralUnion<
|
|
184
|
+
* open target
|
|
185
|
+
*
|
|
186
|
+
* @default `_blank`
|
|
187
|
+
*/
|
|
188
|
+
target?: LiteralUnion<'_self' | '_top' | '_blank' | '_parent'>;
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
|
-
* Open external url
|
|
192
|
-
* @param url - URL to open
|
|
193
|
-
* @param options - open options
|
|
194
|
-
* @returns window proxy
|
|
195
|
-
*/
|
|
191
|
+
* Open external url
|
|
192
|
+
* @param url - URL to open
|
|
193
|
+
* @param options - open options
|
|
194
|
+
* @returns window proxy
|
|
195
|
+
*/
|
|
196
196
|
declare function openExternalURL(url: string | URL, options?: OpenExternalURLOptions): WindowProxy | null;
|
|
197
197
|
//#endregion
|
|
198
198
|
//#region src/dom/isVisibleInViewport.d.ts
|
|
199
199
|
/**
|
|
200
|
-
* Check if element is in viewport
|
|
201
|
-
* @param element - checked element
|
|
202
|
-
* @param targetWindow - window
|
|
203
|
-
* @returns true if element is in viewport, false otherwise
|
|
204
|
-
*/
|
|
200
|
+
* Check if element is in viewport
|
|
201
|
+
* @param element - checked element
|
|
202
|
+
* @param targetWindow - window
|
|
203
|
+
* @returns true if element is in viewport, false otherwise
|
|
204
|
+
*/
|
|
205
205
|
declare function isElementVisibleInViewport(element: HTMLElement, targetWindow?: Window): boolean;
|
|
206
206
|
//#endregion
|
|
207
207
|
//#region src/env/isBrowser.d.ts
|
|
208
208
|
/**
|
|
209
|
-
*
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
*
|
|
214
|
-
* @returns boolean - true if the code is running in a browser
|
|
215
|
-
*/
|
|
209
|
+
* Checks if the code is running in a browser
|
|
210
|
+
*
|
|
211
|
+
* @returns true if the code is running in a browser
|
|
212
|
+
*/
|
|
216
213
|
declare function isBrowser(): boolean;
|
|
217
214
|
//#endregion
|
|
218
|
-
//#region src/file/
|
|
215
|
+
//#region src/file/extension.d.ts
|
|
219
216
|
/**
|
|
220
|
-
* Removes the file extension from a filename.
|
|
221
|
-
*
|
|
222
|
-
* @param filename - The filename to remove the extension from.
|
|
223
|
-
* @returns The filename without the extension.
|
|
224
|
-
*/
|
|
217
|
+
* Removes the file extension from a filename.
|
|
218
|
+
*
|
|
219
|
+
* @param filename - The filename to remove the extension from.
|
|
220
|
+
* @returns The filename without the extension.
|
|
221
|
+
*/
|
|
225
222
|
declare function removeFileExtension(filename: string): string;
|
|
223
|
+
/**
|
|
224
|
+
* Gets the file extension from a filename.
|
|
225
|
+
* @param filePath - The filePath to get the extension from.
|
|
226
|
+
* @returns The file extension, or undefined if there is none.
|
|
227
|
+
*/
|
|
228
|
+
declare function getFileExtension(filePath?: string): string | undefined;
|
|
226
229
|
//#endregion
|
|
227
230
|
//#region src/html/escape.d.ts
|
|
228
231
|
/**
|
|
229
|
-
* Escape html chars
|
|
230
|
-
*/
|
|
232
|
+
* Escape html chars
|
|
233
|
+
*/
|
|
231
234
|
declare function escapeHTML(str: string): string;
|
|
232
235
|
/**
|
|
233
|
-
* Unescape html chars
|
|
234
|
-
*/
|
|
236
|
+
* Unescape html chars
|
|
237
|
+
*/
|
|
235
238
|
declare function unescapeHTML(str: string): string;
|
|
236
239
|
//#endregion
|
|
237
240
|
//#region src/misc/raf.d.ts
|
|
238
241
|
/**
|
|
239
|
-
*
|
|
240
|
-
|
|
241
|
-
|
|
242
|
+
* @file raf.ts
|
|
243
|
+
*/
|
|
244
|
+
/**
|
|
245
|
+
* Gets the global root object.
|
|
246
|
+
* @returns the global root object
|
|
247
|
+
*/
|
|
242
248
|
declare function getRoot(): Window | typeof globalThis;
|
|
243
249
|
/**
|
|
244
|
-
* Request animation frame
|
|
245
|
-
*
|
|
246
|
-
* @param fn - callback
|
|
247
|
-
* @returns id
|
|
248
|
-
*/
|
|
250
|
+
* Request animation frame
|
|
251
|
+
*
|
|
252
|
+
* @param fn - callback
|
|
253
|
+
* @returns id
|
|
254
|
+
*/
|
|
249
255
|
declare function rAF(fn: FrameRequestCallback): number;
|
|
250
256
|
/**
|
|
251
|
-
* Cancel animation frame
|
|
252
|
-
*
|
|
253
|
-
* @param id - id
|
|
254
|
-
* @returns void
|
|
255
|
-
*/
|
|
257
|
+
* Cancel animation frame
|
|
258
|
+
*
|
|
259
|
+
* @param id - id
|
|
260
|
+
* @returns void
|
|
261
|
+
*/
|
|
256
262
|
declare function cAF(id: number): void;
|
|
257
263
|
//#endregion
|
|
258
264
|
//#region src/misc/clamp.d.ts
|
|
259
265
|
/**
|
|
260
|
-
* Clamps a number between a minimum and maximum value
|
|
261
|
-
* @param value - the value to clamp within the given range
|
|
262
|
-
* @param min - the minimum value to clamp
|
|
263
|
-
* @param max - the maximum value to clamp
|
|
264
|
-
* @returns the new value
|
|
265
|
-
*/
|
|
266
|
+
* Clamps a number between a minimum and maximum value
|
|
267
|
+
* @param value - the value to clamp within the given range
|
|
268
|
+
* @param min - the minimum value to clamp
|
|
269
|
+
* @param max - the maximum value to clamp
|
|
270
|
+
* @returns the new value
|
|
271
|
+
*/
|
|
266
272
|
declare function clamp(value: number, min?: number, max?: number): number;
|
|
267
273
|
//#endregion
|
|
268
274
|
//#region src/misc/waitFor.d.ts
|
|
269
275
|
/**
|
|
270
|
-
* Wait for a number of milliseconds
|
|
271
|
-
*
|
|
272
|
-
* @param ms - millseconds to wait
|
|
273
|
-
* @returns a promise that resolves after ms milliseconds
|
|
274
|
-
*
|
|
275
|
-
* @example
|
|
276
|
-
* ```
|
|
277
|
-
* import { waitFor } from '@ntnyq/utils'
|
|
278
|
-
* await waitFor(3e3)
|
|
279
|
-
* // do somthing after 3 seconds
|
|
280
|
-
* ```
|
|
281
|
-
*/
|
|
276
|
+
* Wait for a number of milliseconds
|
|
277
|
+
*
|
|
278
|
+
* @param ms - millseconds to wait
|
|
279
|
+
* @returns a promise that resolves after ms milliseconds
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```
|
|
283
|
+
* import { waitFor } from '@ntnyq/utils'
|
|
284
|
+
* await waitFor(3e3)
|
|
285
|
+
* // do somthing after 3 seconds
|
|
286
|
+
* ```
|
|
287
|
+
*/
|
|
282
288
|
declare function waitFor(ms: number): Promise<void>;
|
|
283
289
|
//#endregion
|
|
284
290
|
//#region src/misc/throttle.d.ts
|
|
285
291
|
interface ThrottleDebounceOptions {
|
|
286
292
|
/**
|
|
287
|
-
|
|
288
|
-
|
|
293
|
+
* @default false
|
|
294
|
+
*/
|
|
289
295
|
isDebounce?: boolean;
|
|
290
296
|
}
|
|
291
297
|
/**
|
|
292
|
-
* Throttle a function to limit its execution to a maximum of once per a specified time interval.
|
|
293
|
-
*
|
|
294
|
-
* @param delay - Zero or greater delay in milliseconds
|
|
295
|
-
* @param callback - A function to be throttled
|
|
296
|
-
* @param options - throttle options
|
|
297
|
-
* @returns A throttled function
|
|
298
|
-
*/
|
|
298
|
+
* Throttle a function to limit its execution to a maximum of once per a specified time interval.
|
|
299
|
+
*
|
|
300
|
+
* @param delay - Zero or greater delay in milliseconds
|
|
301
|
+
* @param callback - A function to be throttled
|
|
302
|
+
* @param options - throttle options
|
|
303
|
+
* @returns A throttled function
|
|
304
|
+
*/
|
|
299
305
|
declare function throttle<T extends ((...args: any[]) => undefined | void) | undefined | null>(delay: number, callback: Exclude<T, undefined | null>, options?: ThrottleDebounceOptions): T & {
|
|
300
306
|
cancel: () => void;
|
|
301
307
|
};
|
|
@@ -305,20 +311,20 @@ declare function debounce<T extends ((...args: any[]) => undefined | void) | und
|
|
|
305
311
|
//#endregion
|
|
306
312
|
//#region src/misc/warnOnce.d.ts
|
|
307
313
|
/**
|
|
308
|
-
* Warn message only once
|
|
309
|
-
*
|
|
310
|
-
* @param message - warning message
|
|
311
|
-
*/
|
|
314
|
+
* Warn message only once
|
|
315
|
+
*
|
|
316
|
+
* @param message - warning message
|
|
317
|
+
*/
|
|
312
318
|
declare function warnOnce(message: string): void;
|
|
313
319
|
//#endregion
|
|
314
320
|
//#region src/misc/convertTime.d.ts
|
|
315
321
|
/**
|
|
316
|
-
* @file time utils
|
|
317
|
-
* @module Time
|
|
318
|
-
*/
|
|
322
|
+
* @file time utils
|
|
323
|
+
* @module Time
|
|
324
|
+
*/
|
|
319
325
|
/**
|
|
320
|
-
* Time unit conversion constants (in milliseconds)
|
|
321
|
-
*/
|
|
326
|
+
* Time unit conversion constants (in milliseconds)
|
|
327
|
+
*/
|
|
322
328
|
declare const TIME_UNITS: {
|
|
323
329
|
readonly MILLISECOND: 1;
|
|
324
330
|
readonly SECOND: 1000;
|
|
@@ -329,54 +335,54 @@ declare const TIME_UNITS: {
|
|
|
329
335
|
};
|
|
330
336
|
type TimeUnit = keyof typeof TIME_UNITS;
|
|
331
337
|
/**
|
|
332
|
-
* Converts time units to milliseconds.
|
|
333
|
-
* @param value - The time value.
|
|
334
|
-
* @param fromUnit - The source unit (default: 'SECOND').
|
|
335
|
-
* @returns The time in milliseconds.
|
|
336
|
-
* @example
|
|
337
|
-
* ```ts
|
|
338
|
-
* convertToMilliseconds(5, 'SECOND') // 5000
|
|
339
|
-
* convertToMilliseconds(2, 'MINUTE') // 120000
|
|
340
|
-
* convertToMilliseconds(1, 'HOUR') // 3600000
|
|
341
|
-
* ```
|
|
342
|
-
*/
|
|
338
|
+
* Converts time units to milliseconds.
|
|
339
|
+
* @param value - The time value.
|
|
340
|
+
* @param fromUnit - The source unit (default: 'SECOND').
|
|
341
|
+
* @returns The time in milliseconds.
|
|
342
|
+
* @example
|
|
343
|
+
* ```ts
|
|
344
|
+
* convertToMilliseconds(5, 'SECOND') // 5000
|
|
345
|
+
* convertToMilliseconds(2, 'MINUTE') // 120000
|
|
346
|
+
* convertToMilliseconds(1, 'HOUR') // 3600000
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
343
349
|
declare function convertToMilliseconds(value: number, fromUnit?: TimeUnit): number;
|
|
344
350
|
/**
|
|
345
|
-
* Converts milliseconds to specified time unit.
|
|
346
|
-
* @param milliseconds - The time in milliseconds.
|
|
347
|
-
* @param toUnit - The target unit (default: 'SECOND').
|
|
348
|
-
* @returns The time in the specified unit.
|
|
349
|
-
* @example
|
|
350
|
-
* ```ts
|
|
351
|
-
* convertFromMilliseconds(5000, 'SECOND') // 5
|
|
352
|
-
* convertFromMilliseconds(120000, 'MINUTE') // 2
|
|
353
|
-
* convertFromMilliseconds(3600000, 'HOUR') // 1
|
|
354
|
-
* ```
|
|
355
|
-
*/
|
|
351
|
+
* Converts milliseconds to specified time unit.
|
|
352
|
+
* @param milliseconds - The time in milliseconds.
|
|
353
|
+
* @param toUnit - The target unit (default: 'SECOND').
|
|
354
|
+
* @returns The time in the specified unit.
|
|
355
|
+
* @example
|
|
356
|
+
* ```ts
|
|
357
|
+
* convertFromMilliseconds(5000, 'SECOND') // 5
|
|
358
|
+
* convertFromMilliseconds(120000, 'MINUTE') // 2
|
|
359
|
+
* convertFromMilliseconds(3600000, 'HOUR') // 1
|
|
360
|
+
* ```
|
|
361
|
+
*/
|
|
356
362
|
declare function convertFromMilliseconds(milliseconds: number, toUnit?: TimeUnit): number;
|
|
357
363
|
/**
|
|
358
|
-
* Converts between time units.
|
|
359
|
-
* @param value - The time value.
|
|
360
|
-
* @param fromUnit - The source unit.
|
|
361
|
-
* @param toUnit - The target unit.
|
|
362
|
-
* @returns The converted time.
|
|
363
|
-
* @example
|
|
364
|
-
* ```ts
|
|
365
|
-
* convertTimeUnit(1, 'HOUR', 'MINUTE') // 60
|
|
366
|
-
* convertTimeUnit(120, 'SECOND', 'MINUTE') // 2
|
|
367
|
-
* convertTimeUnit(2, 'WEEK', 'DAY') // 14
|
|
368
|
-
* ```
|
|
369
|
-
*/
|
|
364
|
+
* Converts between time units.
|
|
365
|
+
* @param value - The time value.
|
|
366
|
+
* @param fromUnit - The source unit.
|
|
367
|
+
* @param toUnit - The target unit.
|
|
368
|
+
* @returns The converted time.
|
|
369
|
+
* @example
|
|
370
|
+
* ```ts
|
|
371
|
+
* convertTimeUnit(1, 'HOUR', 'MINUTE') // 60
|
|
372
|
+
* convertTimeUnit(120, 'SECOND', 'MINUTE') // 2
|
|
373
|
+
* convertTimeUnit(2, 'WEEK', 'DAY') // 14
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
370
376
|
declare function convertTimeUnit(value: number, fromUnit: TimeUnit, toUnit: TimeUnit): number;
|
|
371
377
|
//#endregion
|
|
372
378
|
//#region src/misc/convertStorage.d.ts
|
|
373
379
|
/**
|
|
374
|
-
* @file storage utils
|
|
375
|
-
* @module Storage
|
|
376
|
-
*/
|
|
380
|
+
* @file storage utils
|
|
381
|
+
* @module Storage
|
|
382
|
+
*/
|
|
377
383
|
/**
|
|
378
|
-
* Storage unit conversion constants
|
|
379
|
-
*/
|
|
384
|
+
* Storage unit conversion constants
|
|
385
|
+
*/
|
|
380
386
|
declare const STORAGE_UNITS: {
|
|
381
387
|
readonly BYTE: 1;
|
|
382
388
|
readonly KB: 1024;
|
|
@@ -386,122 +392,140 @@ declare const STORAGE_UNITS: {
|
|
|
386
392
|
};
|
|
387
393
|
type StorageUnit = keyof typeof STORAGE_UNITS;
|
|
388
394
|
/**
|
|
389
|
-
* Converts storage units to bytes.
|
|
390
|
-
* @param value - The size value.
|
|
391
|
-
* @param fromUnit - The source unit (default: 'MB').
|
|
392
|
-
* @returns The size in bytes.
|
|
393
|
-
* @example
|
|
394
|
-
* ```ts
|
|
395
|
-
* convertToBytes(5, 'MB') // 5242880
|
|
396
|
-
* convertToBytes(1, 'GB') // 1073741824
|
|
397
|
-
* convertToBytes(512, 'KB') // 524288
|
|
398
|
-
* ```
|
|
399
|
-
*/
|
|
395
|
+
* Converts storage units to bytes.
|
|
396
|
+
* @param value - The size value.
|
|
397
|
+
* @param fromUnit - The source unit (default: 'MB').
|
|
398
|
+
* @returns The size in bytes.
|
|
399
|
+
* @example
|
|
400
|
+
* ```ts
|
|
401
|
+
* convertToBytes(5, 'MB') // 5242880
|
|
402
|
+
* convertToBytes(1, 'GB') // 1073741824
|
|
403
|
+
* convertToBytes(512, 'KB') // 524288
|
|
404
|
+
* ```
|
|
405
|
+
*/
|
|
400
406
|
declare function convertToBytes(value: number, fromUnit?: StorageUnit): number;
|
|
401
407
|
/**
|
|
402
|
-
* Converts bytes to specified storage unit.
|
|
403
|
-
* @param bytes - The size in bytes.
|
|
404
|
-
* @param toUnit - The target unit (default: 'MB').
|
|
405
|
-
* @returns The size in the specified unit.
|
|
406
|
-
* @example
|
|
407
|
-
* ```ts
|
|
408
|
-
* convertFromBytes(5242880, 'MB') // 5
|
|
409
|
-
* convertFromBytes(1073741824, 'GB') // 1
|
|
410
|
-
* convertFromBytes(524288, 'KB') // 512
|
|
411
|
-
* ```
|
|
412
|
-
*/
|
|
408
|
+
* Converts bytes to specified storage unit.
|
|
409
|
+
* @param bytes - The size in bytes.
|
|
410
|
+
* @param toUnit - The target unit (default: 'MB').
|
|
411
|
+
* @returns The size in the specified unit.
|
|
412
|
+
* @example
|
|
413
|
+
* ```ts
|
|
414
|
+
* convertFromBytes(5242880, 'MB') // 5
|
|
415
|
+
* convertFromBytes(1073741824, 'GB') // 1
|
|
416
|
+
* convertFromBytes(524288, 'KB') // 512
|
|
417
|
+
* ```
|
|
418
|
+
*/
|
|
413
419
|
declare function convertFromBytes(bytes: number, toUnit?: StorageUnit): number;
|
|
414
420
|
/**
|
|
415
|
-
* Converts between storage units.
|
|
416
|
-
* @param value - The size value.
|
|
417
|
-
* @param fromUnit - The source unit.
|
|
418
|
-
* @param toUnit - The target unit.
|
|
419
|
-
* @returns The converted size.
|
|
420
|
-
* @example
|
|
421
|
-
* ```ts
|
|
422
|
-
* convertStorageUnit(1, 'GB', 'MB') // 1024
|
|
423
|
-
* convertStorageUnit(2048, 'MB', 'GB') // 2
|
|
424
|
-
* convertStorageUnit(1024, 'KB', 'MB') // 1
|
|
425
|
-
* ```
|
|
426
|
-
*/
|
|
421
|
+
* Converts between storage units.
|
|
422
|
+
* @param value - The size value.
|
|
423
|
+
* @param fromUnit - The source unit.
|
|
424
|
+
* @param toUnit - The target unit.
|
|
425
|
+
* @returns The converted size.
|
|
426
|
+
* @example
|
|
427
|
+
* ```ts
|
|
428
|
+
* convertStorageUnit(1, 'GB', 'MB') // 1024
|
|
429
|
+
* convertStorageUnit(2048, 'MB', 'GB') // 2
|
|
430
|
+
* convertStorageUnit(1024, 'KB', 'MB') // 1
|
|
431
|
+
* ```
|
|
432
|
+
*/
|
|
427
433
|
declare function convertStorageUnit(value: number, fromUnit: StorageUnit, toUnit: StorageUnit): number;
|
|
428
434
|
//#endregion
|
|
429
435
|
//#region src/array/at.d.ts
|
|
430
436
|
/**
|
|
431
|
-
* Get array item by index, negative for backward
|
|
432
|
-
* @param array - given array
|
|
433
|
-
* @param index - index of item
|
|
434
|
-
* @returns undefined if not match, otherwise matched item
|
|
435
|
-
*/
|
|
437
|
+
* Get array item by index, negative for backward
|
|
438
|
+
* @param array - given array
|
|
439
|
+
* @param index - index of item
|
|
440
|
+
* @returns undefined if not match, otherwise matched item
|
|
441
|
+
*/
|
|
436
442
|
declare function at<T>(array: readonly T[], index: number): T | undefined;
|
|
437
443
|
/**
|
|
438
|
-
* Get the last item of given array
|
|
439
|
-
* @param array - given array
|
|
440
|
-
* @returns undefined if empty array, otherwise last item
|
|
441
|
-
*/
|
|
444
|
+
* Get the last item of given array
|
|
445
|
+
* @param array - given array
|
|
446
|
+
* @returns undefined if empty array, otherwise last item
|
|
447
|
+
*/
|
|
442
448
|
declare function last<T>(array: readonly T[]): T | undefined;
|
|
443
449
|
//#endregion
|
|
444
450
|
//#region src/array/chunk.d.ts
|
|
445
451
|
/**
|
|
446
|
-
* Splits an array into smaller chunks of a given size.
|
|
447
|
-
* @param array - The array to split
|
|
448
|
-
* @param size - The size of each chunk
|
|
449
|
-
* @returns An array of arrays, where each sub-array has `size` elements from the original array.
|
|
450
|
-
*/
|
|
452
|
+
* Splits an array into smaller chunks of a given size.
|
|
453
|
+
* @param array - The array to split
|
|
454
|
+
* @param size - The size of each chunk
|
|
455
|
+
* @returns An array of arrays, where each sub-array has `size` elements from the original array.
|
|
456
|
+
*/
|
|
451
457
|
declare function chunk<T>(array: T[], size: number): T[][];
|
|
452
458
|
//#endregion
|
|
459
|
+
//#region src/array/remove.d.ts
|
|
460
|
+
/**
|
|
461
|
+
* Remove given item from an array
|
|
462
|
+
* @param array - given array
|
|
463
|
+
* @param value - item to be removed
|
|
464
|
+
* @returns true if item was removed, otherwise false
|
|
465
|
+
*/
|
|
466
|
+
declare function remove<T>(array: T[], value: T): boolean;
|
|
467
|
+
//#endregion
|
|
453
468
|
//#region src/array/unique.d.ts
|
|
454
469
|
/**
|
|
455
|
-
* Returns a new array with unique values.
|
|
456
|
-
* @param array - The array to process.
|
|
457
|
-
* @returns The new array.
|
|
458
|
-
*/
|
|
470
|
+
* Returns a new array with unique values.
|
|
471
|
+
* @param array - The array to process.
|
|
472
|
+
* @returns The new array.
|
|
473
|
+
*/
|
|
459
474
|
declare function unique<T>(array: T[]): T[];
|
|
460
475
|
/**
|
|
461
|
-
* Returns a new array with unique values.
|
|
462
|
-
* @param array - The array to process.
|
|
463
|
-
* @param equalFn - The function to compare values.
|
|
464
|
-
* @returns The new array.
|
|
465
|
-
*/
|
|
476
|
+
* Returns a new array with unique values.
|
|
477
|
+
* @param array - The array to process.
|
|
478
|
+
* @param equalFn - The function to compare values.
|
|
479
|
+
* @returns The new array.
|
|
480
|
+
*/
|
|
466
481
|
declare function uniqueBy<T>(array: T[], equalFn: (a: T, b: T) => boolean): T[];
|
|
467
482
|
//#endregion
|
|
483
|
+
//#region src/array/shuffle.d.ts
|
|
484
|
+
/**
|
|
485
|
+
* Fisher–Yates shuffle
|
|
486
|
+
*
|
|
487
|
+
* @param array - array to shuffle
|
|
488
|
+
* @returns shuffled array
|
|
489
|
+
*/
|
|
490
|
+
declare function shuffle<T>(array: T[]): T[];
|
|
491
|
+
//#endregion
|
|
468
492
|
//#region src/array/toArray.d.ts
|
|
469
493
|
/**
|
|
470
|
-
* Converts a value to an array.
|
|
471
|
-
* @param array - The value to convert.
|
|
472
|
-
* @returns The array.
|
|
473
|
-
*/
|
|
494
|
+
* Converts a value to an array.
|
|
495
|
+
* @param array - The value to convert.
|
|
496
|
+
* @returns The array.
|
|
497
|
+
*/
|
|
474
498
|
declare function toArray<T>(array?: Nullable<Arrayable<T>>): T[];
|
|
475
499
|
//#endregion
|
|
476
500
|
//#region src/array/arrayable.d.ts
|
|
477
501
|
/**
|
|
478
|
-
* Convert `Arrayable<T>` to `Array<T>` and flatten the result
|
|
479
|
-
* @param array - given array
|
|
480
|
-
* @returns Array<T>
|
|
481
|
-
*/
|
|
482
|
-
declare function flattenArrayable<T>(array?: Nullable<Arrayable<T |
|
|
502
|
+
* Convert `Arrayable<T>` to `Array<T>` and flatten the result
|
|
503
|
+
* @param array - given array
|
|
504
|
+
* @returns Array<T>
|
|
505
|
+
*/
|
|
506
|
+
declare function flattenArrayable<T>(array?: Nullable<Arrayable<T | T[]>>): T[];
|
|
483
507
|
/**
|
|
484
|
-
* Use rest arguments to merge arrays
|
|
485
|
-
* @param args - rest arguments
|
|
486
|
-
* @returns Array<T>
|
|
487
|
-
*/
|
|
488
|
-
declare function mergeArrayable<T>(...args: Nullable<Arrayable<T>>[]):
|
|
508
|
+
* Use rest arguments to merge arrays
|
|
509
|
+
* @param args - rest arguments
|
|
510
|
+
* @returns Array<T>
|
|
511
|
+
*/
|
|
512
|
+
declare function mergeArrayable<T>(...args: Nullable<Arrayable<T>>[]): T[];
|
|
489
513
|
//#endregion
|
|
490
514
|
//#region src/array/intersect.d.ts
|
|
491
515
|
/**
|
|
492
|
-
* Get intersect items
|
|
493
|
-
*
|
|
494
|
-
* @returns intersect items
|
|
495
|
-
*/
|
|
516
|
+
* Get intersect items
|
|
517
|
+
*
|
|
518
|
+
* @returns intersect items
|
|
519
|
+
*/
|
|
496
520
|
declare function intersect<T>(a: T[], b: T[]): T[];
|
|
497
521
|
//#endregion
|
|
498
522
|
//#region src/array/isArrayEqual.d.ts
|
|
499
523
|
/**
|
|
500
|
-
* Check if values of two arrays are equal
|
|
501
|
-
* @param array1 - array 1
|
|
502
|
-
* @param array2 - array 2
|
|
503
|
-
* @returns `true` if equal
|
|
504
|
-
*/
|
|
524
|
+
* Check if values of two arrays are equal
|
|
525
|
+
* @param array1 - array 1
|
|
526
|
+
* @param array2 - array 2
|
|
527
|
+
* @returns `true` if equal
|
|
528
|
+
*/
|
|
505
529
|
declare function isArrayEqual(array1: unknown[], array2: unknown[]): boolean;
|
|
506
530
|
//#endregion
|
|
507
531
|
//#region src/color/color.d.ts
|
|
@@ -520,246 +544,314 @@ declare class Color {
|
|
|
520
544
|
toHexString(isUpperCase?: boolean): string;
|
|
521
545
|
toRGBAString(): string;
|
|
522
546
|
/**
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
547
|
+
* add alpha value to {@link Color}
|
|
548
|
+
*
|
|
549
|
+
* @param alpha - alpha value
|
|
550
|
+
* @returns instance of {@link Color}
|
|
551
|
+
*/
|
|
528
552
|
withAlpha(alpha?: number): Color;
|
|
529
553
|
/**
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
554
|
+
* lighten the color by percentage
|
|
555
|
+
*
|
|
556
|
+
* @param percentage - percentage to lighten
|
|
557
|
+
*/
|
|
534
558
|
lighten(percentage?: number): Color;
|
|
535
559
|
/**
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
560
|
+
* darken the color by percentage
|
|
561
|
+
*
|
|
562
|
+
* @param percentage - percentage to darken
|
|
563
|
+
*/
|
|
540
564
|
darken(percentage?: number): Color;
|
|
541
565
|
}
|
|
542
566
|
//#endregion
|
|
543
567
|
//#region src/color/random.d.ts
|
|
544
568
|
/**
|
|
545
|
-
* get a random RGB color
|
|
546
|
-
* @returns a random RGB color
|
|
547
|
-
*/
|
|
569
|
+
* get a random RGB color
|
|
570
|
+
* @returns a random RGB color
|
|
571
|
+
*/
|
|
548
572
|
declare function randomRGBColor(): string;
|
|
549
573
|
/**
|
|
550
|
-
* get a random RGBA color
|
|
551
|
-
* @returns a random RGBA color
|
|
552
|
-
*/
|
|
574
|
+
* get a random RGBA color
|
|
575
|
+
* @returns a random RGBA color
|
|
576
|
+
*/
|
|
553
577
|
declare function randomRGBAColor(): string;
|
|
554
578
|
/**
|
|
555
|
-
* get a random hex color
|
|
556
|
-
* @returns a random hex color
|
|
557
|
-
*/
|
|
579
|
+
* get a random hex color
|
|
580
|
+
* @returns a random hex color
|
|
581
|
+
*/
|
|
558
582
|
declare function randomHexColor(): string;
|
|
559
583
|
//#endregion
|
|
560
584
|
//#region src/proxy/enhance.d.ts
|
|
561
585
|
/**
|
|
562
|
-
* enhance object
|
|
563
|
-
* @module proxy
|
|
564
|
-
*/
|
|
586
|
+
* enhance object
|
|
587
|
+
* @module proxy
|
|
588
|
+
*/
|
|
565
589
|
declare function enhance<T extends Record<PropertyKey, any>, E extends Record<PropertyKey, any>>(module: T, extra: E): T;
|
|
566
590
|
//#endregion
|
|
591
|
+
//#region src/tree/flatTree.d.ts
|
|
592
|
+
interface FlatTreeOptions<T extends Record<PropertyKey, any>, K extends keyof T> {
|
|
593
|
+
/**
|
|
594
|
+
* children key, maybe `children`, `nodes`, `items` or other name
|
|
595
|
+
*
|
|
596
|
+
* @default `children`
|
|
597
|
+
*/
|
|
598
|
+
childrenKey?: K;
|
|
599
|
+
/**
|
|
600
|
+
* whether to include the current node in the result
|
|
601
|
+
* @default true
|
|
602
|
+
*/
|
|
603
|
+
includeSelf?: boolean;
|
|
604
|
+
/**
|
|
605
|
+
* map function, return value will be used as the result of the current node, if not provided, the current node will be used as the result
|
|
606
|
+
*/
|
|
607
|
+
map?: (ctx: {
|
|
608
|
+
node: T;
|
|
609
|
+
parent: T | null;
|
|
610
|
+
depth: number;
|
|
611
|
+
/**
|
|
612
|
+
* index of the current node in the current level, starting from 0
|
|
613
|
+
*/
|
|
614
|
+
index: number;
|
|
615
|
+
path: T[];
|
|
616
|
+
}) => any;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Flatten tree nodes into a one-dimensional array with depth-first pre-order traversal.
|
|
620
|
+
*
|
|
621
|
+
* If `options.map` is not provided, original nodes are returned.
|
|
622
|
+
*
|
|
623
|
+
* @param roots - Root nodes of the tree.
|
|
624
|
+
* @param options - Flatten options.
|
|
625
|
+
* @returns Flattened nodes.
|
|
626
|
+
*/
|
|
627
|
+
declare function flatTree<T extends Record<PropertyKey, any>, K extends keyof T>(roots: readonly T[], options?: FlatTreeOptions<T, K>): T[];
|
|
628
|
+
/**
|
|
629
|
+
* Flatten tree nodes and map each visited node to a custom result.
|
|
630
|
+
*
|
|
631
|
+
* @param roots - Root nodes of the tree.
|
|
632
|
+
* @param options - Flatten options with a `map` callback.
|
|
633
|
+
* @returns Flattened mapped results.
|
|
634
|
+
*/
|
|
635
|
+
declare function flatTree<T extends Record<PropertyKey, any>, K extends keyof T, R>(roots: readonly T[], options: FlatTreeOptions<T, K> & {
|
|
636
|
+
map: (ctx: any) => R;
|
|
637
|
+
}): R[];
|
|
638
|
+
//#endregion
|
|
567
639
|
//#region src/module/interopDefault.d.ts
|
|
568
640
|
/**
|
|
569
|
-
* Interop default export from a module
|
|
570
|
-
*
|
|
571
|
-
* @param mod - The module
|
|
572
|
-
* @returns The default export
|
|
573
|
-
*
|
|
574
|
-
* @example
|
|
575
|
-
*
|
|
576
|
-
* ```ts
|
|
577
|
-
* import { interopDefault } from '@ntnyq/utils'
|
|
578
|
-
*
|
|
579
|
-
* const { unindent } = await interopDefault(import('@ntnyq/utils'))
|
|
580
|
-
* ```
|
|
581
|
-
*/
|
|
641
|
+
* Interop default export from a module
|
|
642
|
+
*
|
|
643
|
+
* @param mod - The module
|
|
644
|
+
* @returns The default export
|
|
645
|
+
*
|
|
646
|
+
* @example
|
|
647
|
+
*
|
|
648
|
+
* ```ts
|
|
649
|
+
* import { interopDefault } from '@ntnyq/utils'
|
|
650
|
+
*
|
|
651
|
+
* const { unindent } = await interopDefault(import('@ntnyq/utils'))
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
582
654
|
declare function interopDefault<T>(mod: Awaitable<T>): Promise<InteropModuleDefault<T>>;
|
|
583
655
|
//#endregion
|
|
584
656
|
//#region src/module/resolveSubOptions.d.ts
|
|
585
657
|
/**
|
|
586
|
-
* Resolve sub options `boolean | Options` to `Options`
|
|
587
|
-
* @param options - core options
|
|
588
|
-
* @param key - sub options key
|
|
589
|
-
* @returns resolved sub options
|
|
590
|
-
*
|
|
591
|
-
* @example
|
|
592
|
-
*
|
|
593
|
-
* ```ts
|
|
594
|
-
* import { resolveSubOptions } from '@ntnyq/utils'
|
|
595
|
-
*
|
|
596
|
-
* interface Options {
|
|
597
|
-
* compile?: boolean | {
|
|
598
|
-
* include?: string[]
|
|
599
|
-
* exclude?: string[]
|
|
600
|
-
* }
|
|
601
|
-
* }
|
|
602
|
-
*
|
|
603
|
-
* const options: Options = {
|
|
604
|
-
* compile: true
|
|
605
|
-
* }
|
|
606
|
-
*
|
|
607
|
-
* console.log(resolveSubOptions(options, 'compile'))
|
|
608
|
-
*
|
|
609
|
-
* // => {}
|
|
610
|
-
* ```
|
|
611
|
-
*/
|
|
612
|
-
declare function resolveSubOptions<T extends Record<string, any>, K
|
|
658
|
+
* Resolve sub options `boolean | Options` to `Options`
|
|
659
|
+
* @param options - core options
|
|
660
|
+
* @param key - sub options key
|
|
661
|
+
* @returns resolved sub options
|
|
662
|
+
*
|
|
663
|
+
* @example
|
|
664
|
+
*
|
|
665
|
+
* ```ts
|
|
666
|
+
* import { resolveSubOptions } from '@ntnyq/utils'
|
|
667
|
+
*
|
|
668
|
+
* interface Options {
|
|
669
|
+
* compile?: boolean | {
|
|
670
|
+
* include?: string[]
|
|
671
|
+
* exclude?: string[]
|
|
672
|
+
* }
|
|
673
|
+
* }
|
|
674
|
+
*
|
|
675
|
+
* const options: Options = {
|
|
676
|
+
* compile: true
|
|
677
|
+
* }
|
|
678
|
+
*
|
|
679
|
+
* console.log(resolveSubOptions(options, 'compile'))
|
|
680
|
+
*
|
|
681
|
+
* // => {}
|
|
682
|
+
* ```
|
|
683
|
+
*/
|
|
684
|
+
declare function resolveSubOptions<T extends Record<string, any>, K extends keyof T>(options: T, key: K): Partial<ResolvedOptions<T[K]>>;
|
|
613
685
|
//#endregion
|
|
614
686
|
//#region src/number/random.d.ts
|
|
615
687
|
interface RamdomNumberOptions {
|
|
616
688
|
/**
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
689
|
+
* include max value
|
|
690
|
+
*
|
|
691
|
+
* @default false
|
|
692
|
+
*/
|
|
621
693
|
includeMax?: boolean;
|
|
622
694
|
}
|
|
623
695
|
/**
|
|
624
|
-
* random an integer by given range
|
|
625
|
-
*
|
|
626
|
-
* @param min - min value
|
|
627
|
-
* @param max - max value
|
|
628
|
-
* @returns random integer in range
|
|
629
|
-
*/
|
|
696
|
+
* random an integer by given range
|
|
697
|
+
*
|
|
698
|
+
* @param min - min value
|
|
699
|
+
* @param max - max value
|
|
700
|
+
* @returns random integer in range
|
|
701
|
+
*/
|
|
630
702
|
declare function randomNumber(min: number, max?: number, options?: RamdomNumberOptions): number;
|
|
631
703
|
//#endregion
|
|
632
704
|
//#region src/number/toInteger.d.ts
|
|
633
705
|
interface ToIntegerOptions {
|
|
634
706
|
/**
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
707
|
+
* The number to convert to an integer.
|
|
708
|
+
*
|
|
709
|
+
* @default 0
|
|
710
|
+
*/
|
|
639
711
|
defaultValue?: number;
|
|
640
712
|
/**
|
|
641
|
-
|
|
642
|
-
|
|
713
|
+
* @default false
|
|
714
|
+
*/
|
|
643
715
|
allowDecimal?: boolean;
|
|
644
716
|
/**
|
|
645
|
-
|
|
646
|
-
|
|
717
|
+
* @default false
|
|
718
|
+
*/
|
|
647
719
|
allowNaN?: boolean;
|
|
648
720
|
/**
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
onError?:
|
|
721
|
+
* @default `useDefault`
|
|
722
|
+
*/
|
|
723
|
+
onError?: 'useDefault' | 'throwError' | 'returnOriginal';
|
|
652
724
|
/**
|
|
653
|
-
|
|
654
|
-
|
|
725
|
+
* Minimum value of the number. included
|
|
726
|
+
*/
|
|
655
727
|
min?: number;
|
|
656
728
|
/**
|
|
657
|
-
|
|
658
|
-
|
|
729
|
+
* Maximum value of the number. included
|
|
730
|
+
*/
|
|
659
731
|
max?: number;
|
|
660
732
|
/**
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
outOfRange?:
|
|
733
|
+
* @default `clamp`
|
|
734
|
+
*/
|
|
735
|
+
outOfRange?: 'clamp' | 'useDefault' | 'throwError';
|
|
664
736
|
}
|
|
665
737
|
/**
|
|
666
|
-
* Transforms a value to an integer.
|
|
667
|
-
* @param value - The value to convert to an integer.
|
|
668
|
-
* @param options - Options for the conversion.
|
|
669
|
-
* @returns The converted integer.
|
|
670
|
-
*/
|
|
738
|
+
* Transforms a value to an integer.
|
|
739
|
+
* @param value - The value to convert to an integer.
|
|
740
|
+
* @param options - Options for the conversion.
|
|
741
|
+
* @returns The converted integer.
|
|
742
|
+
*/
|
|
671
743
|
declare function toInteger(value: unknown, options?: ToIntegerOptions): number;
|
|
672
744
|
//#endregion
|
|
673
745
|
//#region src/object/omit.d.ts
|
|
674
|
-
declare function omit<T, K
|
|
746
|
+
declare function omit<T, K extends keyof T>(object: T, ...keys: K[]): Omit<T, K>;
|
|
675
747
|
//#endregion
|
|
676
748
|
//#region src/object/pick.d.ts
|
|
677
|
-
declare function pick<T, K
|
|
749
|
+
declare function pick<T, K extends keyof T>(object: T, keys: K[]): Pick<T, K>;
|
|
678
750
|
//#endregion
|
|
679
751
|
//#region src/object/clean.d.ts
|
|
680
752
|
interface CleanObjectOptions {
|
|
681
753
|
/**
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
754
|
+
* clean undefined
|
|
755
|
+
*
|
|
756
|
+
* @default true
|
|
757
|
+
*/
|
|
686
758
|
cleanUndefined?: boolean;
|
|
687
759
|
/**
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
760
|
+
* clean null
|
|
761
|
+
*
|
|
762
|
+
* @default true
|
|
763
|
+
*/
|
|
692
764
|
cleanNull?: boolean;
|
|
693
765
|
/**
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
766
|
+
* clean zero
|
|
767
|
+
*
|
|
768
|
+
* @default false
|
|
769
|
+
*/
|
|
698
770
|
cleanZero?: boolean;
|
|
699
771
|
/**
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
772
|
+
* clean NaN
|
|
773
|
+
*
|
|
774
|
+
* @default true
|
|
775
|
+
*/
|
|
704
776
|
cleanNaN?: boolean;
|
|
705
777
|
/**
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
778
|
+
* clean empty string
|
|
779
|
+
*
|
|
780
|
+
* @default false
|
|
781
|
+
*/
|
|
710
782
|
cleanEmptyString?: boolean;
|
|
711
783
|
/**
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
784
|
+
* clean empty array
|
|
785
|
+
*
|
|
786
|
+
* @default false
|
|
787
|
+
*/
|
|
716
788
|
cleanEmptyArray?: boolean;
|
|
717
789
|
/**
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
790
|
+
* clean empty object
|
|
791
|
+
*
|
|
792
|
+
* @default false
|
|
793
|
+
*/
|
|
722
794
|
cleanEmptyObject?: boolean;
|
|
723
795
|
/**
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
796
|
+
* recursive clean object
|
|
797
|
+
*
|
|
798
|
+
* @default true
|
|
799
|
+
*/
|
|
728
800
|
recursive?: boolean;
|
|
729
801
|
}
|
|
730
802
|
/**
|
|
731
|
-
* clean undefined, null, zero, empty string, empty array, empty object from object
|
|
732
|
-
* @param obj - object to be cleaned
|
|
733
|
-
* @param options - clean options
|
|
734
|
-
* @returns cleaned object
|
|
735
|
-
*/
|
|
803
|
+
* clean undefined, null, zero, empty string, empty array, empty object from object
|
|
804
|
+
* @param obj - object to be cleaned
|
|
805
|
+
* @param options - clean options
|
|
806
|
+
* @returns cleaned object
|
|
807
|
+
*/
|
|
736
808
|
declare function cleanObject<T extends object>(obj: T, options?: CleanObjectOptions): T;
|
|
737
809
|
//#endregion
|
|
738
810
|
//#region src/object/hasOwn.d.ts
|
|
739
811
|
/**
|
|
740
|
-
* check object has a property with given key
|
|
741
|
-
* @param object - the object to check
|
|
742
|
-
* @param key - the key to check
|
|
743
|
-
* @returns true if object has a property with given key, false otherwise
|
|
744
|
-
*/
|
|
812
|
+
* check object has a property with given key
|
|
813
|
+
* @param object - the object to check
|
|
814
|
+
* @param key - the key to check
|
|
815
|
+
* @returns true if object has a property with given key, false otherwise
|
|
816
|
+
*/
|
|
745
817
|
declare function hasOwn<T>(object: T, key: PropertyKey): boolean;
|
|
746
818
|
//#endregion
|
|
819
|
+
//#region src/object/isKeyOf.d.ts
|
|
820
|
+
/**
|
|
821
|
+
* Type guard for any key, `k`
|
|
822
|
+
* marks `k` as a key of `T` if `k` is a key of `T`
|
|
823
|
+
*
|
|
824
|
+
* @param obj - object to query for key
|
|
825
|
+
* @param k - key to check for
|
|
826
|
+
* @returns true if `k` is a key of `T`
|
|
827
|
+
*/
|
|
828
|
+
declare function isKeyOf<T extends object>(obj: T, k: keyof T): k is keyof T;
|
|
829
|
+
//#endregion
|
|
747
830
|
//#region src/object/sortObject.d.ts
|
|
748
831
|
interface SortObjectOptions {
|
|
749
832
|
/**
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
833
|
+
* Recursive sorting
|
|
834
|
+
* @default false
|
|
835
|
+
*/
|
|
753
836
|
deep?: boolean;
|
|
754
837
|
/**
|
|
755
|
-
|
|
756
|
-
|
|
838
|
+
* Compare function
|
|
839
|
+
*/
|
|
757
840
|
compareFn?: (left: string, right: string) => number;
|
|
758
841
|
}
|
|
759
842
|
/**
|
|
760
|
-
* Sort object properties
|
|
761
|
-
*/
|
|
762
|
-
declare function sortObject<T extends Record<string, any>>(
|
|
843
|
+
* Sort object properties
|
|
844
|
+
*/
|
|
845
|
+
declare function sortObject<T extends Record<string, any>>(object: T, options?: SortObjectOptions): T;
|
|
846
|
+
//#endregion
|
|
847
|
+
//#region src/object/isPlainObject.d.ts
|
|
848
|
+
/**
|
|
849
|
+
* Check if a value is a plain object (not an array, Date, RegExp, Map, Set, etc.)
|
|
850
|
+
*
|
|
851
|
+
* @param value - Checked value
|
|
852
|
+
* @copyright {@link https://github.com/sindresorhus/is/blob/main/source/index.ts}
|
|
853
|
+
*/
|
|
854
|
+
declare function isPlainObject<Value = unknown>(value: unknown): value is Record<PropertyKey, Value>;
|
|
763
855
|
//#endregion
|
|
764
856
|
//#region src/string/pad.d.ts
|
|
765
857
|
interface CreatePadStringOptions {
|
|
@@ -772,64 +864,70 @@ declare function createPadString(options: CreatePadStringOptions): (value: strin
|
|
|
772
864
|
type JoinableValue = string | number | null | undefined;
|
|
773
865
|
interface JoinOptions {
|
|
774
866
|
/**
|
|
775
|
-
|
|
776
|
-
|
|
867
|
+
* @default ''
|
|
868
|
+
*/
|
|
777
869
|
separator?: string;
|
|
778
870
|
}
|
|
779
871
|
/**
|
|
780
|
-
* Joins an array of strings or numbers into a single string.
|
|
781
|
-
* @param array - An array of strings or numbers.
|
|
782
|
-
* @param options - An object of options.
|
|
783
|
-
* @returns A string.
|
|
784
|
-
*/
|
|
872
|
+
* Joins an array of strings or numbers into a single string.
|
|
873
|
+
* @param array - An array of strings or numbers.
|
|
874
|
+
* @param options - An object of options.
|
|
875
|
+
* @returns A string.
|
|
876
|
+
*/
|
|
785
877
|
declare function join(array: JoinableValue[], options?: JoinOptions): string;
|
|
786
878
|
//#endregion
|
|
787
879
|
//#region src/string/slash.d.ts
|
|
788
880
|
/**
|
|
789
|
-
* Replace backslash to slash
|
|
790
|
-
*/
|
|
881
|
+
* Replace backslash to slash
|
|
882
|
+
*/
|
|
791
883
|
declare function slash(input: string): string;
|
|
792
884
|
//#endregion
|
|
885
|
+
//#region src/string/escape.d.ts
|
|
886
|
+
/**
|
|
887
|
+
* @copyright {@link https://github.com/sindresorhus/escape-string-regexp}
|
|
888
|
+
*/
|
|
889
|
+
declare function escapeStringRegexp(value: string): string;
|
|
890
|
+
//#endregion
|
|
793
891
|
//#region src/string/random.d.ts
|
|
794
892
|
/**
|
|
795
|
-
* randome a string useing given chars
|
|
796
|
-
*
|
|
797
|
-
* @param length - string length
|
|
798
|
-
* @param chars - string chars
|
|
799
|
-
* @returns random string
|
|
800
|
-
*/
|
|
893
|
+
* randome a string useing given chars
|
|
894
|
+
*
|
|
895
|
+
* @param length - string length
|
|
896
|
+
* @param chars - string chars
|
|
897
|
+
* @returns random string
|
|
898
|
+
*/
|
|
801
899
|
declare function randomString(length?: number, chars?: string): string;
|
|
802
900
|
//#endregion
|
|
803
901
|
//#region src/string/slugify.d.ts
|
|
804
902
|
/**
|
|
805
|
-
* Default slugify function
|
|
806
|
-
*/
|
|
903
|
+
* Default slugify function
|
|
904
|
+
*/
|
|
807
905
|
declare function slugify(str: string): string;
|
|
808
906
|
//#endregion
|
|
809
907
|
//#region src/string/unindent.d.ts
|
|
810
908
|
/**
|
|
811
|
-
* Remove common leading whitespace from a template string
|
|
812
|
-
* Empty lines at the beginning and end of the template string are also removed.
|
|
813
|
-
* @param input - template string
|
|
814
|
-
*
|
|
815
|
-
* @example
|
|
816
|
-
*
|
|
817
|
-
* ```ts
|
|
818
|
-
* const str = unindent`
|
|
819
|
-
* if (foo) {
|
|
820
|
-
* bar()
|
|
821
|
-
* }
|
|
822
|
-
* `
|
|
823
|
-
* ```
|
|
824
|
-
*/
|
|
909
|
+
* Remove common leading whitespace from a template string
|
|
910
|
+
* Empty lines at the beginning and end of the template string are also removed.
|
|
911
|
+
* @param input - template string
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
*
|
|
915
|
+
* ```ts
|
|
916
|
+
* const str = unindent`
|
|
917
|
+
* if (foo) {
|
|
918
|
+
* bar()
|
|
919
|
+
* }
|
|
920
|
+
* `
|
|
921
|
+
* ```
|
|
922
|
+
*/
|
|
825
923
|
declare function unindent(input: TemplateStringsArray | string): string;
|
|
826
924
|
//#endregion
|
|
827
925
|
//#region src/string/getLength.d.ts
|
|
828
926
|
/**
|
|
829
|
-
* Counts graphemes in a given string
|
|
830
|
-
* @param value - A string to count graphemes.
|
|
831
|
-
* @returns The number of graphemes in `value`.
|
|
832
|
-
*/
|
|
927
|
+
* Counts graphemes in a given string
|
|
928
|
+
* @param value - A string to count graphemes.
|
|
929
|
+
* @returns The number of graphemes in `value`.
|
|
930
|
+
*/
|
|
833
931
|
declare function getStringLength(value: string): number;
|
|
834
932
|
//#endregion
|
|
835
933
|
//#region src/string/ensurePrefix.d.ts
|
|
@@ -840,67 +938,67 @@ declare function ensureSuffix(input: string, suffix: string): string;
|
|
|
840
938
|
//#endregion
|
|
841
939
|
//#region src/string/getSimilarity.d.ts
|
|
842
940
|
/**
|
|
843
|
-
* @copyright {@link https://github.com/stephenjjbrown/string-similarity-js}
|
|
844
|
-
*/
|
|
941
|
+
* @copyright {@link https://github.com/stephenjjbrown/string-similarity-js}
|
|
942
|
+
*/
|
|
845
943
|
interface GetStringSimilarityOptions {
|
|
846
944
|
/**
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
945
|
+
* The length of the slice to compare.
|
|
946
|
+
* @default 2
|
|
947
|
+
*/
|
|
850
948
|
sliceLength?: number;
|
|
851
949
|
/**
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
950
|
+
* Whether to ignore case when comparing strings.
|
|
951
|
+
* @default false
|
|
952
|
+
*/
|
|
855
953
|
caseSensitive?: boolean;
|
|
856
954
|
}
|
|
857
955
|
declare function getStringSimilarity(str1: string, str2: string, options?: GetStringSimilarityOptions): number;
|
|
858
956
|
//#endregion
|
|
859
957
|
//#region src/constants/char.d.ts
|
|
860
958
|
/**
|
|
861
|
-
* Special chars
|
|
862
|
-
*/
|
|
959
|
+
* Special chars
|
|
960
|
+
*/
|
|
863
961
|
declare const SPECIAL_CHAR: {
|
|
864
962
|
/**
|
|
865
|
-
|
|
866
|
-
|
|
963
|
+
* 中文顿号
|
|
964
|
+
*/
|
|
867
965
|
chineseComma: string;
|
|
868
966
|
/**
|
|
869
|
-
|
|
870
|
-
|
|
967
|
+
* 英文逗号
|
|
968
|
+
*/
|
|
871
969
|
englishComma: string;
|
|
872
970
|
/**
|
|
873
|
-
|
|
874
|
-
|
|
971
|
+
* 英文句号
|
|
972
|
+
*/
|
|
875
973
|
englishPeriod: string;
|
|
876
974
|
/**
|
|
877
|
-
|
|
878
|
-
|
|
975
|
+
* 连接符
|
|
976
|
+
*/
|
|
879
977
|
hyphen: string;
|
|
880
978
|
/**
|
|
881
|
-
|
|
882
|
-
|
|
979
|
+
* 换行
|
|
980
|
+
*/
|
|
883
981
|
newline: string;
|
|
884
982
|
/**
|
|
885
|
-
|
|
886
|
-
|
|
983
|
+
* 空格
|
|
984
|
+
*/
|
|
887
985
|
whitespace: string;
|
|
888
986
|
};
|
|
889
987
|
//#endregion
|
|
890
988
|
//#region src/constants/regexp.d.ts
|
|
891
989
|
/**
|
|
892
|
-
* 注释正则
|
|
893
|
-
*
|
|
894
|
-
* 匹配 \<!-- 或 /* 开头的注释,直到 --> 或 *\/ 结尾
|
|
895
|
-
*/
|
|
990
|
+
* 注释正则
|
|
991
|
+
*
|
|
992
|
+
* 匹配 \<!-- 或 /* 开头的注释,直到 --> 或 *\/ 结尾
|
|
993
|
+
*/
|
|
896
994
|
declare const RE_COMMENTS: RegExp;
|
|
897
995
|
/**
|
|
898
|
-
* JavaScript line comment
|
|
899
|
-
*/
|
|
996
|
+
* JavaScript line comment
|
|
997
|
+
*/
|
|
900
998
|
declare const RE_LINE_COMMENT: RegExp;
|
|
901
999
|
/**
|
|
902
|
-
* JavaScript block comment
|
|
903
|
-
*/
|
|
1000
|
+
* JavaScript block comment
|
|
1001
|
+
*/
|
|
904
1002
|
declare const RE_BLOCK_COMMENT: RegExp;
|
|
905
1003
|
//#endregion
|
|
906
|
-
export { AnyFn, Arrayable, Awaitable, Callable, CleanObjectOptions, Color, CreatePadStringOptions, DeepRequired, ElementOf, GetStringSimilarityOptions, InteropModuleDefault, JsonArray, JsonObject, JsonPrimitive, JsonValue, LiteralUnion, MayBe, Merge, NOOP, NonEmptyObject, NonEmptyString, Nullable, OpenExternalURLOptions, Overwrite, Prettify, PrettifyV2, Primitive, RE_BLOCK_COMMENT, RE_COMMENTS, RE_LINE_COMMENT, RamdomNumberOptions, ResolvedOptions, SPECIAL_CHAR, STORAGE_UNITS, SortObjectOptions, StorageUnit, TIME_UNITS, ThrottleDebounceOptions, TimeUnit, ToIntegerOptions, UrlString, ValueOf, Whitespace, at, cAF, chunk, clamp, cleanObject, convertFromBytes, convertFromMilliseconds, convertStorageUnit, convertTimeUnit, convertToBytes, convertToMilliseconds, createPadString, debounce, enhance, ensurePrefix, ensureSuffix, escapeHTML, flattenArrayable, getObjectType, getRoot, getStringLength, getStringSimilarity, hasOwn, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBlob, isBoolean, isBrowser, isDeepEqual, isElementVisibleInViewport, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFile, isFormData, isFunction, isHTMLElement, isInteger, isIterable, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPromise, isRegExp, isSet, isString, isTruthy, isUndefined, isUrlString, isWhitespaceString, isZero, join, last, mergeArrayable, noop, omit, once, openExternalURL, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, removeFileExtension, resolveSubOptions, scrollElementIntoView, slash, slugify, sortObject, throttle, toArray, toInteger, unescapeHTML, unindent, unique, uniqueBy, waitFor, warnOnce };
|
|
1004
|
+
export { AnyFn, Arrayable, Awaitable, Callable, CleanObjectOptions, Color, CreatePadStringOptions, DeepRequired, ElementOf, FlatTreeOptions, GetStringSimilarityOptions, InteropModuleDefault, JsonArray, JsonObject, JsonPrimitive, JsonValue, LiteralUnion, MayBe, Merge, NOOP, NonEmptyObject, NonEmptyString, Nullable, OpenExternalURLOptions, Overwrite, Prettify, PrettifyV2, Primitive, RE_BLOCK_COMMENT, RE_COMMENTS, RE_LINE_COMMENT, RamdomNumberOptions, ResolvedOptions, SPECIAL_CHAR, STORAGE_UNITS, SortObjectOptions, StorageUnit, TIME_UNITS, ThrottleDebounceOptions, TimeUnit, ToIntegerOptions, UrlString, ValueOf, Whitespace, at, cAF, chunk, clamp, cleanObject, convertFromBytes, convertFromMilliseconds, convertStorageUnit, convertTimeUnit, convertToBytes, convertToMilliseconds, createPadString, debounce, enhance, ensurePrefix, ensureSuffix, escapeHTML, escapeStringRegexp, flatTree, flattenArrayable, getFileExtension, getObjectType, getRoot, getStringLength, getStringSimilarity, hasOwn, interopDefault, intersect, isArray, isArrayEqual, isBigInt, isBlob, isBoolean, isBrowser, isDeepEqual, isElementVisibleInViewport, isEmptyArray, isEmptyMap, isEmptyObject, isEmptySet, isEmptyString, isEmptyStringOrWhitespace, isError, isFile, isFormData, isFunction, isHTMLElement, isInteger, isIterable, isKeyOf, isMap, isNaN, isNativePromise, isNil, isNonEmptyArray, isNonEmptyString, isNull, isNullOrUndefined, isNumber, isNumbericString, isObject, isPlainObject, isPromise, isRegExp, isSet, isString, isTruthy, isUndefined, isUrlString, isWhitespaceString, isZero, join, last, mergeArrayable, noop, omit, once, openExternalURL, pick, rAF, randomHexColor, randomNumber, randomRGBAColor, randomRGBColor, randomString, remove, removeFileExtension, resolveSubOptions, scrollElementIntoView, shuffle, slash, slugify, sortObject, throttle, toArray, toInteger, unescapeHTML, unindent, unique, uniqueBy, waitFor, warnOnce };
|