@ls-stack/utils 3.24.1 → 3.26.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/docs/_media/modules.md +1 -0
- package/docs/arrayUtils/-internal-.md +1 -1
- package/docs/arrayUtils/README.md +12 -12
- package/docs/consoleFmt.md +2 -2
- package/docs/exhaustiveMatch/-internal-.md +1 -1
- package/docs/exhaustiveMatch/README.md +1 -1
- package/docs/filterObjectOrArrayKeys.md +82 -0
- package/docs/modules.md +1 -0
- package/docs/objUtils.md +7 -7
- package/docs/parallelAsyncCalls/-internal-.md +3 -3
- package/docs/parallelAsyncCalls/README.md +1 -1
- package/docs/retryOnError/README.md +1 -1
- package/docs/runShellCmd/README.md +9 -9
- package/docs/safeJson.md +2 -2
- package/docs/saferTyping.md +7 -7
- package/docs/stringUtils/README.md +6 -6
- package/docs/testUtils.md +40 -6
- package/docs/time.md +1 -1
- package/docs/tsResult/README.md +17 -11
- package/docs/typingFnUtils/-internal-.md +1 -1
- package/docs/typingFnUtils/README.md +8 -10
- package/lib/arrayUtils.d.cts +6 -1
- package/lib/arrayUtils.d.ts +6 -1
- package/lib/chunk-FXRZ4RQU.js +257 -0
- package/lib/{chunk-JAPKLFIK.js → chunk-QLD7KG5I.js} +34 -20
- package/lib/filterObjectOrArrayKeys.cjs +292 -0
- package/lib/filterObjectOrArrayKeys.d.cts +44 -0
- package/lib/filterObjectOrArrayKeys.d.ts +44 -0
- package/lib/filterObjectOrArrayKeys.js +7 -0
- package/lib/objUtils.d.cts +4 -1
- package/lib/objUtils.d.ts +4 -1
- package/lib/parallelAsyncCalls.cjs +4 -1
- package/lib/parallelAsyncCalls.d.cts +4 -1
- package/lib/parallelAsyncCalls.d.ts +4 -1
- package/lib/parallelAsyncCalls.js +4 -1
- package/lib/retryOnError.d.cts +2 -0
- package/lib/retryOnError.d.ts +2 -0
- package/lib/runShellCmd.d.cts +17 -0
- package/lib/runShellCmd.d.ts +17 -0
- package/lib/safeJson.d.cts +8 -2
- package/lib/safeJson.d.ts +8 -2
- package/lib/saferTyping.d.cts +3 -0
- package/lib/saferTyping.d.ts +3 -0
- package/lib/stringUtils.d.cts +1 -0
- package/lib/stringUtils.d.ts +1 -0
- package/lib/testUtils.cjs +290 -144
- package/lib/testUtils.d.cts +40 -12
- package/lib/testUtils.d.ts +40 -12
- package/lib/testUtils.js +10 -125
- package/lib/tsResult.d.cts +31 -7
- package/lib/tsResult.d.ts +31 -7
- package/lib/typingFnUtils.d.cts +20 -6
- package/lib/typingFnUtils.d.ts +20 -6
- package/lib/yamlStringify.cjs +34 -20
- package/lib/yamlStringify.js +1 -1
- package/package.json +5 -1
package/docs/_media/modules.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- [deepEqual](deepEqual.md)
|
|
22
22
|
- [enhancedMap](enhancedMap.md)
|
|
23
23
|
- [exhaustiveMatch](exhaustiveMatch/README.md)
|
|
24
|
+
- [filterObjectOrArrayKeys](filterObjectOrArrayKeys.md)
|
|
24
25
|
- [getAutoIncrementId](getAutoIncrementId.md)
|
|
25
26
|
- [getCompositeKey](getCompositeKey.md)
|
|
26
27
|
- [getValueStableKey](getValueStableKey.md)
|
|
@@ -14,4 +14,4 @@
|
|
|
14
14
|
type SortOrder = "desc" | "asc";
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
17
|
+
Defined in: [packages/utils/src/arrayUtils.ts:44](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L44)
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
type FilterAndMapReturn<T> = false | T;
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
21
|
+
Defined in: [packages/utils/src/arrayUtils.ts:42](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L42)
|
|
22
22
|
|
|
23
23
|
#### Type Parameters
|
|
24
24
|
|
|
@@ -34,7 +34,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:40](https://github.com/lucasols/ut
|
|
|
34
34
|
function arrayWithPrev<T>(array): [T, null | T][];
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
37
|
+
Defined in: [packages/utils/src/arrayUtils.ts:108](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L108)
|
|
38
38
|
|
|
39
39
|
#### Type Parameters
|
|
40
40
|
|
|
@@ -60,7 +60,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:103](https://github.com/lucasols/u
|
|
|
60
60
|
function arrayWithPrevAndIndex<T>(array): object[];
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
63
|
+
Defined in: [packages/utils/src/arrayUtils.ts:112](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L112)
|
|
64
64
|
|
|
65
65
|
#### Type Parameters
|
|
66
66
|
|
|
@@ -86,7 +86,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:107](https://github.com/lucasols/u
|
|
|
86
86
|
function filterAndMap<T, R>(array, mapFilter): R[];
|
|
87
87
|
```
|
|
88
88
|
|
|
89
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
89
|
+
Defined in: [packages/utils/src/arrayUtils.ts:23](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L23)
|
|
90
90
|
|
|
91
91
|
allow to filter and map with better typing ergonomics
|
|
92
92
|
|
|
@@ -143,7 +143,7 @@ function findAfterIndex<T>(
|
|
|
143
143
|
predicate): undefined | T;
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
146
|
+
Defined in: [packages/utils/src/arrayUtils.ts:135](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L135)
|
|
147
147
|
|
|
148
148
|
#### Type Parameters
|
|
149
149
|
|
|
@@ -180,7 +180,7 @@ function findBeforeIndex<T>(
|
|
|
180
180
|
predicate): undefined | T;
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
183
|
+
Defined in: [packages/utils/src/arrayUtils.ts:149](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L149)
|
|
184
184
|
|
|
185
185
|
#### Type Parameters
|
|
186
186
|
|
|
@@ -214,7 +214,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:144](https://github.com/lucasols/u
|
|
|
214
214
|
function hasDuplicates<T>(array, getKey): boolean;
|
|
215
215
|
```
|
|
216
216
|
|
|
217
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
217
|
+
Defined in: [packages/utils/src/arrayUtils.ts:173](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L173)
|
|
218
218
|
|
|
219
219
|
#### Type Parameters
|
|
220
220
|
|
|
@@ -244,7 +244,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:168](https://github.com/lucasols/u
|
|
|
244
244
|
function isInArray<T, U>(value, oneOf): value is U;
|
|
245
245
|
```
|
|
246
246
|
|
|
247
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
247
|
+
Defined in: [packages/utils/src/arrayUtils.ts:122](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L122)
|
|
248
248
|
|
|
249
249
|
#### Type Parameters
|
|
250
250
|
|
|
@@ -278,7 +278,7 @@ readonly `U`[]
|
|
|
278
278
|
function rejectArrayUndefinedValues<T>(array): T;
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
281
|
+
Defined in: [packages/utils/src/arrayUtils.ts:169](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L169)
|
|
282
282
|
|
|
283
283
|
#### Type Parameters
|
|
284
284
|
|
|
@@ -304,7 +304,7 @@ Defined in: [packages/utils/src/arrayUtils.ts:164](https://github.com/lucasols/u
|
|
|
304
304
|
function rejectDuplicates<T>(array, getKey): T[];
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
307
|
+
Defined in: [packages/utils/src/arrayUtils.ts:190](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L190)
|
|
308
308
|
|
|
309
309
|
#### Type Parameters
|
|
310
310
|
|
|
@@ -337,7 +337,7 @@ function sortBy<T>(
|
|
|
337
337
|
props): T[];
|
|
338
338
|
```
|
|
339
339
|
|
|
340
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
340
|
+
Defined in: [packages/utils/src/arrayUtils.ts:67](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L67)
|
|
341
341
|
|
|
342
342
|
Sort an array based on a value
|
|
343
343
|
|
|
@@ -396,7 +396,7 @@ function truncateArray<T>(
|
|
|
396
396
|
appendIfTruncated?): T[];
|
|
397
397
|
```
|
|
398
398
|
|
|
399
|
-
Defined in: [packages/utils/src/arrayUtils.ts:
|
|
399
|
+
Defined in: [packages/utils/src/arrayUtils.ts:210](https://github.com/lucasols/utils/blob/main/packages/utils/src/arrayUtils.ts#L210)
|
|
400
400
|
|
|
401
401
|
#### Type Parameters
|
|
402
402
|
|
package/docs/consoleFmt.md
CHANGED
|
@@ -28,7 +28,7 @@ bgColor: (color, text) => string;
|
|
|
28
28
|
|
|
29
29
|
###### color
|
|
30
30
|
|
|
31
|
-
`"
|
|
31
|
+
`"red"` | `"green"` | `"yellow"` | `"blue"` | `"magenta"` | `"cyan"` | `"white"` | `"black"` | `"gray"` | `"brightRed"` | `"brightGreen"` | `"brightYellow"` | `"brightBlue"` | `"brightMagenta"` | `"brightCyan"` | `"brightWhite"`
|
|
32
32
|
|
|
33
33
|
###### text
|
|
34
34
|
|
|
@@ -64,7 +64,7 @@ color: (color, text) => string = consoleColors;
|
|
|
64
64
|
|
|
65
65
|
###### color
|
|
66
66
|
|
|
67
|
-
`"
|
|
67
|
+
`"red"` | `"green"` | `"yellow"` | `"blue"` | `"magenta"` | `"cyan"` | `"white"` | `"black"` | `"gray"` | `"brightRed"` | `"brightGreen"` | `"brightYellow"` | `"brightBlue"` | `"brightMagenta"` | `"brightCyan"` | `"brightWhite"`
|
|
68
68
|
|
|
69
69
|
###### text
|
|
70
70
|
|
|
@@ -30,7 +30,7 @@ Defined in: [packages/utils/src/exhaustiveMatch.ts:2](https://github.com/lucasol
|
|
|
30
30
|
type Pattern<R> = { [P in K]: ((props: Extract<T, Record<D, P>>) => R) | "_never" };
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
Defined in: [packages/utils/src/exhaustiveMatch.ts:
|
|
33
|
+
Defined in: [packages/utils/src/exhaustiveMatch.ts:56](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L56)
|
|
34
34
|
|
|
35
35
|
#### Type Parameters
|
|
36
36
|
|
|
@@ -93,7 +93,7 @@ match with early evaluation of the values
|
|
|
93
93
|
function exhaustiveMatchObjUnion<T, D, K>(obj, key): object;
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
Defined in: [packages/utils/src/exhaustiveMatch.ts:
|
|
96
|
+
Defined in: [packages/utils/src/exhaustiveMatch.ts:51](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L51)
|
|
97
97
|
|
|
98
98
|
#### Type Parameters
|
|
99
99
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[**@ls-stack/utils**](README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@ls-stack/utils](modules.md) / filterObjectOrArrayKeys
|
|
6
|
+
|
|
7
|
+
# filterObjectOrArrayKeys
|
|
8
|
+
|
|
9
|
+
## Functions
|
|
10
|
+
|
|
11
|
+
### filterObjectOrArrayKeys()
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
function filterObjectOrArrayKeys(objOrArray, options): Record<string, any> | Record<string, any>[];
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Defined in: [packages/utils/src/filterObjectOrArrayKeys.ts:40](https://github.com/lucasols/utils/blob/main/packages/utils/src/filterObjectOrArrayKeys.ts#L40)
|
|
18
|
+
|
|
19
|
+
Filters the keys of an object based on the provided patterns.
|
|
20
|
+
|
|
21
|
+
Filtering patterns in `rejectKeys` and `filterKeys`:
|
|
22
|
+
- `'prop'` - Only root-level properties named 'prop'
|
|
23
|
+
- `'**prop'` - Any property named exactly 'prop' at any level (root or nested)
|
|
24
|
+
- `'*.prop'` - Any nested property named 'prop' at second level (excludes root-level matches)
|
|
25
|
+
- `'test.*.prop'` - Any property named 'prop' at second level of 'test'
|
|
26
|
+
- `'test.*.test.**prop'` - Any property named 'prop' inside of 'test.*.test'
|
|
27
|
+
- `'prop.nested'` - Exact nested property paths like `obj.prop.nested`
|
|
28
|
+
- `'prop.**nested'` - All nested properties inside root `prop` with name `nested`
|
|
29
|
+
- `'prop[0]'` - The first item of the `prop` array
|
|
30
|
+
- `'prop[*]'` - All items of the `prop` array
|
|
31
|
+
- `'prop[0].nested'` - `nested` prop of the first item of the `prop` array
|
|
32
|
+
- `'prop[*].nested'` - `nested` prop of all items of the `prop` array
|
|
33
|
+
- `'prop[*]**nested'` - all `nested` props of all items of the `prop` array
|
|
34
|
+
- `'prop[0-2]'` - The first three items of the `prop` array
|
|
35
|
+
- `'prop[4-*]'` - All items of the `prop` array from the fourth index to the end
|
|
36
|
+
- `'prop[0-2].nested.**prop'` - Combining multiple nested patterns is supported
|
|
37
|
+
- Root array:
|
|
38
|
+
- `'[0]'` - The first item of the root array
|
|
39
|
+
- `'[*]'` - All items of the array
|
|
40
|
+
- `'[0].nested'` - `nested` prop of the first item of the array
|
|
41
|
+
- `'[*].nested'` - `nested` prop of all items of the array
|
|
42
|
+
- `'[*]**nested'` - all `nested` props of all items of the array
|
|
43
|
+
- `'[0-2]'` - The first three items of the array
|
|
44
|
+
- `'[4-*]'` - All items of the array from the fourth index to the end
|
|
45
|
+
- Selecting multiple properties:
|
|
46
|
+
- `'prop.test.(prop1|prop2|prop3)'` - The `prop1`, `prop2`, and `prop3` properties of `prop.test` object
|
|
47
|
+
|
|
48
|
+
#### Parameters
|
|
49
|
+
|
|
50
|
+
##### objOrArray
|
|
51
|
+
|
|
52
|
+
The object or array to filter.
|
|
53
|
+
|
|
54
|
+
`Record`\<`string`, `any`\> | `Record`\<`string`, `any`\>[]
|
|
55
|
+
|
|
56
|
+
##### options
|
|
57
|
+
|
|
58
|
+
The options for the filter.
|
|
59
|
+
|
|
60
|
+
###### filterKeys?
|
|
61
|
+
|
|
62
|
+
`string` \| `string`[]
|
|
63
|
+
|
|
64
|
+
The keys to filter.
|
|
65
|
+
|
|
66
|
+
###### rejectEmptyObjectsInArray?
|
|
67
|
+
|
|
68
|
+
`boolean` = `true`
|
|
69
|
+
|
|
70
|
+
Whether to reject empty objects in arrays (default: true).
|
|
71
|
+
|
|
72
|
+
###### rejectKeys?
|
|
73
|
+
|
|
74
|
+
`string` \| `string`[]
|
|
75
|
+
|
|
76
|
+
The keys to reject.
|
|
77
|
+
|
|
78
|
+
#### Returns
|
|
79
|
+
|
|
80
|
+
`Record`\<`string`, `any`\> \| `Record`\<`string`, `any`\>[]
|
|
81
|
+
|
|
82
|
+
The filtered object or array.
|
package/docs/modules.md
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
- [deepEqual](deepEqual.md)
|
|
22
22
|
- [enhancedMap](enhancedMap.md)
|
|
23
23
|
- [exhaustiveMatch](exhaustiveMatch/README.md)
|
|
24
|
+
- [filterObjectOrArrayKeys](filterObjectOrArrayKeys.md)
|
|
24
25
|
- [getAutoIncrementId](getAutoIncrementId.md)
|
|
25
26
|
- [getCompositeKey](getCompositeKey.md)
|
|
26
27
|
- [getValueStableKey](getValueStableKey.md)
|
package/docs/objUtils.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
function looseGetObjectProperty<T>(obj, key): undefined | T[keyof T];
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
17
|
+
Defined in: [packages/utils/src/objUtils.ts:53](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L53)
|
|
18
18
|
|
|
19
19
|
#### Type Parameters
|
|
20
20
|
|
|
@@ -44,7 +44,7 @@ Defined in: [packages/utils/src/objUtils.ts:50](https://github.com/lucasols/util
|
|
|
44
44
|
function mapArrayToObject<T, K, O>(array, mapper): Record<K, O>;
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
47
|
+
Defined in: [packages/utils/src/objUtils.ts:21](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L21)
|
|
48
48
|
|
|
49
49
|
#### Type Parameters
|
|
50
50
|
|
|
@@ -82,7 +82,7 @@ Defined in: [packages/utils/src/objUtils.ts:18](https://github.com/lucasols/util
|
|
|
82
82
|
function mapObjectToObject<I, K, O>(obj, mapper): Record<K, O>;
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
85
|
+
Defined in: [packages/utils/src/objUtils.ts:28](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L28)
|
|
86
86
|
|
|
87
87
|
#### Type Parameters
|
|
88
88
|
|
|
@@ -120,7 +120,7 @@ Defined in: [packages/utils/src/objUtils.ts:25](https://github.com/lucasols/util
|
|
|
120
120
|
function objectTypedEntries<T>(obj): [Extract<keyof T, string>, T[keyof T]][];
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
123
|
+
Defined in: [packages/utils/src/objUtils.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L5)
|
|
124
124
|
|
|
125
125
|
#### Type Parameters
|
|
126
126
|
|
|
@@ -150,7 +150,7 @@ use typedObjectEntries from @ls-stack/utils/typingFnUtils instead
|
|
|
150
150
|
function omit<T, K>(obj, keys): Omit<T, K>;
|
|
151
151
|
```
|
|
152
152
|
|
|
153
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
153
|
+
Defined in: [packages/utils/src/objUtils.ts:38](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L38)
|
|
154
154
|
|
|
155
155
|
#### Type Parameters
|
|
156
156
|
|
|
@@ -184,7 +184,7 @@ Defined in: [packages/utils/src/objUtils.ts:35](https://github.com/lucasols/util
|
|
|
184
184
|
function pick<T, K>(obj, keys): Pick<T, K>;
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
187
|
+
Defined in: [packages/utils/src/objUtils.ts:9](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L9)
|
|
188
188
|
|
|
189
189
|
#### Type Parameters
|
|
190
190
|
|
|
@@ -218,7 +218,7 @@ Defined in: [packages/utils/src/objUtils.ts:6](https://github.com/lucasols/utils
|
|
|
218
218
|
function rejectObjUndefinedValues<T>(obj): T;
|
|
219
219
|
```
|
|
220
220
|
|
|
221
|
-
Defined in: [packages/utils/src/objUtils.ts:
|
|
221
|
+
Defined in: [packages/utils/src/objUtils.ts:60](https://github.com/lucasols/utils/blob/main/packages/utils/src/objUtils.ts#L60)
|
|
222
222
|
|
|
223
223
|
#### Type Parameters
|
|
224
224
|
|
|
@@ -72,7 +72,7 @@ Defined in: [packages/utils/src/parallelAsyncCalls.ts:51](https://github.com/luc
|
|
|
72
72
|
addTuple<T>(...calls): object;
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
Defined in: [packages/utils/src/parallelAsyncCalls.ts:
|
|
75
|
+
Defined in: [packages/utils/src/parallelAsyncCalls.ts:66](https://github.com/lucasols/utils/blob/main/packages/utils/src/parallelAsyncCalls.ts#L66)
|
|
76
76
|
|
|
77
77
|
adds calls return tuples with inferred results
|
|
78
78
|
|
|
@@ -139,7 +139,7 @@ runAll(__namedParameters): Promise<Result<Succeeded<R, M>[], {
|
|
|
139
139
|
}>>;
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
Defined in: [packages/utils/src/parallelAsyncCalls.ts:
|
|
142
|
+
Defined in: [packages/utils/src/parallelAsyncCalls.ts:154](https://github.com/lucasols/utils/blob/main/packages/utils/src/parallelAsyncCalls.ts#L154)
|
|
143
143
|
|
|
144
144
|
###### Parameters
|
|
145
145
|
|
|
@@ -167,7 +167,7 @@ runAllSettled(__namedParameters): Promise<{
|
|
|
167
167
|
}>;
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
Defined in: [packages/utils/src/parallelAsyncCalls.ts:
|
|
170
|
+
Defined in: [packages/utils/src/parallelAsyncCalls.ts:99](https://github.com/lucasols/utils/blob/main/packages/utils/src/parallelAsyncCalls.ts#L99)
|
|
171
171
|
|
|
172
172
|
###### Parameters
|
|
173
173
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
function parallelAsyncCalls<M, R>(): ParallelAsyncResultCalls<M, R>;
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Defined in: [packages/utils/src/parallelAsyncCalls.ts:
|
|
21
|
+
Defined in: [packages/utils/src/parallelAsyncCalls.ts:217](https://github.com/lucasols/utils/blob/main/packages/utils/src/parallelAsyncCalls.ts#L217)
|
|
22
22
|
|
|
23
23
|
Executes multiple asynchronous calls in parallel and collects the results in a easier to use format.
|
|
24
24
|
|
|
@@ -23,7 +23,7 @@ function retryOnError<T>(
|
|
|
23
23
|
originalMaxRetries): Promise<T>;
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
Defined in: [packages/utils/src/retryOnError.ts:
|
|
26
|
+
Defined in: [packages/utils/src/retryOnError.ts:38](https://github.com/lucasols/utils/blob/main/packages/utils/src/retryOnError.ts#L38)
|
|
27
27
|
|
|
28
28
|
Retries a function on error with configurable retry logic.
|
|
29
29
|
|
|
@@ -21,7 +21,7 @@ function concurrentCmd(
|
|
|
21
21
|
onResult): Promise<() => void>;
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
Defined in: [packages/utils/src/runShellCmd.ts:
|
|
24
|
+
Defined in: [packages/utils/src/runShellCmd.ts:133](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L133)
|
|
25
25
|
|
|
26
26
|
#### Parameters
|
|
27
27
|
|
|
@@ -60,10 +60,10 @@ import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
|
|
|
60
60
|
function runCmd(
|
|
61
61
|
label,
|
|
62
62
|
command,
|
|
63
|
-
|
|
63
|
+
root0): Promise<CmdResult>;
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
Defined in: [packages/utils/src/runShellCmd.ts:
|
|
66
|
+
Defined in: [packages/utils/src/runShellCmd.ts:39](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L39)
|
|
67
67
|
|
|
68
68
|
#### Parameters
|
|
69
69
|
|
|
@@ -75,7 +75,7 @@ Defined in: [packages/utils/src/runShellCmd.ts:31](https://github.com/lucasols/u
|
|
|
75
75
|
|
|
76
76
|
`string` | `string`[]
|
|
77
77
|
|
|
78
|
-
#####
|
|
78
|
+
##### root0
|
|
79
79
|
|
|
80
80
|
[`RunCmdOptions`](-internal-.md#runcmdoptions) = `{}`
|
|
81
81
|
|
|
@@ -102,7 +102,7 @@ import { runCmd } from '@ls-stack/node-utils/runShellCmd';
|
|
|
102
102
|
function runCmdSilent(command): Promise<CmdResult>;
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
Defined in: [packages/utils/src/runShellCmd.ts:
|
|
105
|
+
Defined in: [packages/utils/src/runShellCmd.ts:198](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L198)
|
|
106
106
|
|
|
107
107
|
#### Parameters
|
|
108
108
|
|
|
@@ -133,7 +133,7 @@ import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
|
|
|
133
133
|
function runCmdSilentUnwrap(command): Promise<string>;
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
Defined in: [packages/utils/src/runShellCmd.ts:
|
|
136
|
+
Defined in: [packages/utils/src/runShellCmd.ts:213](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L213)
|
|
137
137
|
|
|
138
138
|
#### Parameters
|
|
139
139
|
|
|
@@ -164,10 +164,10 @@ import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
|
|
|
164
164
|
function runCmdUnwrap(
|
|
165
165
|
label,
|
|
166
166
|
command,
|
|
167
|
-
|
|
167
|
+
root0): Promise<string>;
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
-
Defined in: [packages/utils/src/runShellCmd.ts:
|
|
170
|
+
Defined in: [packages/utils/src/runShellCmd.ts:175](https://github.com/lucasols/utils/blob/main/packages/utils/src/runShellCmd.ts#L175)
|
|
171
171
|
|
|
172
172
|
#### Parameters
|
|
173
173
|
|
|
@@ -179,7 +179,7 @@ Defined in: [packages/utils/src/runShellCmd.ts:160](https://github.com/lucasols/
|
|
|
179
179
|
|
|
180
180
|
`string` | `string`[]
|
|
181
181
|
|
|
182
|
-
#####
|
|
182
|
+
##### root0
|
|
183
183
|
|
|
184
184
|
###### silent?
|
|
185
185
|
|
package/docs/safeJson.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
function safeJsonParse(value): unknown;
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Defined in: [packages/utils/src/safeJson.ts:
|
|
17
|
+
Defined in: [packages/utils/src/safeJson.ts:17](https://github.com/lucasols/utils/blob/main/packages/utils/src/safeJson.ts#L17)
|
|
18
18
|
|
|
19
19
|
JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
|
|
20
20
|
|
|
@@ -36,7 +36,7 @@ JSON.parse can throw if the value is not valid JSON, this function catches those
|
|
|
36
36
|
function safeJsonStringify(value): undefined | string;
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
-
Defined in: [packages/utils/src/safeJson.ts:
|
|
39
|
+
Defined in: [packages/utils/src/safeJson.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/safeJson.ts#L5)
|
|
40
40
|
|
|
41
41
|
JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
|
|
42
42
|
|
package/docs/saferTyping.md
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
type __FIX_THIS_TYPING__ = any;
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
17
|
+
Defined in: [packages/utils/src/saferTyping.ts:51](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L51)
|
|
18
18
|
|
|
19
19
|
***
|
|
20
20
|
|
|
@@ -56,7 +56,7 @@ Defined in: [packages/utils/src/saferTyping.ts:8](https://github.com/lucasols/ut
|
|
|
56
56
|
type AnyNonPrimitiveValue = object;
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
59
|
+
Defined in: [packages/utils/src/saferTyping.ts:59](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L59)
|
|
60
60
|
|
|
61
61
|
Any type that is not a primitive (number, string, boolean, null, undefined, symbol, bigint, ...)
|
|
62
62
|
Equivalent to `object` type
|
|
@@ -81,7 +81,7 @@ An empty object type, equivalent to `{}` but with safer typing
|
|
|
81
81
|
function __FIX_THIS_CASTING__<T>(value): T;
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
84
|
+
Defined in: [packages/utils/src/saferTyping.ts:47](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L47)
|
|
85
85
|
|
|
86
86
|
#### Type Parameters
|
|
87
87
|
|
|
@@ -107,7 +107,7 @@ Defined in: [packages/utils/src/saferTyping.ts:44](https://github.com/lucasols/u
|
|
|
107
107
|
function __FIX_THIS_TYPING__(value): any;
|
|
108
108
|
```
|
|
109
109
|
|
|
110
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
110
|
+
Defined in: [packages/utils/src/saferTyping.ts:51](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L51)
|
|
111
111
|
|
|
112
112
|
#### Parameters
|
|
113
113
|
|
|
@@ -127,7 +127,7 @@ Defined in: [packages/utils/src/saferTyping.ts:48](https://github.com/lucasols/u
|
|
|
127
127
|
function __LEGIT_ANY_CAST__<V>(value): any;
|
|
128
128
|
```
|
|
129
129
|
|
|
130
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
130
|
+
Defined in: [packages/utils/src/saferTyping.ts:21](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L21)
|
|
131
131
|
|
|
132
132
|
Cast a value to `any` type. Use this when you have legit usage of `any` casting.
|
|
133
133
|
|
|
@@ -157,7 +157,7 @@ Cast a value to `any` type. Use this when you have legit usage of `any` casting.
|
|
|
157
157
|
function __LEGIT_CAST__<T, V>(value): T;
|
|
158
158
|
```
|
|
159
159
|
|
|
160
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
160
|
+
Defined in: [packages/utils/src/saferTyping.ts:32](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L32)
|
|
161
161
|
|
|
162
162
|
Cast a value to a specific type T. Use this when you have legit usage of type assertion.
|
|
163
163
|
|
|
@@ -193,7 +193,7 @@ The type to cast to
|
|
|
193
193
|
function __REFINE_CAST__<T>(value): <R>() => R;
|
|
194
194
|
```
|
|
195
195
|
|
|
196
|
-
Defined in: [packages/utils/src/saferTyping.ts:
|
|
196
|
+
Defined in: [packages/utils/src/saferTyping.ts:43](https://github.com/lucasols/utils/blob/main/packages/utils/src/saferTyping.ts#L43)
|
|
197
197
|
|
|
198
198
|
Refine a value to a specific type T. Use this when you have legit usage of type assertion.
|
|
199
199
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
const joinStrings: (...args) => string = concatStrings;
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
Defined in: [packages/utils/src/stringUtils.ts:
|
|
21
|
+
Defined in: [packages/utils/src/stringUtils.ts:34](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L34)
|
|
22
22
|
|
|
23
23
|
A util to create more legible conditional concatenated strings
|
|
24
24
|
|
|
@@ -52,7 +52,7 @@ Use [concatStrings](#concatstrings) instead
|
|
|
52
52
|
function concatStrings(...args): string;
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
Defined in: [packages/utils/src/stringUtils.ts:
|
|
55
|
+
Defined in: [packages/utils/src/stringUtils.ts:12](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L12)
|
|
56
56
|
|
|
57
57
|
A util to create more legible conditional concatenated strings
|
|
58
58
|
|
|
@@ -82,7 +82,7 @@ joinStrings('a', addBString ? 'b' : null, 'c') // 'ac' if addBString is false, '
|
|
|
82
82
|
function convertToSnakeCase(str): string;
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
Defined in: [packages/utils/src/stringUtils.ts:
|
|
85
|
+
Defined in: [packages/utils/src/stringUtils.ts:47](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L47)
|
|
86
86
|
|
|
87
87
|
#### Parameters
|
|
88
88
|
|
|
@@ -102,7 +102,7 @@ Defined in: [packages/utils/src/stringUtils.ts:46](https://github.com/lucasols/u
|
|
|
102
102
|
function formatNum(num): string;
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
Defined in: [packages/utils/src/stringUtils.ts:
|
|
105
|
+
Defined in: [packages/utils/src/stringUtils.ts:36](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L36)
|
|
106
106
|
|
|
107
107
|
#### Parameters
|
|
108
108
|
|
|
@@ -122,7 +122,7 @@ Defined in: [packages/utils/src/stringUtils.ts:35](https://github.com/lucasols/u
|
|
|
122
122
|
function isSnakeCase(str): boolean;
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
Defined in: [packages/utils/src/stringUtils.ts:
|
|
125
|
+
Defined in: [packages/utils/src/stringUtils.ts:43](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L43)
|
|
126
126
|
|
|
127
127
|
#### Parameters
|
|
128
128
|
|
|
@@ -145,7 +145,7 @@ function truncateString(
|
|
|
145
145
|
ellipsis): string;
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
Defined in: [packages/utils/src/stringUtils.ts:
|
|
148
|
+
Defined in: [packages/utils/src/stringUtils.ts:54](https://github.com/lucasols/utils/blob/main/packages/utils/src/stringUtils.ts#L54)
|
|
149
149
|
|
|
150
150
|
#### Parameters
|
|
151
151
|
|