@ls-stack/utils 3.18.0 → 3.20.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/README.md +1 -15
- package/docs/README.md +72 -0
- package/docs/_media/modules.md +52 -0
- package/docs/arrayUtils/-internal-.md +17 -0
- package/docs/arrayUtils/README.md +423 -0
- package/docs/assertions/-internal-.md +63 -0
- package/docs/assertions/README.md +565 -0
- package/docs/asyncQueue/-internal-.md +815 -0
- package/docs/asyncQueue/README.md +75 -0
- package/docs/awaitDebounce.md +66 -0
- package/docs/cache/-internal-.md +168 -0
- package/docs/cache/README.md +360 -0
- package/docs/castValues.md +47 -0
- package/docs/concurrentCalls/-internal-.md +416 -0
- package/docs/concurrentCalls/README.md +77 -0
- package/docs/consoleFmt.md +91 -0
- package/docs/conversions.md +27 -0
- package/docs/createThrottleController/-internal-.md +73 -0
- package/docs/createThrottleController/README.md +31 -0
- package/docs/debounce.md +188 -0
- package/docs/dedent/-internal-.md +17 -0
- package/docs/dedent/README.md +204 -0
- package/docs/deepEqual.md +94 -0
- package/docs/enhancedMap.md +358 -0
- package/docs/exhaustiveMatch/-internal-.md +39 -0
- package/docs/exhaustiveMatch/README.md +146 -0
- package/docs/getAutoIncrementId.md +93 -0
- package/docs/getCompositeKey.md +39 -0
- package/docs/getValueStableKey.md +57 -0
- package/docs/hash.md +31 -0
- package/docs/interpolate/-internal-.md +61 -0
- package/docs/interpolate/README.md +62 -0
- package/docs/levenshtein.md +93 -0
- package/docs/main.md +21 -0
- package/docs/mathUtils.md +137 -0
- package/docs/modules.md +52 -0
- package/docs/objUtils.md +237 -0
- package/docs/parallelAsyncCalls/-internal-.md +347 -0
- package/docs/parallelAsyncCalls/README.md +45 -0
- package/docs/promiseUtils/-internal-.md +69 -0
- package/docs/promiseUtils/README.md +31 -0
- package/docs/retryOnError.md +67 -0
- package/docs/runShellCmd/-internal-.md +111 -0
- package/docs/runShellCmd/README.md +201 -0
- package/docs/safeJson.md +51 -0
- package/docs/saferTyping.md +228 -0
- package/docs/serializeXML.md +100 -0
- package/docs/shallowEqual.md +33 -0
- package/docs/sleep.md +27 -0
- package/docs/stringUtils/-internal-.md +17 -0
- package/docs/stringUtils/README.md +166 -0
- package/docs/testUtils.md +315 -0
- package/docs/throttle/-internal-.md +47 -0
- package/docs/throttle/README.md +178 -0
- package/docs/time.md +274 -0
- package/docs/timers.md +256 -0
- package/docs/tsResult/-internal-.md +327 -0
- package/docs/tsResult/README.md +696 -0
- package/docs/typeGuards.md +399 -0
- package/docs/typingFnUtils/-internal-.md +27 -0
- package/docs/typingFnUtils/README.md +293 -0
- package/docs/typingTestUtils.md +172 -0
- package/docs/typingUtils.md +111 -0
- package/docs/yamlStringify.md +45 -0
- package/lib/arrayUtils.js +3 -3
- package/lib/assertions.js +2 -2
- package/lib/awaitDebounce.cjs +106 -0
- package/lib/awaitDebounce.d.cts +38 -0
- package/lib/awaitDebounce.d.ts +38 -0
- package/lib/awaitDebounce.js +28 -0
- package/lib/cache.js +2 -2
- package/lib/{chunk-NH2LCAQS.js → chunk-6FIBVC2P.js} +1 -1
- package/lib/{chunk-GKOTKAIV.js → chunk-7CQPOM5I.js} +1 -1
- package/lib/{chunk-WS4WEVHU.js → chunk-C2SVCIWE.js} +1 -1
- package/lib/{chunk-SSKW673U.js → chunk-JF2MDHOJ.js} +5 -1
- package/lib/chunk-NW5H5EW7.js +100 -0
- package/lib/{chunk-DMW5Q4T2.js → chunk-SRVMMYSW.js} +1 -1
- package/lib/concurrentCalls.js +3 -3
- package/lib/createThrottleController.js +3 -3
- package/lib/debounce.js +4 -95
- package/lib/dedent.cjs +31 -3
- package/lib/dedent.d.cts +61 -1
- package/lib/dedent.d.ts +61 -1
- package/lib/dedent.js +31 -3
- package/lib/enhancedMap.js +3 -3
- package/lib/getAutoIncrementId.cjs +44 -0
- package/lib/getAutoIncrementId.d.cts +44 -0
- package/lib/getAutoIncrementId.d.ts +44 -0
- package/lib/getAutoIncrementId.js +18 -0
- package/lib/getCompositeKey.js +3 -3
- package/lib/getValueStableKey.js +3 -3
- package/lib/interpolate.js +2 -2
- package/lib/parallelAsyncCalls.js +2 -2
- package/lib/runShellCmd.d.cts +50 -0
- package/lib/runShellCmd.d.ts +50 -0
- package/lib/serializeXML.cjs +7 -2
- package/lib/serializeXML.d.cts +1 -1
- package/lib/serializeXML.d.ts +1 -1
- package/lib/serializeXML.js +7 -5
- package/lib/testUtils.js +3 -3
- package/lib/throttle.cjs +250 -0
- package/lib/throttle.d.cts +89 -0
- package/lib/throttle.d.ts +89 -0
- package/lib/throttle.js +38 -0
- package/lib/tsResult.js +2 -2
- package/lib/typeGuards.cjs +7 -2
- package/lib/typeGuards.d.cts +2 -1
- package/lib/typeGuards.d.ts +2 -1
- package/lib/typeGuards.js +5 -3
- package/lib/typingFnUtils.cjs +5 -1
- package/lib/typingFnUtils.d.cts +1 -1
- package/lib/typingFnUtils.d.ts +1 -1
- package/lib/typingFnUtils.js +5 -1
- package/lib/yamlStringify.js +5 -5
- package/package.json +22 -12
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
[**@ls-stack/utils**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@ls-stack/utils](../modules.md) / [tsResult](README.md) / \<internal\>
|
|
6
|
+
|
|
7
|
+
# \<internal\>
|
|
8
|
+
|
|
9
|
+
## Type Aliases
|
|
10
|
+
|
|
11
|
+
### AnyResultMethods
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
type AnyResultMethods = Record<ResultMethodsKeys, never>;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Defined in: [packages/utils/src/tsResult.ts:10](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L10)
|
|
18
|
+
|
|
19
|
+
***
|
|
20
|
+
|
|
21
|
+
### Err\<E\>
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
type Err<E> = object & AnyResultMethods;
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Defined in: [packages/utils/src/tsResult.ts:20](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L20)
|
|
28
|
+
|
|
29
|
+
#### Type declaration
|
|
30
|
+
|
|
31
|
+
##### error
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
error: E;
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
##### ~~errorResult()~~
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
errorResult: () => Err<E>;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
###### Returns
|
|
44
|
+
|
|
45
|
+
[`Err`](#err)\<`E`\>
|
|
46
|
+
|
|
47
|
+
###### Deprecated
|
|
48
|
+
|
|
49
|
+
Use `t-result` library instead.
|
|
50
|
+
|
|
51
|
+
##### ok
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
ok: false;
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### Type Parameters
|
|
58
|
+
|
|
59
|
+
##### E
|
|
60
|
+
|
|
61
|
+
`E` *extends* [`ResultValidErrors`](README.md#resultvaliderrors)
|
|
62
|
+
|
|
63
|
+
***
|
|
64
|
+
|
|
65
|
+
### Ok\<T\>
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
type Ok<T> = object & AnyResultMethods;
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Defined in: [packages/utils/src/tsResult.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L4)
|
|
72
|
+
|
|
73
|
+
#### Type declaration
|
|
74
|
+
|
|
75
|
+
##### error
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
error: false;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
##### ok
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
ok: true;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
##### value
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
value: T;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
#### Type Parameters
|
|
94
|
+
|
|
95
|
+
##### T
|
|
96
|
+
|
|
97
|
+
`T`
|
|
98
|
+
|
|
99
|
+
***
|
|
100
|
+
|
|
101
|
+
### ResultMethods\<T, E\>
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
type ResultMethods<T, E> = object;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Defined in: [packages/utils/src/tsResult.ts:27](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L27)
|
|
108
|
+
|
|
109
|
+
#### Type Parameters
|
|
110
|
+
|
|
111
|
+
##### T
|
|
112
|
+
|
|
113
|
+
`T`
|
|
114
|
+
|
|
115
|
+
##### E
|
|
116
|
+
|
|
117
|
+
`E` *extends* [`ResultValidErrors`](README.md#resultvaliderrors)
|
|
118
|
+
|
|
119
|
+
#### Properties
|
|
120
|
+
|
|
121
|
+
##### ~~ifErr()~~
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
ifErr: (fn) => Result<T, E>;
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Defined in: [packages/utils/src/tsResult.ts:48](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L48)
|
|
128
|
+
|
|
129
|
+
###### Parameters
|
|
130
|
+
|
|
131
|
+
###### fn
|
|
132
|
+
|
|
133
|
+
(`error`) => `void`
|
|
134
|
+
|
|
135
|
+
###### Returns
|
|
136
|
+
|
|
137
|
+
[`Result`](README.md#result)\<`T`, `E`\>
|
|
138
|
+
|
|
139
|
+
###### Deprecated
|
|
140
|
+
|
|
141
|
+
Use `t-result` library instead.
|
|
142
|
+
|
|
143
|
+
##### ~~ifOk()~~
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
ifOk: (fn) => Result<T, E>;
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Defined in: [packages/utils/src/tsResult.ts:46](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L46)
|
|
150
|
+
|
|
151
|
+
###### Parameters
|
|
152
|
+
|
|
153
|
+
###### fn
|
|
154
|
+
|
|
155
|
+
(`value`) => `void`
|
|
156
|
+
|
|
157
|
+
###### Returns
|
|
158
|
+
|
|
159
|
+
[`Result`](README.md#result)\<`T`, `E`\>
|
|
160
|
+
|
|
161
|
+
###### Deprecated
|
|
162
|
+
|
|
163
|
+
Use `t-result` library instead.
|
|
164
|
+
|
|
165
|
+
##### ~~mapErr()~~
|
|
166
|
+
|
|
167
|
+
```ts
|
|
168
|
+
mapErr: <NewError>(mapFn) => Result<T, NewError>;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Defined in: [packages/utils/src/tsResult.ts:37](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L37)
|
|
172
|
+
|
|
173
|
+
###### Type Parameters
|
|
174
|
+
|
|
175
|
+
###### NewError
|
|
176
|
+
|
|
177
|
+
`NewError` *extends* [`ResultValidErrors`](README.md#resultvaliderrors)
|
|
178
|
+
|
|
179
|
+
###### Parameters
|
|
180
|
+
|
|
181
|
+
###### mapFn
|
|
182
|
+
|
|
183
|
+
(`error`) => `NewError`
|
|
184
|
+
|
|
185
|
+
###### Returns
|
|
186
|
+
|
|
187
|
+
[`Result`](README.md#result)\<`T`, `NewError`\>
|
|
188
|
+
|
|
189
|
+
###### Deprecated
|
|
190
|
+
|
|
191
|
+
Use `t-result` library instead.
|
|
192
|
+
|
|
193
|
+
##### ~~mapOk()~~
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
mapOk: <NewValue>(mapFn) => Result<NewValue, E>;
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Defined in: [packages/utils/src/tsResult.ts:35](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L35)
|
|
200
|
+
|
|
201
|
+
###### Type Parameters
|
|
202
|
+
|
|
203
|
+
###### NewValue
|
|
204
|
+
|
|
205
|
+
`NewValue`
|
|
206
|
+
|
|
207
|
+
###### Parameters
|
|
208
|
+
|
|
209
|
+
###### mapFn
|
|
210
|
+
|
|
211
|
+
(`value`) => `NewValue`
|
|
212
|
+
|
|
213
|
+
###### Returns
|
|
214
|
+
|
|
215
|
+
[`Result`](README.md#result)\<`NewValue`, `E`\>
|
|
216
|
+
|
|
217
|
+
###### Deprecated
|
|
218
|
+
|
|
219
|
+
Use `t-result` library instead.
|
|
220
|
+
|
|
221
|
+
##### ~~mapOkAndErr()~~
|
|
222
|
+
|
|
223
|
+
```ts
|
|
224
|
+
mapOkAndErr: <NewValue, NewError>(mapFns) => Result<NewValue, NewError>;
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Defined in: [packages/utils/src/tsResult.ts:41](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L41)
|
|
228
|
+
|
|
229
|
+
###### Type Parameters
|
|
230
|
+
|
|
231
|
+
###### NewValue
|
|
232
|
+
|
|
233
|
+
`NewValue`
|
|
234
|
+
|
|
235
|
+
###### NewError
|
|
236
|
+
|
|
237
|
+
`NewError` *extends* [`ResultValidErrors`](README.md#resultvaliderrors)
|
|
238
|
+
|
|
239
|
+
###### Parameters
|
|
240
|
+
|
|
241
|
+
###### mapFns
|
|
242
|
+
|
|
243
|
+
###### err
|
|
244
|
+
|
|
245
|
+
(`error`) => `NewError`
|
|
246
|
+
|
|
247
|
+
###### ok
|
|
248
|
+
|
|
249
|
+
(`value`) => `NewValue`
|
|
250
|
+
|
|
251
|
+
###### Returns
|
|
252
|
+
|
|
253
|
+
[`Result`](README.md#result)\<`NewValue`, `NewError`\>
|
|
254
|
+
|
|
255
|
+
###### Deprecated
|
|
256
|
+
|
|
257
|
+
Use `t-result` library instead.
|
|
258
|
+
|
|
259
|
+
##### ~~unwrap()~~
|
|
260
|
+
|
|
261
|
+
```ts
|
|
262
|
+
unwrap: () => T;
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Defined in: [packages/utils/src/tsResult.ts:33](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L33)
|
|
266
|
+
|
|
267
|
+
###### Returns
|
|
268
|
+
|
|
269
|
+
`T`
|
|
270
|
+
|
|
271
|
+
###### Deprecated
|
|
272
|
+
|
|
273
|
+
Use `t-result` library instead.
|
|
274
|
+
|
|
275
|
+
##### ~~unwrapOr()~~
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
unwrapOr: <R>(defaultValue) => T | R;
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
Defined in: [packages/utils/src/tsResult.ts:31](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L31)
|
|
282
|
+
|
|
283
|
+
###### Type Parameters
|
|
284
|
+
|
|
285
|
+
###### R
|
|
286
|
+
|
|
287
|
+
`R` *extends* `T`
|
|
288
|
+
|
|
289
|
+
###### Parameters
|
|
290
|
+
|
|
291
|
+
###### defaultValue
|
|
292
|
+
|
|
293
|
+
`R`
|
|
294
|
+
|
|
295
|
+
###### Returns
|
|
296
|
+
|
|
297
|
+
`T` \| `R`
|
|
298
|
+
|
|
299
|
+
###### Deprecated
|
|
300
|
+
|
|
301
|
+
Use `t-result` library instead.
|
|
302
|
+
|
|
303
|
+
##### ~~unwrapOrNull()~~
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
unwrapOrNull: () => T | null;
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Defined in: [packages/utils/src/tsResult.ts:29](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L29)
|
|
310
|
+
|
|
311
|
+
###### Returns
|
|
312
|
+
|
|
313
|
+
`T` \| `null`
|
|
314
|
+
|
|
315
|
+
###### Deprecated
|
|
316
|
+
|
|
317
|
+
Use `t-result` library instead.
|
|
318
|
+
|
|
319
|
+
***
|
|
320
|
+
|
|
321
|
+
### ResultMethodsKeys
|
|
322
|
+
|
|
323
|
+
```ts
|
|
324
|
+
type ResultMethodsKeys = keyof ResultMethods<any, any>;
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Defined in: [packages/utils/src/tsResult.ts:58](https://github.com/lucasols/utils/blob/main/packages/utils/src/tsResult.ts#L58)
|