@isdk/util 0.3.5 → 0.3.7
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.mts +105 -24
- package/dist/index.d.ts +105 -24
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/docs/classes/BinarySemaphore.md +27 -27
- package/docs/classes/ConfigFile.md +6 -6
- package/docs/classes/Deque.md +13 -13
- package/docs/classes/IntSet.md +14 -14
- package/docs/classes/Semaphore.md +26 -26
- package/docs/classes/SignalGate.md +9 -9
- package/docs/functions/RateLimit.md +3 -3
- package/docs/functions/arrayHasAll.md +1 -1
- package/docs/functions/extNameLevel.md +1 -1
- package/docs/functions/extractCodeBlock.md +91 -0
- package/docs/functions/filenameReservedRegex.md +1 -1
- package/docs/functions/findPort.md +3 -3
- package/docs/functions/getMultiLevelExtname.md +3 -3
- package/docs/functions/glob.md +1 -1
- 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 +1 -1
- package/docs/functions/omitDeepBy.md +3 -3
- package/docs/functions/omitEmptyDeep.md +6 -2
- package/docs/functions/parseFrontMatter.md +3 -3
- package/docs/functions/parseYaml.md +1 -1
- 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 +3 -3
- package/docs/functions/sanitizeFilepath.md +3 -3
- package/docs/functions/sleep.md +1 -1
- package/docs/functions/stringifyYaml.md +1 -1
- 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/globals.md +3 -0
- 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/CodeString.md +1712 -0
- package/docs/interfaces/ExtractCodeBlockOptions.md +43 -0
- 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 +5 -5
- 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 +2 -1
|
@@ -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/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/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
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: sanitizeFilename()
|
|
8
8
|
|
|
9
|
-
> **sanitizeFilename**(`filename`, `options
|
|
9
|
+
> **sanitizeFilename**(`filename`, `options?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:
|
|
11
|
+
Defined in: [src/filename.ts:110](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/filename.ts#L110)
|
|
12
12
|
|
|
13
13
|
Sanitizes a given filename by replacing invalid characters with a specified replacement character or a default.
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ Sanitizes a given filename by replacing invalid characters with a specified repl
|
|
|
20
20
|
|
|
21
21
|
The filename to sanitize, represented as a string.
|
|
22
22
|
|
|
23
|
-
### options
|
|
23
|
+
### options?
|
|
24
24
|
|
|
25
25
|
[`SanitizeFilenameOptions`](../interfaces/SanitizeFilenameOptions.md) = `{}`
|
|
26
26
|
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
# Function: sanitizeFilepath()
|
|
8
8
|
|
|
9
|
-
> **sanitizeFilepath**(`filepath`, `options
|
|
9
|
+
> **sanitizeFilepath**(`filepath`, `options?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/filename.ts:
|
|
11
|
+
Defined in: [src/filename.ts:178](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/filename.ts#L178)
|
|
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
|
|
|
@@ -20,7 +20,7 @@ Sanitizes each part of a file path and reassembles it, ensuring the path is vali
|
|
|
20
20
|
|
|
21
21
|
The file path to sanitize, represented as a string.
|
|
22
22
|
|
|
23
|
-
### options
|
|
23
|
+
### options?
|
|
24
24
|
|
|
25
25
|
[`SanitizeFilenameOptions`](../interfaces/SanitizeFilenameOptions.md) = `{}`
|
|
26
26
|
|
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/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/sleep.ts#L12)
|
|
12
12
|
|
|
13
13
|
Suspends execution for a specified number of milliseconds
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **stringifyYaml**(`content`, `options?`): `string`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/yaml.ts:
|
|
11
|
+
Defined in: [src/yaml.ts:103](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/yaml.ts#L103)
|
|
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/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/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/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/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/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/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:
|
|
11
|
+
Defined in: [src/traverse-folder.ts:44](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/traverse-folder.ts#L44)
|
|
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:
|
|
11
|
+
Defined in: [src/traverse-folder.ts:89](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/traverse-folder.ts#L89)
|
|
12
12
|
|
|
13
13
|
Traverses a folder synchronously and applies a handler to each file or directory.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **yieldExec**(): `Promise`\<`void`\>
|
|
10
10
|
|
|
11
|
-
Defined in: [src/sleep.ts:28](https://github.com/isdk/util.js/blob/
|
|
11
|
+
Defined in: [src/sleep.ts:28](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/sleep.ts#L28)
|
|
12
12
|
|
|
13
13
|
Yields execution control to the event loop, allowing pending I/O operations
|
|
14
14
|
and scheduled tasks to run before continuing.
|
package/docs/globals.md
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
- [BinarySemaphoreOptions](interfaces/BinarySemaphoreOptions.md)
|
|
20
20
|
- [BinarySemaphoreReleaseOptions](interfaces/BinarySemaphoreReleaseOptions.md)
|
|
21
21
|
- [BinarySemaphoreReleaserFunc](interfaces/BinarySemaphoreReleaserFunc.md)
|
|
22
|
+
- [CodeString](interfaces/CodeString.md)
|
|
23
|
+
- [ExtractCodeBlockOptions](interfaces/ExtractCodeBlockOptions.md)
|
|
22
24
|
- [IncludeFiles](interfaces/IncludeFiles.md)
|
|
23
25
|
- [LoadConfigFileOptions](interfaces/LoadConfigFileOptions.md)
|
|
24
26
|
- [SanitizeFilenameOptions](interfaces/SanitizeFilenameOptions.md)
|
|
@@ -43,6 +45,7 @@
|
|
|
43
45
|
|
|
44
46
|
- [arrayHasAll](functions/arrayHasAll.md)
|
|
45
47
|
- [extNameLevel](functions/extNameLevel.md)
|
|
48
|
+
- [extractCodeBlock](functions/extractCodeBlock.md)
|
|
46
49
|
- [filenameReservedRegex](functions/filenameReservedRegex.md)
|
|
47
50
|
- [findPort](functions/findPort.md)
|
|
48
51
|
- [getMultiLevelExtname](functions/getMultiLevelExtname.md)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: BinarySemaphoreAcquireOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [src/async-semaphore.ts:28](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [src/async-semaphore.ts:28](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L28)
|
|
10
10
|
|
|
11
11
|
## Extended by
|
|
12
12
|
|
|
@@ -22,4 +22,4 @@ Defined in: [src/async-semaphore.ts:28](https://github.com/isdk/util.js/blob/40c
|
|
|
22
22
|
|
|
23
23
|
> `optional` **signal**: `AbortSignal`
|
|
24
24
|
|
|
25
|
-
Defined in: [src/async-semaphore.ts:29](https://github.com/isdk/util.js/blob/
|
|
25
|
+
Defined in: [src/async-semaphore.ts:29](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L29)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: BinarySemaphoreOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [src/async-semaphore.ts:21](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [src/async-semaphore.ts:21](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L21)
|
|
10
10
|
|
|
11
11
|
## Extended by
|
|
12
12
|
|
|
@@ -18,7 +18,7 @@ Defined in: [src/async-semaphore.ts:21](https://github.com/isdk/util.js/blob/40c
|
|
|
18
18
|
|
|
19
19
|
> `optional` **capacity**: `number`
|
|
20
20
|
|
|
21
|
-
Defined in: [src/async-semaphore.ts:25](https://github.com/isdk/util.js/blob/
|
|
21
|
+
Defined in: [src/async-semaphore.ts:25](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L25)
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ Defined in: [src/async-semaphore.ts:25](https://github.com/isdk/util.js/blob/40c
|
|
|
26
26
|
|
|
27
27
|
> `optional` **initFn**: () => `any`
|
|
28
28
|
|
|
29
|
-
Defined in: [src/async-semaphore.ts:22](https://github.com/isdk/util.js/blob/
|
|
29
|
+
Defined in: [src/async-semaphore.ts:22](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L22)
|
|
30
30
|
|
|
31
31
|
#### Returns
|
|
32
32
|
|
|
@@ -38,7 +38,7 @@ Defined in: [src/async-semaphore.ts:22](https://github.com/isdk/util.js/blob/40c
|
|
|
38
38
|
|
|
39
39
|
> `optional` **pauseFn**: () => `void`
|
|
40
40
|
|
|
41
|
-
Defined in: [src/async-semaphore.ts:23](https://github.com/isdk/util.js/blob/
|
|
41
|
+
Defined in: [src/async-semaphore.ts:23](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L23)
|
|
42
42
|
|
|
43
43
|
#### Returns
|
|
44
44
|
|
|
@@ -50,7 +50,7 @@ Defined in: [src/async-semaphore.ts:23](https://github.com/isdk/util.js/blob/40c
|
|
|
50
50
|
|
|
51
51
|
> `optional` **resumeFn**: () => `void`
|
|
52
52
|
|
|
53
|
-
Defined in: [src/async-semaphore.ts:24](https://github.com/isdk/util.js/blob/
|
|
53
|
+
Defined in: [src/async-semaphore.ts:24](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L24)
|
|
54
54
|
|
|
55
55
|
#### Returns
|
|
56
56
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: BinarySemaphoreReleaseOptions
|
|
8
8
|
|
|
9
|
-
Defined in: [src/async-semaphore.ts:33](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [src/async-semaphore.ts:33](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L33)
|
|
10
10
|
|
|
11
11
|
## Extended by
|
|
12
12
|
|
|
@@ -22,4 +22,4 @@ Defined in: [src/async-semaphore.ts:33](https://github.com/isdk/util.js/blob/40c
|
|
|
22
22
|
|
|
23
23
|
> `optional` **token**: `any`
|
|
24
24
|
|
|
25
|
-
Defined in: [src/async-semaphore.ts:34](https://github.com/isdk/util.js/blob/
|
|
25
|
+
Defined in: [src/async-semaphore.ts:34](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L34)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Interface: BinarySemaphoreReleaserFunc()
|
|
8
8
|
|
|
9
|
-
Defined in: [src/async-semaphore.ts:38](https://github.com/isdk/util.js/blob/
|
|
9
|
+
Defined in: [src/async-semaphore.ts:38](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L38)
|
|
10
10
|
|
|
11
11
|
## Extends
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ Defined in: [src/async-semaphore.ts:38](https://github.com/isdk/util.js/blob/40c
|
|
|
14
14
|
|
|
15
15
|
> **BinarySemaphoreReleaserFunc**(): `void`
|
|
16
16
|
|
|
17
|
-
Defined in: [src/async-semaphore.ts:39](https://github.com/isdk/util.js/blob/
|
|
17
|
+
Defined in: [src/async-semaphore.ts:39](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L39)
|
|
18
18
|
|
|
19
19
|
## Returns
|
|
20
20
|
|
|
@@ -30,7 +30,7 @@ Defined in: [src/async-semaphore.ts:39](https://github.com/isdk/util.js/blob/40c
|
|
|
30
30
|
|
|
31
31
|
> `optional` **token**: `any`
|
|
32
32
|
|
|
33
|
-
Defined in: [src/async-semaphore.ts:34](https://github.com/isdk/util.js/blob/
|
|
33
|
+
Defined in: [src/async-semaphore.ts:34](https://github.com/isdk/util.js/blob/20d48780d60e0a0a6f6a696a3efdfa46d4cb3b1e/src/async-semaphore.ts#L34)
|
|
34
34
|
|
|
35
35
|
#### Inherited from
|
|
36
36
|
|