@dereekb/util 13.10.9 → 13.11.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/fetch/package.json +2 -2
- package/index.cjs.js +2578 -51
- package/index.esm.js +2568 -52
- package/package.json +1 -1
- package/src/lib/array/array.d.ts +79 -0
- package/src/lib/array/array.factory.d.ts +12 -0
- package/src/lib/array/array.find.d.ts +11 -0
- package/src/lib/array/array.limit.d.ts +5 -0
- package/src/lib/array/array.random.d.ts +16 -0
- package/src/lib/array/array.set.d.ts +20 -0
- package/src/lib/array/array.unique.d.ts +38 -0
- package/src/lib/array/array.value.d.ts +10 -0
- package/src/lib/auth/index.d.ts +2 -0
- package/src/lib/auth/oauth.d.ts +12 -0
- package/src/lib/auth/pkce.d.ts +13 -0
- package/src/lib/boolean.d.ts +36 -0
- package/src/lib/cache/cache.d.ts +48 -0
- package/src/lib/cache/cache.memoize.d.ts +59 -0
- package/src/lib/cache/cache.memory.d.ts +39 -0
- package/src/lib/cache/cache.merge.d.ts +48 -0
- package/src/lib/cache/index.d.ts +4 -0
- package/src/lib/contact/domain.d.ts +15 -0
- package/src/lib/contact/email.d.ts +15 -0
- package/src/lib/date/date.unix.d.ts +20 -0
- package/src/lib/date/expires.d.ts +85 -16
- package/src/lib/function/function.d.ts +5 -0
- package/src/lib/getter/getter.d.ts +21 -0
- package/src/lib/grouping.d.ts +30 -0
- package/src/lib/hash.d.ts +10 -0
- package/src/lib/index.d.ts +1 -0
- package/src/lib/iterable/iterable.d.ts +20 -0
- package/src/lib/iterate.d.ts +5 -0
- package/src/lib/number/bound.d.ts +23 -0
- package/src/lib/number/number.d.ts +47 -0
- package/src/lib/number/random.d.ts +11 -0
- package/src/lib/number/round.d.ts +16 -0
- package/src/lib/object/object.d.ts +24 -0
- package/src/lib/object/object.empty.d.ts +5 -0
- package/src/lib/object/object.equal.d.ts +5 -0
- package/src/lib/object/object.filter.pojo.d.ts +31 -1
- package/src/lib/object/object.flatten.d.ts +4 -0
- package/src/lib/path/path.d.ts +191 -0
- package/src/lib/promise/is.d.ts +10 -0
- package/src/lib/promise/poll.d.ts +5 -0
- package/src/lib/promise/promise.d.ts +20 -0
- package/src/lib/promise/promise.type.d.ts +4 -0
- package/src/lib/promise/wait.d.ts +5 -0
- package/src/lib/set/set.d.ts +15 -0
- package/src/lib/sort.d.ts +16 -0
- package/src/lib/string/case.d.ts +10 -0
- package/src/lib/string/string.d.ts +54 -0
- package/src/lib/tree/tree.array.d.ts +6 -0
- package/src/lib/tree/tree.expand.d.ts +5 -0
- package/src/lib/tree/tree.explore.d.ts +24 -0
- package/src/lib/tree/tree.flatten.d.ts +16 -0
- package/src/lib/type.d.ts +20 -0
- package/src/lib/value/build.d.ts +4 -0
- package/src/lib/value/comparator.d.ts +11 -0
- package/src/lib/value/decision.d.ts +17 -0
- package/src/lib/value/equal.d.ts +17 -0
- package/src/lib/value/map.d.ts +23 -0
- package/src/lib/value/maybe.d.ts +49 -0
- package/src/lib/value/modifier.d.ts +5 -0
- package/test/package.json +2 -2
package/src/lib/path/path.d.ts
CHANGED
|
@@ -5,13 +5,46 @@ import { type FactoryWithRequiredInput } from '../getter/getter';
|
|
|
5
5
|
import { type PrimativeValue } from '../type';
|
|
6
6
|
import { type Maybe } from '../value/maybe.type';
|
|
7
7
|
import { type IndexRangeInput } from '../value/indexed';
|
|
8
|
+
/**
|
|
9
|
+
* The forward-slash character used to separate parts of a slash path.
|
|
10
|
+
*
|
|
11
|
+
* @dbxUtil
|
|
12
|
+
* @dbxUtilCategory path
|
|
13
|
+
* @dbxUtilKind const
|
|
14
|
+
* @dbxUtilTags path, slash, separator, constant, delimiter
|
|
15
|
+
* @dbxUtilRelated slash-path-file-type-separator, slash-path-parts
|
|
16
|
+
*/
|
|
8
17
|
export declare const SLASH_PATH_SEPARATOR = "/";
|
|
18
|
+
/**
|
|
19
|
+
* The dot character used to separate the file extension from the file name within a slash path.
|
|
20
|
+
*
|
|
21
|
+
* @dbxUtil
|
|
22
|
+
* @dbxUtilCategory path
|
|
23
|
+
* @dbxUtilKind const
|
|
24
|
+
* @dbxUtilTags path, slash, separator, dot, file-type, extension, constant
|
|
25
|
+
* @dbxUtilRelated slash-path-separator, slash-path-type, slash-path-details
|
|
26
|
+
*/
|
|
9
27
|
export declare const SLASH_PATH_FILE_TYPE_SEPARATOR = ".";
|
|
10
28
|
export type SlashPathSeparatorString = typeof SLASH_PATH_SEPARATOR;
|
|
11
29
|
export type SlashFileTypeSeparatorString = typeof SLASH_PATH_FILE_TYPE_SEPARATOR;
|
|
30
|
+
/**
|
|
31
|
+
* The default set of characters that are considered illegal in a slash path.
|
|
32
|
+
*
|
|
33
|
+
* @dbxUtil
|
|
34
|
+
* @dbxUtilCategory path
|
|
35
|
+
* @dbxUtilKind const
|
|
36
|
+
* @dbxUtilTags path, slash, illegal, characters, default, sanitize, validate
|
|
37
|
+
* @dbxUtilRelated default-slash-path-illegal-character-replacement, slash-path-validation-factory
|
|
38
|
+
*/
|
|
12
39
|
export declare const DEFAULT_SLASH_PATH_ILLEGAL_CHARACTERS: string[];
|
|
13
40
|
/**
|
|
14
41
|
* Default replacement character for illegal characters.
|
|
42
|
+
*
|
|
43
|
+
* @dbxUtil
|
|
44
|
+
* @dbxUtilCategory path
|
|
45
|
+
* @dbxUtilKind const
|
|
46
|
+
* @dbxUtilTags path, slash, illegal, replacement, default, sanitize
|
|
47
|
+
* @dbxUtilRelated default-slash-path-illegal-characters, slash-path-validation-factory
|
|
15
48
|
*/
|
|
16
49
|
export declare const DEFAULT_SLASH_PATH_ILLEGAL_CHARACTER_REPLACEMENT = "_";
|
|
17
50
|
/**
|
|
@@ -91,6 +124,11 @@ export type SlashPathType = 'folder' | 'file' | 'typedfile' | 'invalid';
|
|
|
91
124
|
/**
|
|
92
125
|
* Determines the type of a slash path string.
|
|
93
126
|
*
|
|
127
|
+
* @dbxUtil
|
|
128
|
+
* @dbxUtilCategory path
|
|
129
|
+
* @dbxUtilTags path, slash, type, classify, file, folder, typed, detect
|
|
130
|
+
* @dbxUtilRelated is-slash-path-file, is-slash-path-folder, is-slash-path-typed-file, is-valid-slash-path
|
|
131
|
+
*
|
|
94
132
|
* @param input - The slash path to classify.
|
|
95
133
|
* @returns The path type classification.
|
|
96
134
|
*/
|
|
@@ -98,6 +136,11 @@ export declare function slashPathType(input: SlashPath): SlashPathType;
|
|
|
98
136
|
/**
|
|
99
137
|
* Type guard that checks if the input is a file path (typed or untyped).
|
|
100
138
|
*
|
|
139
|
+
* @dbxUtil
|
|
140
|
+
* @dbxUtilCategory path
|
|
141
|
+
* @dbxUtilTags path, slash, file, type-guard, predicate, check, is
|
|
142
|
+
* @dbxUtilRelated is-slash-path-typed-file, is-slash-path-folder, slash-path-type
|
|
143
|
+
*
|
|
101
144
|
* @param input - The string to check.
|
|
102
145
|
* @returns Whether the input is a file path.
|
|
103
146
|
*/
|
|
@@ -105,6 +148,11 @@ export declare function isSlashPathFile(input: string): input is SlashPathFile;
|
|
|
105
148
|
/**
|
|
106
149
|
* Type guard that checks if the input is a typed file path (contains a file extension).
|
|
107
150
|
*
|
|
151
|
+
* @dbxUtil
|
|
152
|
+
* @dbxUtilCategory path
|
|
153
|
+
* @dbxUtilTags path, slash, file, extension, type-guard, predicate, typed
|
|
154
|
+
* @dbxUtilRelated is-slash-path-file, is-slash-path-folder, slash-path-type
|
|
155
|
+
*
|
|
108
156
|
* @param input - The string to check.
|
|
109
157
|
* @returns Whether the input is a typed file path.
|
|
110
158
|
*/
|
|
@@ -112,6 +160,11 @@ export declare function isSlashPathTypedFile(input: string): input is SlashPathT
|
|
|
112
160
|
/**
|
|
113
161
|
* Type guard that checks if the input is a folder path (ends with a slash).
|
|
114
162
|
*
|
|
163
|
+
* @dbxUtil
|
|
164
|
+
* @dbxUtilCategory path
|
|
165
|
+
* @dbxUtilTags path, slash, folder, directory, type-guard, predicate, trailing
|
|
166
|
+
* @dbxUtilRelated is-slash-path-file, is-valid-slash-path, slash-path-type
|
|
167
|
+
*
|
|
115
168
|
* @param input - The string to check.
|
|
116
169
|
* @returns Whether the input is a folder path.
|
|
117
170
|
*/
|
|
@@ -119,6 +172,11 @@ export declare function isSlashPathFolder(input: string): input is SlashPathFold
|
|
|
119
172
|
/**
|
|
120
173
|
* Type guard that checks if the input is a valid slash path (not 'invalid' type).
|
|
121
174
|
*
|
|
175
|
+
* @dbxUtil
|
|
176
|
+
* @dbxUtilCategory path
|
|
177
|
+
* @dbxUtilTags path, slash, valid, type-guard, predicate, check, validate
|
|
178
|
+
* @dbxUtilRelated slash-path-type, slash-path-validation-factory, slash-path-invalid-error
|
|
179
|
+
*
|
|
122
180
|
* @param input - The string to check.
|
|
123
181
|
* @returns Whether the input is a valid slash path.
|
|
124
182
|
*/
|
|
@@ -126,6 +184,11 @@ export declare function isValidSlashPath(input: string): input is SlashPath;
|
|
|
126
184
|
/**
|
|
127
185
|
* Returns the last part of the slash path.
|
|
128
186
|
*
|
|
187
|
+
* @dbxUtil
|
|
188
|
+
* @dbxUtilCategory path
|
|
189
|
+
* @dbxUtilTags path, slash, name, last, basename, leaf, file, folder
|
|
190
|
+
* @dbxUtilRelated slash-path-parts, slash-path-details, isolate-slash-path
|
|
191
|
+
*
|
|
129
192
|
* @param slashPath - The path to extract the name from.
|
|
130
193
|
* @returns The last part of the path (file name or folder name).
|
|
131
194
|
*/
|
|
@@ -133,6 +196,11 @@ export declare function slashPathName(slashPath: SlashPath): SlashPathPart;
|
|
|
133
196
|
/**
|
|
134
197
|
* Returns each section of a SlashPath.
|
|
135
198
|
*
|
|
199
|
+
* @dbxUtil
|
|
200
|
+
* @dbxUtilCategory path
|
|
201
|
+
* @dbxUtilTags path, slash, split, parts, segments, sections, components
|
|
202
|
+
* @dbxUtilRelated slash-path-name, slash-path-details, isolate-slash-path
|
|
203
|
+
*
|
|
136
204
|
* @param slashPath - The path to split.
|
|
137
205
|
* @returns Array of non-empty path segments.
|
|
138
206
|
*/
|
|
@@ -151,6 +219,12 @@ export type SlashPathStartTypeFactory = SlashPathFunction;
|
|
|
151
219
|
/**
|
|
152
220
|
* Creates a function that enforces the specified start type on a slash path.
|
|
153
221
|
*
|
|
222
|
+
* @dbxUtil
|
|
223
|
+
* @dbxUtilCategory path
|
|
224
|
+
* @dbxUtilKind factory
|
|
225
|
+
* @dbxUtilTags path, slash, factory, start-type, relative, absolute, normalize
|
|
226
|
+
* @dbxUtilRelated to-relative-slash-path-start-type, to-absolute-slash-path-start-type, slash-path-factory
|
|
227
|
+
*
|
|
154
228
|
* @param type - The start type to enforce.
|
|
155
229
|
* @returns A function that transforms paths to the specified start type.
|
|
156
230
|
*/
|
|
@@ -164,6 +238,11 @@ export declare const ALL_SLASH_PATH_FILE_TYPE_SEPARATORS_REGEX: RegExp;
|
|
|
164
238
|
/**
|
|
165
239
|
* Converts a slash path to a relative path by removing all leading slashes.
|
|
166
240
|
*
|
|
241
|
+
* @dbxUtil
|
|
242
|
+
* @dbxUtilCategory path
|
|
243
|
+
* @dbxUtilTags path, slash, relative, leading, strip, normalize, convert
|
|
244
|
+
* @dbxUtilRelated to-absolute-slash-path-start-type, slash-path-start-type-factory
|
|
245
|
+
*
|
|
167
246
|
* @param input - The slash path to convert.
|
|
168
247
|
* @returns A relative path without leading slashes.
|
|
169
248
|
*/
|
|
@@ -199,6 +278,12 @@ export interface SlashPathFolderFactoryConfig {
|
|
|
199
278
|
/**
|
|
200
279
|
* Creates a SlashPathFolderFactory.
|
|
201
280
|
*
|
|
281
|
+
* @dbxUtil
|
|
282
|
+
* @dbxUtilCategory path
|
|
283
|
+
* @dbxUtilKind factory
|
|
284
|
+
* @dbxUtilTags path, slash, folder, factory, validate, normalize, trailing-slash
|
|
285
|
+
* @dbxUtilRelated slash-path-folder, slash-path-validation-factory, add-trailing-slash
|
|
286
|
+
*
|
|
202
287
|
* @param config Configuration options for the factory.
|
|
203
288
|
* @returns A SlashPathFolderFactory.
|
|
204
289
|
*/
|
|
@@ -208,6 +293,11 @@ export declare function slashPathFolderFactory(config?: SlashPathFolderFactoryCo
|
|
|
208
293
|
*
|
|
209
294
|
* If the input is a file, the folder of the file is returned instead.
|
|
210
295
|
*
|
|
296
|
+
* @dbxUtil
|
|
297
|
+
* @dbxUtilCategory path
|
|
298
|
+
* @dbxUtilTags path, slash, folder, convert, normalize, validate, directory
|
|
299
|
+
* @dbxUtilRelated slash-path-folder-factory, slash-path-details, add-trailing-slash
|
|
300
|
+
*
|
|
211
301
|
* @param input - the string path to convert to a folder path
|
|
212
302
|
* @param config - optional configuration controlling path type inference and invalid-path handling
|
|
213
303
|
* @returns a valid slash path folder string with a trailing slash, or an empty string for relative root
|
|
@@ -216,6 +306,11 @@ export declare function slashPathFolder(input: string, config?: SlashPathFolderF
|
|
|
216
306
|
/**
|
|
217
307
|
* Converts a slash path to an absolute path by ensuring exactly one leading slash.
|
|
218
308
|
*
|
|
309
|
+
* @dbxUtil
|
|
310
|
+
* @dbxUtilCategory path
|
|
311
|
+
* @dbxUtilTags path, slash, absolute, leading, prefix, normalize, convert
|
|
312
|
+
* @dbxUtilRelated to-relative-slash-path-start-type, slash-path-start-type-factory, fix-multi-slashes-in-slash-path
|
|
313
|
+
*
|
|
219
314
|
* @param input - The slash path to convert.
|
|
220
315
|
* @returns An absolute path starting with a single slash.
|
|
221
316
|
*/
|
|
@@ -223,6 +318,11 @@ export declare function toAbsoluteSlashPathStartType(input: SlashPath): SlashPat
|
|
|
223
318
|
/**
|
|
224
319
|
* Replaces consecutive double slashes with single slashes.
|
|
225
320
|
*
|
|
321
|
+
* @dbxUtil
|
|
322
|
+
* @dbxUtilCategory path
|
|
323
|
+
* @dbxUtilTags path, slash, fix, collapse, double, normalize, dedupe
|
|
324
|
+
* @dbxUtilRelated merge-slash-paths, replace-multiple-file-paths-in-slash-path
|
|
325
|
+
*
|
|
226
326
|
* @param input - The slash path to fix.
|
|
227
327
|
* @returns The path with double slashes collapsed.
|
|
228
328
|
*/
|
|
@@ -230,6 +330,11 @@ export declare function fixMultiSlashesInSlashPath(input: SlashPath): SlashPath;
|
|
|
230
330
|
/**
|
|
231
331
|
* Replaces consecutive double slashes with single slashes. Alias for {@link fixMultiSlashesInSlashPath}.
|
|
232
332
|
*
|
|
333
|
+
* @dbxUtil
|
|
334
|
+
* @dbxUtilCategory path
|
|
335
|
+
* @dbxUtilTags path, slash, alias, collapse, double, normalize
|
|
336
|
+
* @dbxUtilRelated fix-multi-slashes-in-slash-path, merge-slash-paths
|
|
337
|
+
*
|
|
233
338
|
* @param input - The slash path to fix.
|
|
234
339
|
* @returns The path with double slashes collapsed.
|
|
235
340
|
*/
|
|
@@ -237,6 +342,11 @@ export declare function replaceMultipleFilePathsInSlashPath(input: SlashPath): S
|
|
|
237
342
|
/**
|
|
238
343
|
* Removes all trailing slashes from a slash path.
|
|
239
344
|
*
|
|
345
|
+
* @dbxUtil
|
|
346
|
+
* @dbxUtilCategory path
|
|
347
|
+
* @dbxUtilTags path, slash, trim, trailing, strip, remove, normalize
|
|
348
|
+
* @dbxUtilRelated add-trailing-slash, remove-trailing-file-type-separators
|
|
349
|
+
*
|
|
240
350
|
* @param input - The slash path to trim.
|
|
241
351
|
* @returns The path without trailing slashes.
|
|
242
352
|
*/
|
|
@@ -244,6 +354,11 @@ export declare function removeTrailingSlashes(input: SlashPath): SlashPath;
|
|
|
244
354
|
/**
|
|
245
355
|
* Removes all trailing dots from a slash path.
|
|
246
356
|
*
|
|
357
|
+
* @dbxUtil
|
|
358
|
+
* @dbxUtilCategory path
|
|
359
|
+
* @dbxUtilTags path, slash, trim, trailing, dot, file-type, strip, normalize
|
|
360
|
+
* @dbxUtilRelated remove-trailing-slashes, replace-invalid-file-path-type-separators-in-slash-path
|
|
361
|
+
*
|
|
247
362
|
* @param input - The slash path to trim.
|
|
248
363
|
* @returns The path without trailing dots.
|
|
249
364
|
*/
|
|
@@ -251,6 +366,11 @@ export declare function removeTrailingFileTypeSeparators(input: SlashPath): Slas
|
|
|
251
366
|
/**
|
|
252
367
|
* Adds a trailing slash to the input if it does not already have one.
|
|
253
368
|
*
|
|
369
|
+
* @dbxUtil
|
|
370
|
+
* @dbxUtilCategory path
|
|
371
|
+
* @dbxUtilTags path, slash, trailing, append, folder, ensure, normalize
|
|
372
|
+
* @dbxUtilRelated remove-trailing-slashes, slash-path-folder, slash-path-folder-factory
|
|
373
|
+
*
|
|
254
374
|
* @param input A slash path.
|
|
255
375
|
* @returns A slash path folder.
|
|
256
376
|
*/
|
|
@@ -258,6 +378,11 @@ export declare function addTrailingSlash(input: SlashPath): SlashPathFolder;
|
|
|
258
378
|
/**
|
|
259
379
|
* Replaces all extra and invalidate FilePathTypeSeparator values from the SlashPath, returning a valid SlashPath.
|
|
260
380
|
*
|
|
381
|
+
* @dbxUtil
|
|
382
|
+
* @dbxUtilCategory path
|
|
383
|
+
* @dbxUtilTags path, slash, dot, file-type, replace, sanitize, fix, validate
|
|
384
|
+
* @dbxUtilRelated replace-invalid-file-path-type-separators-in-slash-path-function, slash-path-validation-factory
|
|
385
|
+
*
|
|
261
386
|
* @param input
|
|
262
387
|
* @param replaceWith
|
|
263
388
|
* @returns
|
|
@@ -266,6 +391,12 @@ export declare function replaceInvalidFilePathTypeSeparatorsInSlashPath(input: S
|
|
|
266
391
|
/**
|
|
267
392
|
* Creates a function that replaces all extra and invalidate FilePathTypeSeparator values from the SlashPath, returning a valid SlashPath.
|
|
268
393
|
*
|
|
394
|
+
* @dbxUtil
|
|
395
|
+
* @dbxUtilCategory path
|
|
396
|
+
* @dbxUtilKind factory
|
|
397
|
+
* @dbxUtilTags path, slash, dot, file-type, factory, replace, sanitize, validate
|
|
398
|
+
* @dbxUtilRelated replace-invalid-file-path-type-separators-in-slash-path, slash-path-validation-factory
|
|
399
|
+
*
|
|
269
400
|
* @param input
|
|
270
401
|
* @param replaceWith
|
|
271
402
|
* @returns
|
|
@@ -302,6 +433,12 @@ export interface SlashPathValidationFactoryConfig {
|
|
|
302
433
|
/**
|
|
303
434
|
* Creates a validation/fixup function for slash paths that replaces illegal characters and extra dots.
|
|
304
435
|
*
|
|
436
|
+
* @dbxUtil
|
|
437
|
+
* @dbxUtilCategory path
|
|
438
|
+
* @dbxUtilKind factory
|
|
439
|
+
* @dbxUtilTags path, slash, validate, factory, sanitize, illegal, replace, fix
|
|
440
|
+
* @dbxUtilRelated is-valid-slash-path, replace-invalid-file-path-type-separators-in-slash-path-function, slash-path-factory, slash-path-invalid-error
|
|
441
|
+
*
|
|
305
442
|
* @param config - Configuration for validation behavior.
|
|
306
443
|
* @returns A function that validates and fixes a slash path.
|
|
307
444
|
*/
|
|
@@ -327,6 +464,12 @@ export interface SlashPathFactoryConfig {
|
|
|
327
464
|
/**
|
|
328
465
|
* Creates a factory function that merges path segments together with optional base path, start type enforcement, and validation.
|
|
329
466
|
*
|
|
467
|
+
* @dbxUtil
|
|
468
|
+
* @dbxUtilCategory path
|
|
469
|
+
* @dbxUtilKind factory
|
|
470
|
+
* @dbxUtilTags path, slash, factory, merge, base, start-type, validate, normalize
|
|
471
|
+
* @dbxUtilRelated merge-slash-paths, slash-path-validation-factory, slash-path-start-type-factory
|
|
472
|
+
*
|
|
330
473
|
* @param config - Configuration for path generation.
|
|
331
474
|
* @returns A factory function that merges input paths into a single validated slash path.
|
|
332
475
|
*/
|
|
@@ -334,6 +477,11 @@ export declare function slashPathFactory(config?: SlashPathFactoryConfig): Slash
|
|
|
334
477
|
/**
|
|
335
478
|
* Merges an array of path segments into a single slash path, filtering nullish values and collapsing double slashes.
|
|
336
479
|
*
|
|
480
|
+
* @dbxUtil
|
|
481
|
+
* @dbxUtilCategory path
|
|
482
|
+
* @dbxUtilTags path, slash, merge, join, concat, segments, normalize, dedupe
|
|
483
|
+
* @dbxUtilRelated slash-path-factory, fix-multi-slashes-in-slash-path, slash-path-parts
|
|
484
|
+
*
|
|
337
485
|
* @param paths - Array of path segments to merge.
|
|
338
486
|
* @returns The merged slash path.
|
|
339
487
|
*/
|
|
@@ -341,12 +489,22 @@ export declare function mergeSlashPaths(paths: Maybe<SlashPath>[]): SlashPath;
|
|
|
341
489
|
/**
|
|
342
490
|
* Creates an Error indicating that a slash path is invalid.
|
|
343
491
|
*
|
|
492
|
+
* @dbxUtil
|
|
493
|
+
* @dbxUtilCategory path
|
|
494
|
+
* @dbxUtilTags path, slash, error, invalid, throw, validate
|
|
495
|
+
* @dbxUtilRelated is-valid-slash-path, slash-path-validation-factory
|
|
496
|
+
*
|
|
344
497
|
* @returns A new Error with a descriptive message.
|
|
345
498
|
*/
|
|
346
499
|
export declare function slashPathInvalidError(): Error;
|
|
347
500
|
/**
|
|
348
501
|
* Splits the path and returns the items at the given ranges.
|
|
349
502
|
*
|
|
503
|
+
* @dbxUtil
|
|
504
|
+
* @dbxUtilCategory path
|
|
505
|
+
* @dbxUtilTags path, slash, isolate, slice, range, segments, extract, sub-path
|
|
506
|
+
* @dbxUtilRelated isolate-slash-path-function, slash-path-parts, slash-path-details
|
|
507
|
+
*
|
|
350
508
|
* @param path - The path to isolate parts from.
|
|
351
509
|
* @param range - Index range defining which path segments to extract.
|
|
352
510
|
* @returns A new slash path containing only the segments within the range.
|
|
@@ -378,6 +536,12 @@ export type IsolateSlashPathFunction = (path: SlashPath) => SlashPath;
|
|
|
378
536
|
/**
|
|
379
537
|
* Creates an IsolateSlashPathFunction.
|
|
380
538
|
*
|
|
539
|
+
* @dbxUtil
|
|
540
|
+
* @dbxUtilCategory path
|
|
541
|
+
* @dbxUtilKind factory
|
|
542
|
+
* @dbxUtilTags path, slash, isolate, factory, slice, range, segments, sub-path
|
|
543
|
+
* @dbxUtilRelated isolate-slash-path, slash-path-parts, slash-path-details
|
|
544
|
+
*
|
|
381
545
|
* @param config - Configuration with range, optional start type, and file mode.
|
|
382
546
|
* @returns A function that isolates path segments within the configured range.
|
|
383
547
|
*/
|
|
@@ -449,6 +613,11 @@ export interface SlashPathDetails {
|
|
|
449
613
|
/**
|
|
450
614
|
* Returns the details of a path.
|
|
451
615
|
*
|
|
616
|
+
* @dbxUtil
|
|
617
|
+
* @dbxUtilCategory path
|
|
618
|
+
* @dbxUtilTags path, slash, details, parse, decompose, file, folder, extension, parts
|
|
619
|
+
* @dbxUtilRelated slash-path-type, slash-path-parts, slash-path-folder, slash-path-name
|
|
620
|
+
*
|
|
452
621
|
* @param path The path to get details for.
|
|
453
622
|
* @returns The details of the path.
|
|
454
623
|
*/
|
|
@@ -479,6 +648,11 @@ export type SlashPathPathMatcherPath = ArrayOrValue<SlashPathPathMatcherPart>;
|
|
|
479
648
|
/**
|
|
480
649
|
* Expands the input matcher path into decision functions.
|
|
481
650
|
*
|
|
651
|
+
* @dbxUtil
|
|
652
|
+
* @dbxUtilCategory path
|
|
653
|
+
* @dbxUtilTags path, slash, matcher, expand, decision, predicate, wildcard, build
|
|
654
|
+
* @dbxUtilRelated slash-path-path-matcher, slash-path-sub-path-matcher, slash-path-path-matcher-config
|
|
655
|
+
*
|
|
482
656
|
* @param path - Matcher path parts to expand into decision functions.
|
|
483
657
|
* @returns Array of decision functions for each path part.
|
|
484
658
|
*/
|
|
@@ -550,6 +724,11 @@ export type SlashPathPathMatcherConfigInput<N extends PrimativeValue = Primative
|
|
|
550
724
|
/**
|
|
551
725
|
* Creates a SlashPathPathMatcherConfig from the input.
|
|
552
726
|
*
|
|
727
|
+
* @dbxUtil
|
|
728
|
+
* @dbxUtilCategory path
|
|
729
|
+
* @dbxUtilTags path, slash, matcher, config, normalize, coerce
|
|
730
|
+
* @dbxUtilRelated slash-path-path-matcher, slash-path-sub-path-matcher
|
|
731
|
+
*
|
|
553
732
|
* @param input The configuration input.
|
|
554
733
|
* @returns The configuration.
|
|
555
734
|
*/
|
|
@@ -557,6 +736,12 @@ export declare function slashPathPathMatcherConfig<N extends PrimativeValue = Pr
|
|
|
557
736
|
/**
|
|
558
737
|
* Creates a SlashPathPathMatcher.
|
|
559
738
|
*
|
|
739
|
+
* @dbxUtil
|
|
740
|
+
* @dbxUtilCategory path
|
|
741
|
+
* @dbxUtilKind factory
|
|
742
|
+
* @dbxUtilTags path, slash, matcher, factory, predicate, wildcard, target, compare
|
|
743
|
+
* @dbxUtilRelated slash-path-sub-path-matcher, expand-slash-path-path-matcher-part-to-decision-functions, slash-path-path-matcher-config
|
|
744
|
+
*
|
|
560
745
|
* @param input - the matcher configuration, which may be a target path string, an array of path parts, or a full config object
|
|
561
746
|
* @returns The matcher.
|
|
562
747
|
*/
|
|
@@ -615,6 +800,12 @@ export type SlashPathSubPathMatcher = (path: SlashPath) => SlashPathSubPathMatch
|
|
|
615
800
|
/**
|
|
616
801
|
* Creates a SlashPathSubPathMatcher.
|
|
617
802
|
*
|
|
803
|
+
* @dbxUtil
|
|
804
|
+
* @dbxUtilCategory path
|
|
805
|
+
* @dbxUtilKind factory
|
|
806
|
+
* @dbxUtilTags path, slash, matcher, sub-path, factory, base-path, prefix, predicate
|
|
807
|
+
* @dbxUtilRelated slash-path-path-matcher, expand-slash-path-path-matcher-part-to-decision-functions
|
|
808
|
+
*
|
|
618
809
|
* @param config The configuration for the matcher.
|
|
619
810
|
* @returns The matcher.
|
|
620
811
|
*/
|
package/src/lib/promise/is.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Checks whether the input value is a native Promise by testing for a `.then` method.
|
|
3
3
|
*
|
|
4
|
+
* @dbxUtil
|
|
5
|
+
* @dbxUtilCategory promise
|
|
6
|
+
* @dbxUtilTags promise, type-guard, async, then, check
|
|
7
|
+
* @dbxUtilRelated is-promise-like, as-promise
|
|
8
|
+
*
|
|
4
9
|
* @param obj - The value to test.
|
|
5
10
|
* @returns `true` if the value is a Promise, `false` otherwise.
|
|
6
11
|
*/
|
|
@@ -9,6 +14,11 @@ export declare function isPromise<T, S>(obj: Promise<T> | S): obj is Promise<T>;
|
|
|
9
14
|
* Checks whether the input value is PromiseLike (i.e., has a `.then` method), which
|
|
10
15
|
* includes both native Promises and custom thenables.
|
|
11
16
|
*
|
|
17
|
+
* @dbxUtil
|
|
18
|
+
* @dbxUtilCategory promise
|
|
19
|
+
* @dbxUtilTags promise, type-guard, async, then, thenable, check
|
|
20
|
+
* @dbxUtilRelated is-promise, as-promise
|
|
21
|
+
*
|
|
12
22
|
* @param obj - The value to test.
|
|
13
23
|
* @returns `true` if the value is PromiseLike, `false` otherwise.
|
|
14
24
|
*/
|
|
@@ -22,6 +22,11 @@ export interface PollConfig {
|
|
|
22
22
|
/**
|
|
23
23
|
* Polls at a regular interval until a condition is met or the maximum number of attempts is reached.
|
|
24
24
|
*
|
|
25
|
+
* @dbxUtil
|
|
26
|
+
* @dbxUtilCategory promise
|
|
27
|
+
* @dbxUtilTags promise, poll, wait, retry, condition, async, interval
|
|
28
|
+
* @dbxUtilRelated wait-for-ms, perform-task-loop
|
|
29
|
+
*
|
|
25
30
|
* @param config - Polling configuration including check function, wait interval, and max attempts.
|
|
26
31
|
* @param config.check - predicate function that returns true when the polling condition has been satisfied
|
|
27
32
|
* @param config.wait - milliseconds to wait between polling iterations; defaults to 250
|
|
@@ -16,6 +16,11 @@ export type RunAsyncTasksForValuesConfig<T = unknown> = Omit<PerformAsyncTasksCo
|
|
|
16
16
|
/**
|
|
17
17
|
* Runs a single async task and returns the resulting value. Always configured to throw on failure.
|
|
18
18
|
*
|
|
19
|
+
* @dbxUtil
|
|
20
|
+
* @dbxUtilCategory promise
|
|
21
|
+
* @dbxUtilTags promise, async, task, retry, run, value
|
|
22
|
+
* @dbxUtilRelated perform-async-task, run-async-tasks-for-values, perform-async-tasks
|
|
23
|
+
*
|
|
19
24
|
* @param taskFn - The async task to execute.
|
|
20
25
|
* @param config - Optional configuration for retries and retry behavior.
|
|
21
26
|
* @returns The value produced by the task, or undefined if the task produced no value.
|
|
@@ -26,6 +31,11 @@ export declare function runAsyncTaskForValue<O>(taskFn: () => Promise<O>, config
|
|
|
26
31
|
* Runs an async task for each input value and returns an array of the resulting values.
|
|
27
32
|
* Always configured to throw on failure.
|
|
28
33
|
*
|
|
34
|
+
* @dbxUtil
|
|
35
|
+
* @dbxUtilCategory promise
|
|
36
|
+
* @dbxUtilTags promise, async, tasks, parallel, batch, retry, run, values
|
|
37
|
+
* @dbxUtilRelated perform-async-tasks, run-async-task-for-value
|
|
38
|
+
*
|
|
29
39
|
* @param input - The array of input values to process.
|
|
30
40
|
* @param taskFn - The async task function to run for each input value.
|
|
31
41
|
* @param config - Optional configuration for parallelism and retries.
|
|
@@ -106,6 +116,11 @@ export interface PerformAsyncTasksConfig<I = unknown, K extends PrimativeKey = P
|
|
|
106
116
|
* Performs async tasks for each input value with configurable retry and parallelism behavior.
|
|
107
117
|
* Useful for operations that may experience optimistic concurrency collisions.
|
|
108
118
|
*
|
|
119
|
+
* @dbxUtil
|
|
120
|
+
* @dbxUtilCategory promise
|
|
121
|
+
* @dbxUtilTags async, promise, parallel, retry, task, batch, concurrency, throttle
|
|
122
|
+
* @dbxUtilRelated perform-tasks-in-parallel, perform-async-task
|
|
123
|
+
*
|
|
109
124
|
* @param input - The array of input values to process.
|
|
110
125
|
* @param taskFn - The async function to execute for each input.
|
|
111
126
|
* @param config - Configuration for retries, parallelism, and error handling.
|
|
@@ -116,6 +131,11 @@ export declare function performAsyncTasks<I, O = unknown, K extends PrimativeKey
|
|
|
116
131
|
/**
|
|
117
132
|
* Performs a single async task with configurable retry behavior and returns the result with success status.
|
|
118
133
|
*
|
|
134
|
+
* @dbxUtil
|
|
135
|
+
* @dbxUtilCategory promise
|
|
136
|
+
* @dbxUtilTags promise, async, task, retry, run, success
|
|
137
|
+
* @dbxUtilRelated perform-async-tasks, run-async-task-for-value
|
|
138
|
+
*
|
|
119
139
|
* @param taskFn - The async task to execute.
|
|
120
140
|
* @param config - Optional configuration for retries and error handling.
|
|
121
141
|
* @returns A result object containing the value (if successful) and a success flag.
|
|
@@ -5,6 +5,10 @@ export type PromiseOrValue<T> = Promise<T> | T;
|
|
|
5
5
|
/**
|
|
6
6
|
* Wraps the input in a resolved Promise if it is not already a Promise.
|
|
7
7
|
*
|
|
8
|
+
* @dbxUtil
|
|
9
|
+
* @dbxUtilCategory promise
|
|
10
|
+
* @dbxUtilTags promise, async, normalize, resolve, ensure
|
|
11
|
+
*
|
|
8
12
|
* @param input - A value or Promise to normalize into a Promise.
|
|
9
13
|
* @returns A Promise that resolves to the input value.
|
|
10
14
|
*/
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* Returns a Promise that resolves after the specified number of milliseconds.
|
|
3
3
|
* Optionally resolves with the provided value.
|
|
4
4
|
*
|
|
5
|
+
* @dbxUtil
|
|
6
|
+
* @dbxUtilCategory promise
|
|
7
|
+
* @dbxUtilTags promise, wait, sleep, delay, async, timeout
|
|
8
|
+
* @dbxUtilRelated perform-async-tasks, poll
|
|
9
|
+
*
|
|
5
10
|
* @param ms - The number of milliseconds to wait before resolving.
|
|
6
11
|
* @param value - An optional value to resolve the Promise with.
|
|
7
12
|
* @returns A Promise that resolves after the specified delay.
|
package/src/lib/set/set.d.ts
CHANGED
|
@@ -11,6 +11,11 @@ export type AllOrNoneSelection = 'all' | 'none';
|
|
|
11
11
|
/**
|
|
12
12
|
* Converts an {@link IterableOrValue} into a Set. Strings are treated as single values rather than character iterables.
|
|
13
13
|
*
|
|
14
|
+
* @dbxUtil
|
|
15
|
+
* @dbxUtilCategory set
|
|
16
|
+
* @dbxUtilTags set, convert, normalize, ensure, unique, dedupe
|
|
17
|
+
* @dbxUtilRelated add-to-set, iterable-to-set
|
|
18
|
+
*
|
|
14
19
|
* @param values - The value or iterable to convert.
|
|
15
20
|
* @returns A new Set containing all values.
|
|
16
21
|
*/
|
|
@@ -34,6 +39,11 @@ export declare function addToSetCopy<T>(set: Maybe<Set<T>>, values: Maybe<Iterab
|
|
|
34
39
|
/**
|
|
35
40
|
* Adds one or more values to the given set in place.
|
|
36
41
|
*
|
|
42
|
+
* @dbxUtil
|
|
43
|
+
* @dbxUtilCategory set
|
|
44
|
+
* @dbxUtilTags set, add, mutate, insert, in-place
|
|
45
|
+
* @dbxUtilRelated add-to-set-copy, remove-from-set, toggle-in-set
|
|
46
|
+
*
|
|
37
47
|
* @param set - The set to add values to.
|
|
38
48
|
* @param values - The value or iterable of values to add.
|
|
39
49
|
*/
|
|
@@ -49,6 +59,11 @@ export declare function toggleInSetCopy<T>(set: Set<T>, values: Maybe<IterableOr
|
|
|
49
59
|
/**
|
|
50
60
|
* Toggles values in the set in place: adds if absent, removes if present.
|
|
51
61
|
*
|
|
62
|
+
* @dbxUtil
|
|
63
|
+
* @dbxUtilCategory set
|
|
64
|
+
* @dbxUtilTags set, toggle, add, remove, mutate, in-place
|
|
65
|
+
* @dbxUtilRelated toggle-in-set-copy, add-to-set, remove-from-set
|
|
66
|
+
*
|
|
52
67
|
* @param set - The set to modify.
|
|
53
68
|
* @param values - The values to toggle.
|
|
54
69
|
*/
|
package/src/lib/sort.d.ts
CHANGED
|
@@ -44,6 +44,11 @@ export type SortDescendingCompareFunction<T> = SortCompareFunction<T>;
|
|
|
44
44
|
/**
|
|
45
45
|
* Convenience function that reverses the order of the sorted values.
|
|
46
46
|
*
|
|
47
|
+
* @dbxUtil
|
|
48
|
+
* @dbxUtilCategory sort
|
|
49
|
+
* @dbxUtilTags sort, reverse, compare, descending, ascending, order
|
|
50
|
+
* @dbxUtilRelated compare-fn-order, compare-with-mapped-values-function
|
|
51
|
+
*
|
|
47
52
|
* @param compareFn - the comparison function whose order should be reversed
|
|
48
53
|
* @returns a new comparison function with the opposite sort direction
|
|
49
54
|
*/
|
|
@@ -54,6 +59,11 @@ export declare function reverseCompareFn<T>(compareFn: SortDescendingCompareFunc
|
|
|
54
59
|
*
|
|
55
60
|
* The input comparison function must be in ascending order.
|
|
56
61
|
*
|
|
62
|
+
* @dbxUtil
|
|
63
|
+
* @dbxUtilCategory sort
|
|
64
|
+
* @dbxUtilTags sort, order, ascending, descending, compare, direction
|
|
65
|
+
* @dbxUtilRelated reverse-compare-fn, compare-with-mapped-values-function
|
|
66
|
+
*
|
|
57
67
|
* @param ascendingCompareFn - a comparison function that sorts in ascending order
|
|
58
68
|
* @param order - the desired sort direction; defaults to 'asc'
|
|
59
69
|
* @returns the original function if ascending, or a reversed version if descending
|
|
@@ -67,6 +77,12 @@ export declare function compareFnOrder<T>(ascendingCompareFn: AscendingSortCompa
|
|
|
67
77
|
* @param comparesFunction - Compares the mapped values.
|
|
68
78
|
* @returns A sort comparison function for the original type.
|
|
69
79
|
*
|
|
80
|
+
* @dbxUtil
|
|
81
|
+
* @dbxUtilCategory sort
|
|
82
|
+
* @dbxUtilKind factory
|
|
83
|
+
* @dbxUtilTags sort, compare, map, derive, factory, by, key
|
|
84
|
+
* @dbxUtilRelated reverse-compare-fn, compare-fn-order
|
|
85
|
+
*
|
|
70
86
|
* @example
|
|
71
87
|
* ```ts
|
|
72
88
|
* const byName = compareWithMappedValuesFunction(
|
package/src/lib/string/case.d.ts
CHANGED
|
@@ -12,6 +12,11 @@
|
|
|
12
12
|
*
|
|
13
13
|
* Empty segments (e.g. leading underscores in `_USER_ID`) are skipped.
|
|
14
14
|
*
|
|
15
|
+
* @dbxUtil
|
|
16
|
+
* @dbxUtilCategory string
|
|
17
|
+
* @dbxUtilTags string, case, camelcase, snakecase, screaming, convert, transform
|
|
18
|
+
* @dbxUtilRelated camel-or-pascal-to-screaming-snake
|
|
19
|
+
*
|
|
15
20
|
* @param input The SCREAMING_SNAKE_CASE input.
|
|
16
21
|
* @returns The camelCase form.
|
|
17
22
|
*/
|
|
@@ -22,6 +27,11 @@ export declare function screamingSnakeToCamelCase(input: string): string;
|
|
|
22
27
|
* Each upper-case character (other than the first) is preceded by an
|
|
23
28
|
* underscore, then the whole result is upper-cased.
|
|
24
29
|
*
|
|
30
|
+
* @dbxUtil
|
|
31
|
+
* @dbxUtilCategory string
|
|
32
|
+
* @dbxUtilTags string, case, camelcase, pascalcase, snakecase, screaming, convert, transform
|
|
33
|
+
* @dbxUtilRelated screaming-snake-to-camel-case
|
|
34
|
+
*
|
|
25
35
|
* @param input The camelCase / PascalCase input.
|
|
26
36
|
* @returns The SCREAMING_SNAKE_CASE form.
|
|
27
37
|
*/
|