@ls-stack/utils 3.40.0 → 3.41.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/dist/arrayUtils.d.cts +70 -57
- package/dist/arrayUtils.d.ts +70 -57
- package/dist/assertions.d.cts +128 -117
- package/dist/assertions.d.ts +128 -117
- package/dist/asyncQueue.cjs +117 -112
- package/dist/asyncQueue.d.cts +217 -215
- package/dist/asyncQueue.d.ts +217 -215
- package/dist/asyncQueue.js +117 -112
- package/dist/awaitDebounce.d.cts +26 -23
- package/dist/awaitDebounce.d.ts +26 -23
- package/dist/cache.cjs +2 -1
- package/dist/cache.d.cts +15 -9
- package/dist/cache.d.ts +15 -9
- package/dist/cache.js +2 -1
- package/dist/{chunk-GHAQOUA6.js → chunk-23KPGKDT.js} +22 -1
- package/dist/{chunk-ADM37GSC.js → chunk-7L4KCZJJ.js} +12 -10
- package/dist/{chunk-KW55OTUG.js → chunk-B3KFV2MH.js} +2 -2
- package/dist/chunk-DTE2QMWE.js +48 -0
- package/dist/concurrentCalls.d.cts +8 -4
- package/dist/concurrentCalls.d.ts +8 -4
- package/dist/concurrentCalls.js +1 -1
- package/dist/debounce.d.cts +12 -20
- package/dist/debounce.d.ts +12 -20
- package/dist/dedent.d.cts +31 -31
- package/dist/dedent.d.ts +31 -31
- package/dist/deepEqual.d.cts +10 -9
- package/dist/deepEqual.d.ts +10 -9
- package/dist/filterObjectOrArrayKeys.d.cts +44 -19
- package/dist/filterObjectOrArrayKeys.d.ts +44 -19
- package/dist/getAutoIncrementId.d.cts +25 -23
- package/dist/getAutoIncrementId.d.ts +25 -23
- package/dist/getCompositeKey.d.cts +2 -1
- package/dist/getCompositeKey.d.ts +2 -1
- package/dist/getValueStableKey.d.cts +4 -3
- package/dist/getValueStableKey.d.ts +4 -3
- package/dist/mutationUtils.d.cts +2 -2
- package/dist/mutationUtils.d.ts +2 -2
- package/dist/objUtils.cjs +51 -2
- package/dist/objUtils.d.cts +8 -3
- package/dist/objUtils.d.ts +8 -3
- package/dist/objUtils.js +11 -3
- package/dist/parallelAsyncCalls.cjs +2 -1
- package/dist/parallelAsyncCalls.d.cts +5 -4
- package/dist/parallelAsyncCalls.d.ts +5 -4
- package/dist/parallelAsyncCalls.js +2 -1
- package/dist/retryOnError.d.cts +23 -20
- package/dist/retryOnError.d.ts +23 -20
- package/dist/runShellCmd.d.cts +40 -40
- package/dist/runShellCmd.d.ts +40 -40
- package/dist/safeJson.d.cts +6 -2
- package/dist/safeJson.d.ts +6 -2
- package/dist/saferTyping.d.cts +21 -14
- package/dist/saferTyping.d.ts +21 -14
- package/dist/shallowEqual.d.cts +1 -1
- package/dist/shallowEqual.d.ts +1 -1
- package/dist/stringUtils.cjs +2 -2
- package/dist/stringUtils.d.cts +6 -7
- package/dist/stringUtils.d.ts +6 -7
- package/dist/stringUtils.js +1 -1
- package/dist/testUtils.cjs +11 -9
- package/dist/testUtils.d.cts +32 -14
- package/dist/testUtils.d.ts +32 -14
- package/dist/testUtils.js +4 -3
- package/dist/throttle.d.cts +57 -48
- package/dist/throttle.d.ts +57 -48
- package/dist/timers.d.cts +68 -63
- package/dist/timers.d.ts +68 -63
- package/dist/tsResult.d.cts +7 -6
- package/dist/tsResult.d.ts +7 -6
- package/dist/typeGuards.d.cts +65 -64
- package/dist/typeGuards.d.ts +65 -64
- package/dist/typeUtils.d.cts +18 -4
- package/dist/typeUtils.d.ts +18 -4
- package/dist/typedStrings.d.cts +68 -57
- package/dist/typedStrings.d.ts +68 -57
- package/dist/typingFnUtils.d.cts +12 -6
- package/dist/typingFnUtils.d.ts +12 -6
- package/dist/typingFnUtils.js +12 -35
- package/dist/typingTestUtils.cjs +7 -1
- package/dist/typingTestUtils.d.cts +52 -11
- package/dist/typingTestUtils.d.ts +52 -11
- package/dist/typingTestUtils.js +7 -1
- package/dist/typingUtils.d.cts +4 -1
- package/dist/typingUtils.d.ts +4 -1
- package/dist/yamlStringify.cjs +11 -9
- package/dist/yamlStringify.js +2 -2
- package/package.json +5 -1
- package/docs/README.md +0 -72
- package/docs/_media/modules.md +0 -58
- package/docs/arrayUtils/-internal-.md +0 -179
- package/docs/arrayUtils/README.md +0 -550
- package/docs/assertions/-internal-.md +0 -63
- package/docs/assertions/README.md +0 -565
- package/docs/asyncQueue/-internal-.md +0 -297
- package/docs/asyncQueue/README.md +0 -1485
- package/docs/awaitDebounce.md +0 -66
- package/docs/cache/-internal-.md +0 -168
- package/docs/cache/README.md +0 -360
- package/docs/castValues.md +0 -47
- package/docs/concurrentCalls/-internal-.md +0 -490
- package/docs/concurrentCalls/README.md +0 -299
- package/docs/consoleFmt.md +0 -115
- package/docs/conversions.md +0 -27
- package/docs/createThrottleController/-internal-.md +0 -73
- package/docs/createThrottleController/README.md +0 -31
- package/docs/debounce.md +0 -188
- package/docs/dedent/-internal-.md +0 -17
- package/docs/dedent/README.md +0 -204
- package/docs/deepEqual.md +0 -94
- package/docs/enhancedMap.md +0 -358
- package/docs/exhaustiveMatch/-internal-.md +0 -39
- package/docs/exhaustiveMatch/README.md +0 -146
- package/docs/filterObjectOrArrayKeys.md +0 -109
- package/docs/getAutoIncrementId.md +0 -93
- package/docs/getCompositeKey.md +0 -39
- package/docs/getValueStableKey.md +0 -57
- package/docs/hash.md +0 -31
- package/docs/interpolate/-internal-.md +0 -61
- package/docs/interpolate/README.md +0 -62
- package/docs/keepPrevIfUnchanged.md +0 -43
- package/docs/levenshtein.md +0 -93
- package/docs/main.md +0 -21
- package/docs/mathUtils.md +0 -137
- package/docs/modules.md +0 -58
- package/docs/mutationUtils.md +0 -44
- package/docs/objUtils.md +0 -237
- package/docs/parallelAsyncCalls/-internal-.md +0 -347
- package/docs/parallelAsyncCalls/README.md +0 -45
- package/docs/promiseUtils/-internal-.md +0 -69
- package/docs/promiseUtils/README.md +0 -31
- package/docs/retryOnError/-internal-.md +0 -111
- package/docs/retryOnError/README.md +0 -168
- package/docs/runShellCmd/-internal-.md +0 -111
- package/docs/runShellCmd/README.md +0 -201
- package/docs/safeJson.md +0 -51
- package/docs/saferTyping.md +0 -228
- package/docs/serializeXML.md +0 -100
- package/docs/shallowEqual.md +0 -33
- package/docs/sleep.md +0 -27
- package/docs/stringUtils/-internal-.md +0 -17
- package/docs/stringUtils/README.md +0 -270
- package/docs/testUtils.md +0 -382
- package/docs/throttle/-internal-.md +0 -47
- package/docs/throttle/README.md +0 -178
- package/docs/time.md +0 -274
- package/docs/timers.md +0 -256
- package/docs/tsResult/-internal-.md +0 -327
- package/docs/tsResult/README.md +0 -702
- package/docs/typeGuards.md +0 -399
- package/docs/typeUtils/-internal-.md +0 -99
- package/docs/typeUtils/README.md +0 -195
- package/docs/typeUtils.typesTest.md +0 -7
- package/docs/typedStrings.md +0 -458
- package/docs/typingFnUtils/-internal-.md +0 -43
- package/docs/typingFnUtils/README.md +0 -317
- package/docs/typingTestUtils.md +0 -172
- package/docs/typingUtils.md +0 -135
- package/docs/yamlStringify.md +0 -83
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](../modules.md) / typingFnUtils
|
|
6
|
-
|
|
7
|
-
# typingFnUtils
|
|
8
|
-
|
|
9
|
-
## Modules
|
|
10
|
-
|
|
11
|
-
- [\<internal\>](-internal-.md)
|
|
12
|
-
|
|
13
|
-
## Variables
|
|
14
|
-
|
|
15
|
-
### ~~isSubTypeOf()~~
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
const isSubTypeOf: <BaseType, SubType>() => unknown = typeOnRightExtendsLeftType;
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:79](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L79)
|
|
22
|
-
|
|
23
|
-
Type helper to check if a type is a subtype of another type.
|
|
24
|
-
|
|
25
|
-
#### Type Parameters
|
|
26
|
-
|
|
27
|
-
##### BaseType
|
|
28
|
-
|
|
29
|
-
`BaseType`
|
|
30
|
-
|
|
31
|
-
The base type to check against
|
|
32
|
-
|
|
33
|
-
##### SubType
|
|
34
|
-
|
|
35
|
-
`SubType`
|
|
36
|
-
|
|
37
|
-
The type that should extend BaseType
|
|
38
|
-
|
|
39
|
-
#### Returns
|
|
40
|
-
|
|
41
|
-
`unknown`
|
|
42
|
-
|
|
43
|
-
Returns undefined, only used for type checking
|
|
44
|
-
|
|
45
|
-
#### Deprecated
|
|
46
|
-
|
|
47
|
-
use typeOnRightExtendsLeftType instead
|
|
48
|
-
|
|
49
|
-
## Functions
|
|
50
|
-
|
|
51
|
-
### asNonPartial()
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
function asNonPartial<T>(obj): NonPartial<T>;
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L4)
|
|
58
|
-
|
|
59
|
-
#### Type Parameters
|
|
60
|
-
|
|
61
|
-
##### T
|
|
62
|
-
|
|
63
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
64
|
-
|
|
65
|
-
#### Parameters
|
|
66
|
-
|
|
67
|
-
##### obj
|
|
68
|
-
|
|
69
|
-
`T`
|
|
70
|
-
|
|
71
|
-
#### Returns
|
|
72
|
-
|
|
73
|
-
[`NonPartial`](../typingUtils.md#nonpartial)\<`T`\>
|
|
74
|
-
|
|
75
|
-
***
|
|
76
|
-
|
|
77
|
-
### asPartialUndefinedValues()
|
|
78
|
-
|
|
79
|
-
```ts
|
|
80
|
-
function asPartialUndefinedValues<T>(value): T;
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:110](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L110)
|
|
84
|
-
|
|
85
|
-
#### Type Parameters
|
|
86
|
-
|
|
87
|
-
##### T
|
|
88
|
-
|
|
89
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
90
|
-
|
|
91
|
-
#### Parameters
|
|
92
|
-
|
|
93
|
-
##### value
|
|
94
|
-
|
|
95
|
-
\{ \[P in string \| number \| symbol\]: (Partial\<Pick\<T, KeysWithUndefinedValues\<T\>\>\> & Omit\<T, KeysWithUndefinedValues\<T\>\>)\[P\] \}
|
|
96
|
-
|
|
97
|
-
#### Returns
|
|
98
|
-
|
|
99
|
-
`T`
|
|
100
|
-
|
|
101
|
-
***
|
|
102
|
-
|
|
103
|
-
### asType()
|
|
104
|
-
|
|
105
|
-
```ts
|
|
106
|
-
function asType<T>(value): T;
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:38](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L38)
|
|
110
|
-
|
|
111
|
-
a safe way to cast types, use to substitute the `as Type`
|
|
112
|
-
|
|
113
|
-
#### Type Parameters
|
|
114
|
-
|
|
115
|
-
##### T
|
|
116
|
-
|
|
117
|
-
`T` = `unknown`
|
|
118
|
-
|
|
119
|
-
#### Parameters
|
|
120
|
-
|
|
121
|
-
##### value
|
|
122
|
-
|
|
123
|
-
`T`
|
|
124
|
-
|
|
125
|
-
#### Returns
|
|
126
|
-
|
|
127
|
-
`T`
|
|
128
|
-
|
|
129
|
-
***
|
|
130
|
-
|
|
131
|
-
### isObjKey()
|
|
132
|
-
|
|
133
|
-
```ts
|
|
134
|
-
function isObjKey<T>(key, obj): key is keyof T;
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:86](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L86)
|
|
138
|
-
|
|
139
|
-
Type helper to narrow a string to a key of an object.
|
|
140
|
-
|
|
141
|
-
#### Type Parameters
|
|
142
|
-
|
|
143
|
-
##### T
|
|
144
|
-
|
|
145
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
146
|
-
|
|
147
|
-
#### Parameters
|
|
148
|
-
|
|
149
|
-
##### key
|
|
150
|
-
|
|
151
|
-
`unknown`
|
|
152
|
-
|
|
153
|
-
##### obj
|
|
154
|
-
|
|
155
|
-
`T`
|
|
156
|
-
|
|
157
|
-
#### Returns
|
|
158
|
-
|
|
159
|
-
`key is keyof T`
|
|
160
|
-
|
|
161
|
-
***
|
|
162
|
-
|
|
163
|
-
### narrowStringToUnion()
|
|
164
|
-
|
|
165
|
-
```ts
|
|
166
|
-
function narrowStringToUnion<T>(key, union): undefined | T;
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:47](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L47)
|
|
170
|
-
|
|
171
|
-
narrow a string to a union of strings
|
|
172
|
-
|
|
173
|
-
#### Type Parameters
|
|
174
|
-
|
|
175
|
-
##### T
|
|
176
|
-
|
|
177
|
-
`T` *extends* `string`
|
|
178
|
-
|
|
179
|
-
#### Parameters
|
|
180
|
-
|
|
181
|
-
##### key
|
|
182
|
-
|
|
183
|
-
`undefined` | `null` | `string`
|
|
184
|
-
|
|
185
|
-
##### union
|
|
186
|
-
|
|
187
|
-
`Set`\<`T`\> | `T`[] | readonly `T`[]
|
|
188
|
-
|
|
189
|
-
#### Returns
|
|
190
|
-
|
|
191
|
-
`undefined` \| `T`
|
|
192
|
-
|
|
193
|
-
***
|
|
194
|
-
|
|
195
|
-
### typedObjectEntries()
|
|
196
|
-
|
|
197
|
-
```ts
|
|
198
|
-
function typedObjectEntries<T>(obj): NonNullable<{ [K in string | number | symbol]: [K, T[K]] }[keyof T]>[];
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:14](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L14)
|
|
202
|
-
|
|
203
|
-
a wrapper to Object.entries with a better typing inference
|
|
204
|
-
|
|
205
|
-
#### Type Parameters
|
|
206
|
-
|
|
207
|
-
##### T
|
|
208
|
-
|
|
209
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
210
|
-
|
|
211
|
-
#### Parameters
|
|
212
|
-
|
|
213
|
-
##### obj
|
|
214
|
-
|
|
215
|
-
`T`
|
|
216
|
-
|
|
217
|
-
#### Returns
|
|
218
|
-
|
|
219
|
-
`NonNullable`\<\{ \[K in string \| number \| symbol\]: \[K, T\[K\]\] \}\[keyof `T`\]\>[]
|
|
220
|
-
|
|
221
|
-
***
|
|
222
|
-
|
|
223
|
-
### typedObjectKeys()
|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
function typedObjectKeys<T>(obj): keyof T[];
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:28](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L28)
|
|
230
|
-
|
|
231
|
-
a wrapper to Object.keys with a better typing inference
|
|
232
|
-
|
|
233
|
-
#### Type Parameters
|
|
234
|
-
|
|
235
|
-
##### T
|
|
236
|
-
|
|
237
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
238
|
-
|
|
239
|
-
#### Parameters
|
|
240
|
-
|
|
241
|
-
##### obj
|
|
242
|
-
|
|
243
|
-
`T`
|
|
244
|
-
|
|
245
|
-
#### Returns
|
|
246
|
-
|
|
247
|
-
keyof `T`[]
|
|
248
|
-
|
|
249
|
-
***
|
|
250
|
-
|
|
251
|
-
### typeOnRightExtendsLeftType()
|
|
252
|
-
|
|
253
|
-
```ts
|
|
254
|
-
function typeOnRightExtendsLeftType<BaseType, SubType>(): unknown;
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:71](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L71)
|
|
258
|
-
|
|
259
|
-
Type helper to check if a type is a subtype of another type.
|
|
260
|
-
|
|
261
|
-
#### Type Parameters
|
|
262
|
-
|
|
263
|
-
##### BaseType
|
|
264
|
-
|
|
265
|
-
`BaseType`
|
|
266
|
-
|
|
267
|
-
The base type to check against
|
|
268
|
-
|
|
269
|
-
##### SubType
|
|
270
|
-
|
|
271
|
-
`SubType`
|
|
272
|
-
|
|
273
|
-
The type that should extend BaseType
|
|
274
|
-
|
|
275
|
-
#### Returns
|
|
276
|
-
|
|
277
|
-
`unknown`
|
|
278
|
-
|
|
279
|
-
Returns undefined, only used for type checking
|
|
280
|
-
|
|
281
|
-
***
|
|
282
|
-
|
|
283
|
-
### unionsAreTheSame()
|
|
284
|
-
|
|
285
|
-
```ts
|
|
286
|
-
function unionsAreTheSame<T, U>(_diff): void;
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Defined in: [packages/utils/src/typingFnUtils.ts:108](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingFnUtils.ts#L108)
|
|
290
|
-
|
|
291
|
-
Type helper to compare two union types and determine their relationship.
|
|
292
|
-
|
|
293
|
-
#### Type Parameters
|
|
294
|
-
|
|
295
|
-
##### T
|
|
296
|
-
|
|
297
|
-
`T`
|
|
298
|
-
|
|
299
|
-
The first union type (left side)
|
|
300
|
-
|
|
301
|
-
##### U
|
|
302
|
-
|
|
303
|
-
`U`
|
|
304
|
-
|
|
305
|
-
The second union type (right side)
|
|
306
|
-
|
|
307
|
-
#### Parameters
|
|
308
|
-
|
|
309
|
-
##### \_diff
|
|
310
|
-
|
|
311
|
-
[`UnionDiff`](-internal-.md#uniondiff)\<`T`, `U`\>
|
|
312
|
-
|
|
313
|
-
null if unions are identical, or an object describing the errors
|
|
314
|
-
|
|
315
|
-
#### Returns
|
|
316
|
-
|
|
317
|
-
`void`
|
package/docs/typingTestUtils.md
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / typingTestUtils
|
|
6
|
-
|
|
7
|
-
# typingTestUtils
|
|
8
|
-
|
|
9
|
-
## Type Aliases
|
|
10
|
-
|
|
11
|
-
### TestTypeIsEqual\<X, Y\>
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
type TestTypeIsEqual<X, Y> = <T>() => T extends X ? 1 : 2 extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/typingTestUtils.ts:1](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingTestUtils.ts#L1)
|
|
18
|
-
|
|
19
|
-
#### Type Parameters
|
|
20
|
-
|
|
21
|
-
##### X
|
|
22
|
-
|
|
23
|
-
`X`
|
|
24
|
-
|
|
25
|
-
##### Y
|
|
26
|
-
|
|
27
|
-
`Y`
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
|
-
### TestTypeNotEqual\<X, Y\>
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
type TestTypeNotEqual<X, Y> = true extends TestTypeIsEqual<X, Y> ? false : true;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Defined in: [packages/utils/src/typingTestUtils.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingTestUtils.ts#L4)
|
|
38
|
-
|
|
39
|
-
#### Type Parameters
|
|
40
|
-
|
|
41
|
-
##### X
|
|
42
|
-
|
|
43
|
-
`X`
|
|
44
|
-
|
|
45
|
-
##### Y
|
|
46
|
-
|
|
47
|
-
`Y`
|
|
48
|
-
|
|
49
|
-
## Variables
|
|
50
|
-
|
|
51
|
-
### typingTest
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
const typingTest: object;
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Defined in: [packages/utils/src/typingTestUtils.ts:48](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingTestUtils.ts#L48)
|
|
58
|
-
|
|
59
|
-
#### Type declaration
|
|
60
|
-
|
|
61
|
-
##### describe()
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
describe: (title, func) => void;
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
###### Parameters
|
|
68
|
-
|
|
69
|
-
###### title
|
|
70
|
-
|
|
71
|
-
`string`
|
|
72
|
-
|
|
73
|
-
###### func
|
|
74
|
-
|
|
75
|
-
() => `any`
|
|
76
|
-
|
|
77
|
-
###### Returns
|
|
78
|
-
|
|
79
|
-
`void`
|
|
80
|
-
|
|
81
|
-
##### expectType()
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
expectType: <T>() => T;
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Helper function for type testing that ensures a type extends `true`.
|
|
88
|
-
Used in combination with `TestTypeIsEqual` to verify type equality at compile time.
|
|
89
|
-
|
|
90
|
-
###### Type Parameters
|
|
91
|
-
|
|
92
|
-
###### T
|
|
93
|
-
|
|
94
|
-
`T` *extends* `true`
|
|
95
|
-
|
|
96
|
-
Type that must extend `true`
|
|
97
|
-
|
|
98
|
-
###### Returns
|
|
99
|
-
|
|
100
|
-
`T`
|
|
101
|
-
|
|
102
|
-
An empty object cast to type T
|
|
103
|
-
|
|
104
|
-
###### Example
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
expectType<TestTypeIsEqual<string, string>>(); // OK
|
|
108
|
-
expectType<TestTypeIsEqual<string, number>>(); // Type error
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
##### expectTypesAre()
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
expectTypesAre: <X, Y>(result) => void;
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
Helper function for type testing that compares two types and expects a specific result.
|
|
118
|
-
This function allows for more explicit type equality assertions with a descriptive result.
|
|
119
|
-
|
|
120
|
-
###### Type Parameters
|
|
121
|
-
|
|
122
|
-
###### X
|
|
123
|
-
|
|
124
|
-
`X`
|
|
125
|
-
|
|
126
|
-
First type to compare
|
|
127
|
-
|
|
128
|
-
###### Y
|
|
129
|
-
|
|
130
|
-
`Y`
|
|
131
|
-
|
|
132
|
-
Second type to compare
|
|
133
|
-
|
|
134
|
-
###### Parameters
|
|
135
|
-
|
|
136
|
-
###### result
|
|
137
|
-
|
|
138
|
-
[`TestTypeIsEqual`](#testtypeisequal)\<`X`, `Y`\> *extends* `true` ? `"equal"` : `"notEqual"`
|
|
139
|
-
|
|
140
|
-
Expected comparison result: 'equal' if types are equal, 'notEqual' if they differ
|
|
141
|
-
|
|
142
|
-
###### Returns
|
|
143
|
-
|
|
144
|
-
`void`
|
|
145
|
-
|
|
146
|
-
###### Example
|
|
147
|
-
|
|
148
|
-
```ts
|
|
149
|
-
expectTypesAre<string, string>('equal'); // OK
|
|
150
|
-
expectTypesAre<string, number>('notEqual'); // OK
|
|
151
|
-
expectTypesAre<string, string>('notEqual'); // Type error
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
##### test()
|
|
155
|
-
|
|
156
|
-
```ts
|
|
157
|
-
test: (title, func) => void;
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
###### Parameters
|
|
161
|
-
|
|
162
|
-
###### title
|
|
163
|
-
|
|
164
|
-
`string`
|
|
165
|
-
|
|
166
|
-
###### func
|
|
167
|
-
|
|
168
|
-
() => `any`
|
|
169
|
-
|
|
170
|
-
###### Returns
|
|
171
|
-
|
|
172
|
-
`void`
|
package/docs/typingUtils.md
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / typingUtils
|
|
6
|
-
|
|
7
|
-
# typingUtils
|
|
8
|
-
|
|
9
|
-
## Type Aliases
|
|
10
|
-
|
|
11
|
-
### ~~DeepPrettify\<T\>~~
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
type DeepPrettify<T> = { [K in keyof T]: T[K] extends Record<string, unknown> ? DeepPrettify<T[K]> : T[K] } & object;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/typingUtils.ts:31](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingUtils.ts#L31)
|
|
18
|
-
|
|
19
|
-
#### Type Parameters
|
|
20
|
-
|
|
21
|
-
##### T
|
|
22
|
-
|
|
23
|
-
`T`
|
|
24
|
-
|
|
25
|
-
#### Deprecated
|
|
26
|
-
|
|
27
|
-
Use `DeepPrettify` from `@ls-stack/utils/typeUtils` instead
|
|
28
|
-
|
|
29
|
-
***
|
|
30
|
-
|
|
31
|
-
### ~~IsAny\<T\>~~
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
type IsAny<T> = unknown extends T ? [keyof T] extends [never] ? false : true : false;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Defined in: [packages/utils/src/typingUtils.ts:18](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingUtils.ts#L18)
|
|
38
|
-
|
|
39
|
-
#### Type Parameters
|
|
40
|
-
|
|
41
|
-
##### T
|
|
42
|
-
|
|
43
|
-
`T`
|
|
44
|
-
|
|
45
|
-
#### Deprecated
|
|
46
|
-
|
|
47
|
-
Use `IsAny` from `@ls-stack/utils/typeUtils` instead
|
|
48
|
-
|
|
49
|
-
***
|
|
50
|
-
|
|
51
|
-
### ~~NonPartial\<T\>~~
|
|
52
|
-
|
|
53
|
-
```ts
|
|
54
|
-
type NonPartial<T> = { [K in keyof Required<T>]: T[K] };
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Defined in: [packages/utils/src/typingUtils.ts:7](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingUtils.ts#L7)
|
|
58
|
-
|
|
59
|
-
#### Type Parameters
|
|
60
|
-
|
|
61
|
-
##### T
|
|
62
|
-
|
|
63
|
-
`T`
|
|
64
|
-
|
|
65
|
-
#### Deprecated
|
|
66
|
-
|
|
67
|
-
Use `NonPartial` from `@ls-stack/utils/typeUtils` instead
|
|
68
|
-
|
|
69
|
-
***
|
|
70
|
-
|
|
71
|
-
### ~~ObjKeysWithValuesOfType\<Obj, ValueType\>~~
|
|
72
|
-
|
|
73
|
-
```ts
|
|
74
|
-
type ObjKeysWithValuesOfType<Obj, ValueType> = { [K in keyof Obj]: Obj[K] extends ValueType ? K : never }[keyof Obj];
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Defined in: [packages/utils/src/typingUtils.ts:10](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingUtils.ts#L10)
|
|
78
|
-
|
|
79
|
-
#### Type Parameters
|
|
80
|
-
|
|
81
|
-
##### Obj
|
|
82
|
-
|
|
83
|
-
`Obj` *extends* `Record`\<`PropertyKey`, `unknown`\>
|
|
84
|
-
|
|
85
|
-
##### ValueType
|
|
86
|
-
|
|
87
|
-
`ValueType`
|
|
88
|
-
|
|
89
|
-
#### Deprecated
|
|
90
|
-
|
|
91
|
-
Use `ObjKeysWithValuesOfType` from `@ls-stack/utils/typeUtils` instead
|
|
92
|
-
|
|
93
|
-
***
|
|
94
|
-
|
|
95
|
-
### ~~PartialRecord\<K, T\>~~
|
|
96
|
-
|
|
97
|
-
```ts
|
|
98
|
-
type PartialRecord<K, T> = { [P in K]?: T };
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
Defined in: [packages/utils/src/typingUtils.ts:2](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingUtils.ts#L2)
|
|
102
|
-
|
|
103
|
-
#### Type Parameters
|
|
104
|
-
|
|
105
|
-
##### K
|
|
106
|
-
|
|
107
|
-
`K` *extends* keyof `any`
|
|
108
|
-
|
|
109
|
-
##### T
|
|
110
|
-
|
|
111
|
-
`T`
|
|
112
|
-
|
|
113
|
-
#### Deprecated
|
|
114
|
-
|
|
115
|
-
Use `PartialRecord` from `@ls-stack/utils/typeUtils` instead
|
|
116
|
-
|
|
117
|
-
***
|
|
118
|
-
|
|
119
|
-
### ~~Prettify\<T\>~~
|
|
120
|
-
|
|
121
|
-
```ts
|
|
122
|
-
type Prettify<T> = { [P in keyof T]: T[P] } & object;
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Defined in: [packages/utils/src/typingUtils.ts:26](https://github.com/lucasols/utils/blob/main/packages/utils/src/typingUtils.ts#L26)
|
|
126
|
-
|
|
127
|
-
#### Type Parameters
|
|
128
|
-
|
|
129
|
-
##### T
|
|
130
|
-
|
|
131
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
132
|
-
|
|
133
|
-
#### Deprecated
|
|
134
|
-
|
|
135
|
-
Use `DeepPrettify` from `@ls-stack/utils/typeUtils` instead
|
package/docs/yamlStringify.md
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / yamlStringify
|
|
6
|
-
|
|
7
|
-
# yamlStringify
|
|
8
|
-
|
|
9
|
-
## Type Aliases
|
|
10
|
-
|
|
11
|
-
### YamlStringifyOptions
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
type YamlStringifyOptions = object;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/yamlStringify.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L5)
|
|
18
|
-
|
|
19
|
-
#### Properties
|
|
20
|
-
|
|
21
|
-
##### addRootObjSpaces?
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
optional addRootObjSpaces: "before" | "after" | "beforeAndAfter" | false;
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Defined in: [packages/utils/src/yamlStringify.ts:15](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L15)
|
|
28
|
-
|
|
29
|
-
##### collapseObjects?
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
optional collapseObjects: boolean;
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Defined in: [packages/utils/src/yamlStringify.ts:13](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L13)
|
|
36
|
-
|
|
37
|
-
##### maxDepth?
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
optional maxDepth: number;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Defined in: [packages/utils/src/yamlStringify.ts:11](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L11)
|
|
44
|
-
|
|
45
|
-
##### maxLineLength?
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
optional maxLineLength: number;
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Defined in: [packages/utils/src/yamlStringify.ts:7](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L7)
|
|
52
|
-
|
|
53
|
-
##### showUndefined?
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
optional showUndefined: boolean;
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
Defined in: [packages/utils/src/yamlStringify.ts:9](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L9)
|
|
60
|
-
|
|
61
|
-
## Functions
|
|
62
|
-
|
|
63
|
-
### yamlStringify()
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
function yamlStringify(obj, __namedParameters): string;
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Defined in: [packages/utils/src/yamlStringify.ts:18](https://github.com/lucasols/utils/blob/main/packages/utils/src/yamlStringify.ts#L18)
|
|
70
|
-
|
|
71
|
-
#### Parameters
|
|
72
|
-
|
|
73
|
-
##### obj
|
|
74
|
-
|
|
75
|
-
`unknown`
|
|
76
|
-
|
|
77
|
-
##### \_\_namedParameters
|
|
78
|
-
|
|
79
|
-
[`YamlStringifyOptions`](#yamlstringifyoptions) = `{}`
|
|
80
|
-
|
|
81
|
-
#### Returns
|
|
82
|
-
|
|
83
|
-
`string`
|