@isdk/util 0.3.3 → 0.3.4
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.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/classes/BinarySemaphore.md +37 -37
- package/docs/classes/ConfigFile.md +9 -9
- package/docs/classes/Deque.md +56 -56
- package/docs/classes/IntSet.md +12 -12
- package/docs/classes/Semaphore.md +38 -38
- package/docs/classes/SignalGate.md +12 -12
- package/docs/functions/RateLimit.md +2 -2
- package/docs/functions/arrayHasAll.md +1 -1
- package/docs/functions/extNameLevel.md +1 -1
- package/docs/functions/filenameReservedRegex.md +1 -1
- package/docs/functions/findPort.md +1 -1
- package/docs/functions/getMultiLevelExtname.md +1 -1
- package/docs/functions/glob.md +3 -3
- package/docs/functions/isStringIn.md +1 -1
- package/docs/functions/isValidFilename.md +1 -1
- package/docs/functions/isValidFilepath.md +1 -1
- package/docs/functions/normalizeIncludeFiles.md +2 -2
- package/docs/functions/parseFrontMatter.md +1 -1
- package/docs/functions/parseYaml.md +2 -2
- package/docs/functions/reControlCharsRegex.md +1 -1
- package/docs/functions/registerYamlTag.md +1 -1
- package/docs/functions/removeLeadingEmptyLines.md +1 -1
- package/docs/functions/sanitizeFilename.md +1 -1
- package/docs/functions/sanitizeFilepath.md +1 -1
- package/docs/functions/sleep.md +1 -1
- package/docs/functions/stringifyYaml.md +2 -2
- package/docs/functions/toCamelCase.md +1 -1
- package/docs/functions/toCapitalCase.md +1 -1
- package/docs/functions/toPascalCase.md +1 -1
- package/docs/functions/traverseFolder.md +1 -1
- package/docs/functions/traverseFolderSync.md +1 -1
- package/docs/functions/yieldExec.md +1 -1
- package/docs/interfaces/BinarySemaphoreAcquireOptions.md +2 -2
- package/docs/interfaces/BinarySemaphoreOptions.md +5 -5
- package/docs/interfaces/BinarySemaphoreReleaseOptions.md +2 -2
- package/docs/interfaces/BinarySemaphoreReleaserFunc.md +3 -3
- package/docs/interfaces/IncludeFiles.md +3 -3
- package/docs/interfaces/LoadConfigFileOptions.md +3 -3
- package/docs/interfaces/SanitizeFilenameOptions.md +3 -3
- package/docs/interfaces/SemaphoreOptions.md +7 -7
- package/docs/interfaces/SemaphoreTaskItem.md +6 -6
- package/docs/type-aliases/SemaphoreIsReadyFuncType.md +1 -1
- package/docs/type-aliases/StringifyFunc.md +1 -1
- package/docs/type-aliases/TraverseFolderHandler.md +1 -1
- package/docs/type-aliases/TraverseFolderSyncHandler.md +1 -1
- package/docs/variables/DefaultAllTextFiles.md +1 -1
- package/docs/variables/DefaultAsyncSemaphoreCapacity.md +1 -1
- package/docs/variables/FilenameReservedRegex.md +1 -1
- package/docs/variables/WindowsReservedNameRegex.md +1 -1
- package/package.json +18 -18
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: Semaphore
|
|
8
8
|
|
|
9
|
-
Defined in: [src/async-semaphore.ts:372](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [src/async-semaphore.ts:372](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L372)
|
|
10
10
|
|
|
11
11
|
A Semaphore implementation for managing concurrency in asynchronous operations.
|
|
12
12
|
Semaphores allow a fixed number of resources to be accessed concurrently.
|
|
@@ -55,9 +55,9 @@ const data = await Promise.all(array.map(fetchData));
|
|
|
55
55
|
|
|
56
56
|
### Constructor
|
|
57
57
|
|
|
58
|
-
> **new Semaphore**(`maxConcurrency`, `options
|
|
58
|
+
> **new Semaphore**(`maxConcurrency`, `options?`): `Semaphore`
|
|
59
59
|
|
|
60
|
-
Defined in: [src/async-semaphore.ts:390](https://github.com/isdk/util.js/blob/
|
|
60
|
+
Defined in: [src/async-semaphore.ts:390](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L390)
|
|
61
61
|
|
|
62
62
|
Creates a semaphore object. The first argument is the maximum concurrently number and the second argument is optional.
|
|
63
63
|
|
|
@@ -87,7 +87,7 @@ The maximum number of callers allowed to acquire the semaphore concurrently.
|
|
|
87
87
|
|
|
88
88
|
> `protected` **\_activeCount**: `number`
|
|
89
89
|
|
|
90
|
-
Defined in: [src/async-semaphore.ts:97](https://github.com/isdk/util.js/blob/
|
|
90
|
+
Defined in: [src/async-semaphore.ts:97](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L97)
|
|
91
91
|
|
|
92
92
|
#### Inherited from
|
|
93
93
|
|
|
@@ -99,7 +99,7 @@ Defined in: [src/async-semaphore.ts:97](https://github.com/isdk/util.js/blob/f6a
|
|
|
99
99
|
|
|
100
100
|
> `protected` **emitter**: `EventEmitter`
|
|
101
101
|
|
|
102
|
-
Defined in: [src/async-semaphore.ts:91](https://github.com/isdk/util.js/blob/
|
|
102
|
+
Defined in: [src/async-semaphore.ts:91](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L91)
|
|
103
103
|
|
|
104
104
|
#### Inherited from
|
|
105
105
|
|
|
@@ -111,7 +111,7 @@ Defined in: [src/async-semaphore.ts:91](https://github.com/isdk/util.js/blob/f6a
|
|
|
111
111
|
|
|
112
112
|
> `protected` **free**: [`Deque`](Deque.md)\<`any`\>
|
|
113
113
|
|
|
114
|
-
Defined in: [src/async-semaphore.ts:374](https://github.com/isdk/util.js/blob/
|
|
114
|
+
Defined in: [src/async-semaphore.ts:374](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L374)
|
|
115
115
|
|
|
116
116
|
#### Overrides
|
|
117
117
|
|
|
@@ -121,9 +121,9 @@ Defined in: [src/async-semaphore.ts:374](https://github.com/isdk/util.js/blob/f6
|
|
|
121
121
|
|
|
122
122
|
### initTokenFn()
|
|
123
123
|
|
|
124
|
-
> `protected` **initTokenFn**: (`token
|
|
124
|
+
> `protected` **initTokenFn**: (`token?`) => `void`
|
|
125
125
|
|
|
126
|
-
Defined in: [src/async-semaphore.ts:95](https://github.com/isdk/util.js/blob/
|
|
126
|
+
Defined in: [src/async-semaphore.ts:95](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L95)
|
|
127
127
|
|
|
128
128
|
#### Parameters
|
|
129
129
|
|
|
@@ -145,7 +145,7 @@ Defined in: [src/async-semaphore.ts:95](https://github.com/isdk/util.js/blob/f6a
|
|
|
145
145
|
|
|
146
146
|
> `readonly` **maxConcurrency**: `number`
|
|
147
147
|
|
|
148
|
-
Defined in: [src/async-semaphore.ts:373](https://github.com/isdk/util.js/blob/
|
|
148
|
+
Defined in: [src/async-semaphore.ts:373](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L373)
|
|
149
149
|
|
|
150
150
|
***
|
|
151
151
|
|
|
@@ -153,7 +153,7 @@ Defined in: [src/async-semaphore.ts:373](https://github.com/isdk/util.js/blob/f6
|
|
|
153
153
|
|
|
154
154
|
> `protected` **paused**: `boolean`
|
|
155
155
|
|
|
156
|
-
Defined in: [src/async-semaphore.ts:96](https://github.com/isdk/util.js/blob/
|
|
156
|
+
Defined in: [src/async-semaphore.ts:96](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L96)
|
|
157
157
|
|
|
158
158
|
#### Inherited from
|
|
159
159
|
|
|
@@ -165,7 +165,7 @@ Defined in: [src/async-semaphore.ts:96](https://github.com/isdk/util.js/blob/f6a
|
|
|
165
165
|
|
|
166
166
|
> `protected` `optional` **pauseFn**: () => `void`
|
|
167
167
|
|
|
168
|
-
Defined in: [src/async-semaphore.ts:93](https://github.com/isdk/util.js/blob/
|
|
168
|
+
Defined in: [src/async-semaphore.ts:93](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L93)
|
|
169
169
|
|
|
170
170
|
#### Returns
|
|
171
171
|
|
|
@@ -181,7 +181,7 @@ Defined in: [src/async-semaphore.ts:93](https://github.com/isdk/util.js/blob/f6a
|
|
|
181
181
|
|
|
182
182
|
> `protected` `optional` **resumeFn**: () => `void`
|
|
183
183
|
|
|
184
|
-
Defined in: [src/async-semaphore.ts:94](https://github.com/isdk/util.js/blob/
|
|
184
|
+
Defined in: [src/async-semaphore.ts:94](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L94)
|
|
185
185
|
|
|
186
186
|
#### Returns
|
|
187
187
|
|
|
@@ -197,7 +197,7 @@ Defined in: [src/async-semaphore.ts:94](https://github.com/isdk/util.js/blob/f6a
|
|
|
197
197
|
|
|
198
198
|
> `protected` **useDefaultTokens**: `boolean`
|
|
199
199
|
|
|
200
|
-
Defined in: [src/async-semaphore.ts:92](https://github.com/isdk/util.js/blob/
|
|
200
|
+
Defined in: [src/async-semaphore.ts:92](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L92)
|
|
201
201
|
|
|
202
202
|
#### Inherited from
|
|
203
203
|
|
|
@@ -207,9 +207,9 @@ Defined in: [src/async-semaphore.ts:92](https://github.com/isdk/util.js/blob/f6a
|
|
|
207
207
|
|
|
208
208
|
### waiting
|
|
209
209
|
|
|
210
|
-
> `readonly` **waiting**: [`Deque`](Deque.md)
|
|
210
|
+
> `readonly` **waiting**: [`Deque`](Deque.md)\<[`SemaphoreTaskItem`](../interfaces/SemaphoreTaskItem.md) \| `undefined`\>
|
|
211
211
|
|
|
212
|
-
Defined in: [src/async-semaphore.ts:89](https://github.com/isdk/util.js/blob/
|
|
212
|
+
Defined in: [src/async-semaphore.ts:89](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L89)
|
|
213
213
|
|
|
214
214
|
#### Inherited from
|
|
215
215
|
|
|
@@ -223,7 +223,7 @@ Defined in: [src/async-semaphore.ts:89](https://github.com/isdk/util.js/blob/f6a
|
|
|
223
223
|
|
|
224
224
|
> **get** **activeCount**(): `number`
|
|
225
225
|
|
|
226
|
-
Defined in: [src/async-semaphore.ts:318](https://github.com/isdk/util.js/blob/
|
|
226
|
+
Defined in: [src/async-semaphore.ts:318](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L318)
|
|
227
227
|
|
|
228
228
|
Get the total count of all active operations.
|
|
229
229
|
|
|
@@ -249,7 +249,7 @@ The total count of active operations, including both waiting and ongoing tasks.
|
|
|
249
249
|
|
|
250
250
|
> **get** **pendingCount**(): `number`
|
|
251
251
|
|
|
252
|
-
Defined in: [src/async-semaphore.ts:327](https://github.com/isdk/util.js/blob/
|
|
252
|
+
Defined in: [src/async-semaphore.ts:327](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L327)
|
|
253
253
|
|
|
254
254
|
Get the number of callers waiting on the semaphore, i.e. the number of pending promises.
|
|
255
255
|
|
|
@@ -267,9 +267,9 @@ The number of waiters in the waiting list.
|
|
|
267
267
|
|
|
268
268
|
### \_dispatchTask()
|
|
269
269
|
|
|
270
|
-
> **\_dispatchTask**(`task`, `options
|
|
270
|
+
> **\_dispatchTask**(`task`, `options?`): `void`
|
|
271
271
|
|
|
272
|
-
Defined in: [src/async-semaphore.ts:212](https://github.com/isdk/util.js/blob/
|
|
272
|
+
Defined in: [src/async-semaphore.ts:212](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L212)
|
|
273
273
|
|
|
274
274
|
#### Parameters
|
|
275
275
|
|
|
@@ -293,9 +293,9 @@ Defined in: [src/async-semaphore.ts:212](https://github.com/isdk/util.js/blob/f6
|
|
|
293
293
|
|
|
294
294
|
### \_newReleaser()
|
|
295
295
|
|
|
296
|
-
> **\_newReleaser**(`options
|
|
296
|
+
> **\_newReleaser**(`options?`): [`BinarySemaphoreReleaserFunc`](../interfaces/BinarySemaphoreReleaserFunc.md)
|
|
297
297
|
|
|
298
|
-
Defined in: [src/async-semaphore.ts:199](https://github.com/isdk/util.js/blob/
|
|
298
|
+
Defined in: [src/async-semaphore.ts:199](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L199)
|
|
299
299
|
|
|
300
300
|
#### Parameters
|
|
301
301
|
|
|
@@ -315,9 +315,9 @@ Defined in: [src/async-semaphore.ts:199](https://github.com/isdk/util.js/blob/f6
|
|
|
315
315
|
|
|
316
316
|
### abort()
|
|
317
317
|
|
|
318
|
-
> **abort**(`reason
|
|
318
|
+
> **abort**(`reason?`): `void`
|
|
319
319
|
|
|
320
|
-
Defined in: [src/async-semaphore.ts:301](https://github.com/isdk/util.js/blob/
|
|
320
|
+
Defined in: [src/async-semaphore.ts:301](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L301)
|
|
321
321
|
|
|
322
322
|
#### Parameters
|
|
323
323
|
|
|
@@ -337,9 +337,9 @@ Defined in: [src/async-semaphore.ts:301](https://github.com/isdk/util.js/blob/f6
|
|
|
337
337
|
|
|
338
338
|
### acquire()
|
|
339
339
|
|
|
340
|
-
> **acquire**(`options
|
|
340
|
+
> **acquire**(`options?`): `Promise`\<[`BinarySemaphoreReleaserFunc`](../interfaces/BinarySemaphoreReleaserFunc.md)\>
|
|
341
341
|
|
|
342
|
-
Defined in: [src/async-semaphore.ts:243](https://github.com/isdk/util.js/blob/
|
|
342
|
+
Defined in: [src/async-semaphore.ts:243](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L243)
|
|
343
343
|
|
|
344
344
|
Acquire a token from the semaphore, thus decrement the number of available execution slots. If initFn is not used then the return value of the function can be discarded.
|
|
345
345
|
|
|
@@ -365,7 +365,7 @@ A promise that resolves to a release function when a token is acquired. If the s
|
|
|
365
365
|
|
|
366
366
|
> **drain**(): `Promise`\<`any`[]\>
|
|
367
367
|
|
|
368
|
-
Defined in: [src/async-semaphore.ts:439](https://github.com/isdk/util.js/blob/
|
|
368
|
+
Defined in: [src/async-semaphore.ts:439](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L439)
|
|
369
369
|
|
|
370
370
|
Drains the semaphore and returns all the initialized tokens in an array. Draining is an ideal way to ensure there are no pending async tasks, for example before a process will terminate.
|
|
371
371
|
|
|
@@ -383,7 +383,7 @@ Drains the semaphore and returns all the initialized tokens in an array. Drainin
|
|
|
383
383
|
|
|
384
384
|
> **init**(`options`): `void`
|
|
385
385
|
|
|
386
|
-
Defined in: [src/async-semaphore.ts:193](https://github.com/isdk/util.js/blob/
|
|
386
|
+
Defined in: [src/async-semaphore.ts:193](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L193)
|
|
387
387
|
|
|
388
388
|
#### Parameters
|
|
389
389
|
|
|
@@ -405,7 +405,7 @@ Defined in: [src/async-semaphore.ts:193](https://github.com/isdk/util.js/blob/f6
|
|
|
405
405
|
|
|
406
406
|
> **initFree**(`options`): `void`
|
|
407
407
|
|
|
408
|
-
Defined in: [src/async-semaphore.ts:408](https://github.com/isdk/util.js/blob/
|
|
408
|
+
Defined in: [src/async-semaphore.ts:408](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L408)
|
|
409
409
|
|
|
410
410
|
#### Parameters
|
|
411
411
|
|
|
@@ -425,9 +425,9 @@ Defined in: [src/async-semaphore.ts:408](https://github.com/isdk/util.js/blob/f6
|
|
|
425
425
|
|
|
426
426
|
### lock()
|
|
427
427
|
|
|
428
|
-
> **lock**(`options
|
|
428
|
+
> **lock**(`options?`): `any`
|
|
429
429
|
|
|
430
|
-
Defined in: [src/async-semaphore.ts:435](https://github.com/isdk/util.js/blob/
|
|
430
|
+
Defined in: [src/async-semaphore.ts:435](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L435)
|
|
431
431
|
|
|
432
432
|
#### Parameters
|
|
433
433
|
|
|
@@ -447,9 +447,9 @@ Defined in: [src/async-semaphore.ts:435](https://github.com/isdk/util.js/blob/f6
|
|
|
447
447
|
|
|
448
448
|
### onReleased()
|
|
449
449
|
|
|
450
|
-
> **onReleased**(`options
|
|
450
|
+
> **onReleased**(`options?`): `void`
|
|
451
451
|
|
|
452
|
-
Defined in: [src/async-semaphore.ts:177](https://github.com/isdk/util.js/blob/
|
|
452
|
+
Defined in: [src/async-semaphore.ts:177](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L177)
|
|
453
453
|
|
|
454
454
|
#### Parameters
|
|
455
455
|
|
|
@@ -469,9 +469,9 @@ Defined in: [src/async-semaphore.ts:177](https://github.com/isdk/util.js/blob/f6
|
|
|
469
469
|
|
|
470
470
|
### release()
|
|
471
471
|
|
|
472
|
-
> **release**(`options
|
|
472
|
+
> **release**(`options?`): `void`
|
|
473
473
|
|
|
474
|
-
Defined in: [src/async-semaphore.ts:288](https://github.com/isdk/util.js/blob/
|
|
474
|
+
Defined in: [src/async-semaphore.ts:288](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L288)
|
|
475
475
|
|
|
476
476
|
Releases the semaphore, incrementing the number of free execution slots. If there are tasks in the waiting queue, the next task will be dispatched.
|
|
477
477
|
|
|
@@ -493,9 +493,9 @@ Releases the semaphore, incrementing the number of free execution slots. If ther
|
|
|
493
493
|
|
|
494
494
|
### tryAcquire()
|
|
495
495
|
|
|
496
|
-
> **tryAcquire**(`options
|
|
496
|
+
> **tryAcquire**(`options?`): `any`
|
|
497
497
|
|
|
498
|
-
Defined in: [src/async-semaphore.ts:416](https://github.com/isdk/util.js/blob/
|
|
498
|
+
Defined in: [src/async-semaphore.ts:416](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L416)
|
|
499
499
|
|
|
500
500
|
Attempt to acquire a token from the semaphore, if one is available immediately. Otherwise, return undefined.
|
|
501
501
|
|
|
@@ -519,9 +519,9 @@ Returns a token if the semaphore is not full; otherwise, returns `undefined`.
|
|
|
519
519
|
|
|
520
520
|
### unlock()
|
|
521
521
|
|
|
522
|
-
> **unlock**(`token
|
|
522
|
+
> **unlock**(`token?`): `void`
|
|
523
523
|
|
|
524
|
-
Defined in: [src/async-semaphore.ts:431](https://github.com/isdk/util.js/blob/
|
|
524
|
+
Defined in: [src/async-semaphore.ts:431](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L431)
|
|
525
525
|
|
|
526
526
|
#### Parameters
|
|
527
527
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: SignalGate\<T\>
|
|
8
8
|
|
|
9
|
-
Defined in: [src/async-signal-gate.ts:20](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [src/async-signal-gate.ts:20](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L20)
|
|
10
10
|
|
|
11
11
|
An asynchronous signal gate that blocks operations until a signal is emitted.
|
|
12
12
|
This class allows multiple awaiters to wait for a signal and resolves all pending promises with the emitted value.
|
|
@@ -46,15 +46,15 @@ valueGate.signal(42); // Must provide a number value
|
|
|
46
46
|
|
|
47
47
|
> `protected` **\_isSignaled**: `boolean` = `false`
|
|
48
48
|
|
|
49
|
-
Defined in: [src/async-signal-gate.ts:21](https://github.com/isdk/util.js/blob/
|
|
49
|
+
Defined in: [src/async-signal-gate.ts:21](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L21)
|
|
50
50
|
|
|
51
51
|
***
|
|
52
52
|
|
|
53
53
|
### \_signalValue
|
|
54
54
|
|
|
55
|
-
> `protected` **\_signalValue**: `
|
|
55
|
+
> `protected` **\_signalValue**: `T` \| `undefined`
|
|
56
56
|
|
|
57
|
-
Defined in: [src/async-signal-gate.ts:22](https://github.com/isdk/util.js/blob/
|
|
57
|
+
Defined in: [src/async-signal-gate.ts:22](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L22)
|
|
58
58
|
|
|
59
59
|
***
|
|
60
60
|
|
|
@@ -62,7 +62,7 @@ Defined in: [src/async-signal-gate.ts:22](https://github.com/isdk/util.js/blob/f
|
|
|
62
62
|
|
|
63
63
|
> `protected` **waitQueue**: `object`[] = `[]`
|
|
64
64
|
|
|
65
|
-
Defined in: [src/async-signal-gate.ts:23](https://github.com/isdk/util.js/blob/
|
|
65
|
+
Defined in: [src/async-signal-gate.ts:23](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L23)
|
|
66
66
|
|
|
67
67
|
#### reject()
|
|
68
68
|
|
|
@@ -100,7 +100,7 @@ Defined in: [src/async-signal-gate.ts:23](https://github.com/isdk/util.js/blob/f
|
|
|
100
100
|
|
|
101
101
|
> **get** **signaled**(): `boolean`
|
|
102
102
|
|
|
103
|
-
Defined in: [src/async-signal-gate.ts:28](https://github.com/isdk/util.js/blob/
|
|
103
|
+
Defined in: [src/async-signal-gate.ts:28](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L28)
|
|
104
104
|
|
|
105
105
|
##### Returns
|
|
106
106
|
|
|
@@ -110,9 +110,9 @@ Defined in: [src/async-signal-gate.ts:28](https://github.com/isdk/util.js/blob/f
|
|
|
110
110
|
|
|
111
111
|
### abort()
|
|
112
112
|
|
|
113
|
-
> **abort**(`reason
|
|
113
|
+
> **abort**(`reason?`): `void`
|
|
114
114
|
|
|
115
|
-
Defined in: [src/async-signal-gate.ts:65](https://github.com/isdk/util.js/blob/
|
|
115
|
+
Defined in: [src/async-signal-gate.ts:65](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L65)
|
|
116
116
|
|
|
117
117
|
Aborts all pending waits, rejecting their promises with an error.
|
|
118
118
|
This does **not** reset the signal state (the gate remains signaled or unsignaled).
|
|
@@ -135,7 +135,7 @@ The reason for aborting the waits.
|
|
|
135
135
|
|
|
136
136
|
> **reset**(): `void`
|
|
137
137
|
|
|
138
|
-
Defined in: [src/async-signal-gate.ts:53](https://github.com/isdk/util.js/blob/
|
|
138
|
+
Defined in: [src/async-signal-gate.ts:53](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L53)
|
|
139
139
|
|
|
140
140
|
Resets the gate to its initial state, allowing a new signal to be emitted.
|
|
141
141
|
|
|
@@ -147,9 +147,9 @@ Resets the gate to its initial state, allowing a new signal to be emitted.
|
|
|
147
147
|
|
|
148
148
|
### signal()
|
|
149
149
|
|
|
150
|
-
> **signal**(`value
|
|
150
|
+
> **signal**(`value?`): `void`
|
|
151
151
|
|
|
152
|
-
Defined in: [src/async-signal-gate.ts:38](https://github.com/isdk/util.js/blob/
|
|
152
|
+
Defined in: [src/async-signal-gate.ts:38](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L38)
|
|
153
153
|
|
|
154
154
|
Emits the signal with an optional value, resolving all pending [wait](#wait) promises.
|
|
155
155
|
Subsequent calls have no effect until [reset](#reset) is called.
|
|
@@ -172,7 +172,7 @@ The value to emit with the signal (only required if T is not void).
|
|
|
172
172
|
|
|
173
173
|
> **wait**(): `Promise`\<`T`\>
|
|
174
174
|
|
|
175
|
-
Defined in: [src/async-signal-gate.ts:83](https://github.com/isdk/util.js/blob/
|
|
175
|
+
Defined in: [src/async-signal-gate.ts:83](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-signal-gate.ts#L83)
|
|
176
176
|
|
|
177
177
|
Returns a promise that resolves with the emitted signal value.
|
|
178
178
|
If called after the signal has been emitted, resolves immediately with the stored value.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **RateLimit**(`rps`, `__namedParameters`): () => `Promise`\<`void`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [src/async-semaphore.ts:476](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/async-semaphore.ts:476](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/async-semaphore.ts#L476)
|
|
12
12
|
|
|
13
13
|
Creates a rate limiter function that blocks with a promise whenever the rate limit is hit and resolves the promise once the call rate is within the limit set by rps. The second argument is optional.
|
|
14
14
|
|
|
@@ -30,7 +30,7 @@ Creates a rate limiter function that blocks with a promise whenever the rate lim
|
|
|
30
30
|
|
|
31
31
|
## Returns
|
|
32
32
|
|
|
33
|
-
`
|
|
33
|
+
> (): `Promise`\<`void`\>
|
|
34
34
|
|
|
35
35
|
### Returns
|
|
36
36
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **arrayHasAll**\<`T`\>(`array`, `elements`): `boolean`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/array-has-all.ts:15](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/array-has-all.ts:15](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/array-has-all.ts#L15)
|
|
12
12
|
|
|
13
13
|
Checks whether the provided array contains all of the specified elements.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **extNameLevel**(`extName`): `number`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:189](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:189](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L189)
|
|
12
12
|
|
|
13
13
|
Calculates the level of an extension name.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **filenameReservedRegex**(): `RegExp`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:42](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:42](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L42)
|
|
12
12
|
|
|
13
13
|
Returns a new regular expression instance for reserved filename characters with the 'g' flag.
|
|
14
14
|
use this to reset the with global option
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **findPort**(`port`, `portRetryCount`): `Promise`\<`number`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [src/find-port.ts:3](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/find-port.ts:3](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/find-port.ts#L3)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **getMultiLevelExtname**(`filename`, `level`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/get-multi-level-extname.ts:9](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/get-multi-level-extname.ts:9](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/get-multi-level-extname.ts#L9)
|
|
12
12
|
|
|
13
13
|
Retrieves multi-level file extension
|
|
14
14
|
|
package/docs/functions/glob.md
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: glob()
|
|
8
8
|
|
|
9
|
-
> **glob**(`filepath`, `pattern`, `rootDir
|
|
9
|
+
> **glob**(`filepath`, `pattern`, `rootDir?`): `boolean` \| `undefined`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/glob.ts:29](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/glob.ts:29](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/glob.ts#L29)
|
|
12
12
|
|
|
13
13
|
Matches a file path against a list of glob patterns.
|
|
14
14
|
|
|
@@ -38,7 +38,7 @@ An array of glob patterns to match against.
|
|
|
38
38
|
|
|
39
39
|
## Returns
|
|
40
40
|
|
|
41
|
-
`
|
|
41
|
+
`boolean` \| `undefined`
|
|
42
42
|
|
|
43
43
|
Returns `true` if the `filepath` matches any of the patterns, otherwise `false`.
|
|
44
44
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **isStringIn**(`str`, `arr`): `boolean`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/is-string-in.ts:17](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/is-string-in.ts:17](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/is-string-in.ts#L17)
|
|
12
12
|
|
|
13
13
|
Checks if a given string exists within an array of strings or a single string.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **isValidFilename**(`filename`): `boolean` \| `""`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:63](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:63](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L63)
|
|
12
12
|
|
|
13
13
|
Validates if a given string is a valid filename.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **isValidFilepath**(`filepath`): `boolean`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:72](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:72](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L72)
|
|
12
12
|
|
|
13
13
|
Validates whether the given filepath is valid.
|
|
14
14
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: normalizeIncludeFiles()
|
|
8
8
|
|
|
9
|
-
> **normalizeIncludeFiles**(`files
|
|
9
|
+
> **normalizeIncludeFiles**(`files?`, `defaultFiles?`): `string`[]
|
|
10
10
|
|
|
11
|
-
Defined in: [src/include-files.ts:34](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/include-files.ts:34](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/include-files.ts#L34)
|
|
12
12
|
|
|
13
13
|
Normalizes a list of file patterns for glob matching.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **parseFrontMatter**(`value`, `delimiter`): `object`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/front-matter.ts:6](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/front-matter.ts:6](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/front-matter.ts#L6)
|
|
12
12
|
|
|
13
13
|
## Parameters
|
|
14
14
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: parseYaml()
|
|
8
8
|
|
|
9
|
-
> **parseYaml**(`content`, `options
|
|
9
|
+
> **parseYaml**(`content`, `options?`): `any`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/yaml.ts:51](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/yaml.ts:51](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/yaml.ts#L51)
|
|
12
12
|
|
|
13
13
|
Parses a YAML string into a JavaScript object with optional custom tags.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **reControlCharsRegex**(): `RegExp`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:50](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:50](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L50)
|
|
12
12
|
|
|
13
13
|
Returns a new regular expression instance for control characters in a filename with the 'g' flag.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **registerYamlTag**(`tags`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/yaml.ts:23](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/yaml.ts:23](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/yaml.ts#L23)
|
|
12
12
|
|
|
13
13
|
Registers custom YAML tags to be used in parsing and stringifying YAML content.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **removeLeadingEmptyLines**(`text`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/remove-leading-empty-lines.ts:16](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/remove-leading-empty-lines.ts:16](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/remove-leading-empty-lines.ts#L16)
|
|
12
12
|
|
|
13
13
|
Removes all leading empty lines or "#" comments line from the given string.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **sanitizeFilename**(`filename`, `options`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:97](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:97](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L97)
|
|
12
12
|
|
|
13
13
|
Sanitizes a given filename by replacing invalid characters with a specified replacement character or a default.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **sanitizeFilepath**(`filepath`, `options`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:149](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/filename.ts:149](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/filename.ts#L149)
|
|
12
12
|
|
|
13
13
|
Sanitizes each part of a file path and reassembles it, ensuring the path is valid according to provided options.
|
|
14
14
|
|
package/docs/functions/sleep.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **sleep**(`ms`): `Promise`\<`void`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [src/sleep.ts:12](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/sleep.ts:12](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/sleep.ts#L12)
|
|
12
12
|
|
|
13
13
|
Suspends execution for a specified number of milliseconds
|
|
14
14
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: stringifyYaml()
|
|
8
8
|
|
|
9
|
-
> **stringifyYaml**(`content`, `options
|
|
9
|
+
> **stringifyYaml**(`content`, `options?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/yaml.ts:85](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/yaml.ts:85](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/yaml.ts#L85)
|
|
12
12
|
|
|
13
13
|
Converts a JavaScript object into a YAML string with optional custom tags.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **toCamelCase**(`str`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/to-camel-case.ts:17](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/to-camel-case.ts:17](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/to-camel-case.ts#L17)
|
|
12
12
|
|
|
13
13
|
Converts a string to camelCase.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **toCapitalCase**(`str`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/to-capital-case.ts:17](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/to-capital-case.ts:17](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/to-capital-case.ts#L17)
|
|
12
12
|
|
|
13
13
|
Converts a string to capital case, where the first letter of each word is capitalized
|
|
14
14
|
and the rest are in lowercase. Words are separated by spaces, hyphens, or underscores.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **toPascalCase**(`str`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/to-pascal-case.ts:16](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/to-pascal-case.ts:16](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/to-pascal-case.ts#L16)
|
|
12
12
|
|
|
13
13
|
Converts a string to PascalCase.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **traverseFolder**(`directoryPath`, `fileHandler`): `Promise`\<`void`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [src/traverse-folder.ts:38](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/traverse-folder.ts:38](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/traverse-folder.ts#L38)
|
|
12
12
|
|
|
13
13
|
Traverses a folder asynchronously and applies a handler to each file or directory.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **traverseFolderSync**(`directoryPath`, `fileHandler`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/traverse-folder.ts:76](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/traverse-folder.ts:76](https://github.com/isdk/util.js/blob/1244ecc63e69dca791e24e154694c362d05c92c5/src/traverse-folder.ts#L76)
|
|
12
12
|
|
|
13
13
|
Traverses a folder synchronously and applies a handler to each file or directory.
|
|
14
14
|
|