@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
package/docs/debounce.md
DELETED
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / debounce
|
|
6
|
-
|
|
7
|
-
# debounce
|
|
8
|
-
|
|
9
|
-
## Interfaces
|
|
10
|
-
|
|
11
|
-
### DebouncedFunc()\<T\>
|
|
12
|
-
|
|
13
|
-
Defined in: [packages/utils/src/debounce.ts:16](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L16)
|
|
14
|
-
|
|
15
|
-
#### Type Parameters
|
|
16
|
-
|
|
17
|
-
##### T
|
|
18
|
-
|
|
19
|
-
`T` *extends* (...`args`) => `void`
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
DebouncedFunc(...args): undefined | ReturnType<T>;
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Defined in: [packages/utils/src/debounce.ts:26](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L26)
|
|
26
|
-
|
|
27
|
-
Call the original function, but applying the debounce rules.
|
|
28
|
-
|
|
29
|
-
If the debounced function can be run immediately, this calls it and returns its return
|
|
30
|
-
value.
|
|
31
|
-
|
|
32
|
-
Otherwise, it returns the return value of the last invocation, or undefined if the debounced
|
|
33
|
-
function was not invoked yet.
|
|
34
|
-
|
|
35
|
-
#### Parameters
|
|
36
|
-
|
|
37
|
-
##### args
|
|
38
|
-
|
|
39
|
-
...`Parameters`\<`T`\>
|
|
40
|
-
|
|
41
|
-
#### Returns
|
|
42
|
-
|
|
43
|
-
`undefined` \| `ReturnType`\<`T`\>
|
|
44
|
-
|
|
45
|
-
#### Properties
|
|
46
|
-
|
|
47
|
-
##### cancel()
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
cancel: () => void;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Defined in: [packages/utils/src/debounce.ts:31](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L31)
|
|
54
|
-
|
|
55
|
-
Throw away any pending invocation of the debounced function.
|
|
56
|
-
|
|
57
|
-
###### Returns
|
|
58
|
-
|
|
59
|
-
`void`
|
|
60
|
-
|
|
61
|
-
##### flush()
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
flush: () => undefined | ReturnType<T>;
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Defined in: [packages/utils/src/debounce.ts:40](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L40)
|
|
68
|
-
|
|
69
|
-
If there is a pending invocation of the debounced function, invoke it immediately and return
|
|
70
|
-
its return value.
|
|
71
|
-
|
|
72
|
-
Otherwise, return the value from the last invocation, or undefined if the debounced function
|
|
73
|
-
was never invoked.
|
|
74
|
-
|
|
75
|
-
###### Returns
|
|
76
|
-
|
|
77
|
-
`undefined` \| `ReturnType`\<`T`\>
|
|
78
|
-
|
|
79
|
-
## Type Aliases
|
|
80
|
-
|
|
81
|
-
### DebounceOptions
|
|
82
|
-
|
|
83
|
-
```ts
|
|
84
|
-
type DebounceOptions = object;
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Defined in: [packages/utils/src/debounce.ts:1](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L1)
|
|
88
|
-
|
|
89
|
-
#### Properties
|
|
90
|
-
|
|
91
|
-
##### leading?
|
|
92
|
-
|
|
93
|
-
```ts
|
|
94
|
-
optional leading: boolean;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Defined in: [packages/utils/src/debounce.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L5)
|
|
98
|
-
|
|
99
|
-
###### See
|
|
100
|
-
|
|
101
|
-
_.leading
|
|
102
|
-
|
|
103
|
-
##### maxWait?
|
|
104
|
-
|
|
105
|
-
```ts
|
|
106
|
-
optional maxWait: number;
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
Defined in: [packages/utils/src/debounce.ts:9](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L9)
|
|
110
|
-
|
|
111
|
-
###### See
|
|
112
|
-
|
|
113
|
-
_.maxWait
|
|
114
|
-
|
|
115
|
-
##### trailing?
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
optional trailing: boolean;
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Defined in: [packages/utils/src/debounce.ts:13](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L13)
|
|
122
|
-
|
|
123
|
-
###### See
|
|
124
|
-
|
|
125
|
-
_.trailing
|
|
126
|
-
|
|
127
|
-
## Functions
|
|
128
|
-
|
|
129
|
-
### debounce()
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
function debounce<T>(
|
|
133
|
-
func,
|
|
134
|
-
wait,
|
|
135
|
-
options?): DebouncedFunc<T>;
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
Defined in: [packages/utils/src/debounce.ts:44](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L44)
|
|
139
|
-
|
|
140
|
-
#### Type Parameters
|
|
141
|
-
|
|
142
|
-
##### T
|
|
143
|
-
|
|
144
|
-
`T` *extends* (...`args`) => `void`
|
|
145
|
-
|
|
146
|
-
#### Parameters
|
|
147
|
-
|
|
148
|
-
##### func
|
|
149
|
-
|
|
150
|
-
`T`
|
|
151
|
-
|
|
152
|
-
##### wait
|
|
153
|
-
|
|
154
|
-
`number`
|
|
155
|
-
|
|
156
|
-
##### options?
|
|
157
|
-
|
|
158
|
-
[`DebounceOptions`](#debounceoptions)
|
|
159
|
-
|
|
160
|
-
#### Returns
|
|
161
|
-
|
|
162
|
-
[`DebouncedFunc`](#debouncedfunc)\<`T`\>
|
|
163
|
-
|
|
164
|
-
***
|
|
165
|
-
|
|
166
|
-
### isDebouncedFn()
|
|
167
|
-
|
|
168
|
-
```ts
|
|
169
|
-
function isDebouncedFn<T>(fn): fn is T & { cancel: () => void; flush: () => undefined | ReturnType<T> };
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Defined in: [packages/utils/src/debounce.ts:176](https://github.com/lucasols/utils/blob/main/packages/utils/src/debounce.ts#L176)
|
|
173
|
-
|
|
174
|
-
#### Type Parameters
|
|
175
|
-
|
|
176
|
-
##### T
|
|
177
|
-
|
|
178
|
-
`T` *extends* (...`args`) => `void`
|
|
179
|
-
|
|
180
|
-
#### Parameters
|
|
181
|
-
|
|
182
|
-
##### fn
|
|
183
|
-
|
|
184
|
-
`T`
|
|
185
|
-
|
|
186
|
-
#### Returns
|
|
187
|
-
|
|
188
|
-
fn is T & \{ cancel: () =\> void; flush: () =\> undefined \| ReturnType\<T\> \}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](../modules.md) / [dedent](README.md) / \<internal\>
|
|
6
|
-
|
|
7
|
-
# \<internal\>
|
|
8
|
-
|
|
9
|
-
## Type Aliases
|
|
10
|
-
|
|
11
|
-
### InterpolationValue
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
type InterpolationValue = string | number | boolean | null | undefined;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/dedent.ts:30](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L30)
|
package/docs/dedent/README.md
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](../modules.md) / dedent
|
|
6
|
-
|
|
7
|
-
# dedent
|
|
8
|
-
|
|
9
|
-
## Modules
|
|
10
|
-
|
|
11
|
-
- [\<internal\>](-internal-.md)
|
|
12
|
-
|
|
13
|
-
## Interfaces
|
|
14
|
-
|
|
15
|
-
### Dedent()
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/dedent.ts:35](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L35)
|
|
18
|
-
|
|
19
|
-
Dedent function interface that can be used both as a template tag and a regular function
|
|
20
|
-
|
|
21
|
-
#### Call Signature
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
Dedent(literals): string;
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Defined in: [packages/utils/src/dedent.ts:39](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L39)
|
|
28
|
-
|
|
29
|
-
Dedent function interface that can be used both as a template tag and a regular function
|
|
30
|
-
|
|
31
|
-
##### Parameters
|
|
32
|
-
|
|
33
|
-
###### literals
|
|
34
|
-
|
|
35
|
-
`string`
|
|
36
|
-
|
|
37
|
-
##### Returns
|
|
38
|
-
|
|
39
|
-
`string`
|
|
40
|
-
|
|
41
|
-
#### Call Signature
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
Dedent(strings, ...values): string;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Defined in: [packages/utils/src/dedent.ts:43](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L43)
|
|
48
|
-
|
|
49
|
-
Dedent function interface that can be used both as a template tag and a regular function
|
|
50
|
-
|
|
51
|
-
##### Parameters
|
|
52
|
-
|
|
53
|
-
###### strings
|
|
54
|
-
|
|
55
|
-
`TemplateStringsArray`
|
|
56
|
-
|
|
57
|
-
###### values
|
|
58
|
-
|
|
59
|
-
...[`InterpolationValue`](-internal-.md#interpolationvalue)[]
|
|
60
|
-
|
|
61
|
-
##### Returns
|
|
62
|
-
|
|
63
|
-
`string`
|
|
64
|
-
|
|
65
|
-
#### Properties
|
|
66
|
-
|
|
67
|
-
##### withOptions
|
|
68
|
-
|
|
69
|
-
```ts
|
|
70
|
-
withOptions: CreateDedent;
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Defined in: [packages/utils/src/dedent.ts:47](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L47)
|
|
74
|
-
|
|
75
|
-
Create a new dedent function with custom options
|
|
76
|
-
|
|
77
|
-
***
|
|
78
|
-
|
|
79
|
-
### DedentOptions
|
|
80
|
-
|
|
81
|
-
Defined in: [packages/utils/src/dedent.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L4)
|
|
82
|
-
|
|
83
|
-
Configuration options for the dedent function behavior
|
|
84
|
-
|
|
85
|
-
#### Properties
|
|
86
|
-
|
|
87
|
-
##### escapeSpecialCharacters?
|
|
88
|
-
|
|
89
|
-
```ts
|
|
90
|
-
optional escapeSpecialCharacters: boolean;
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Defined in: [packages/utils/src/dedent.ts:10](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L10)
|
|
94
|
-
|
|
95
|
-
Whether to process escape sequences like \n, `, \$, and {
|
|
96
|
-
When true, allows using escaped characters in template literals
|
|
97
|
-
|
|
98
|
-
###### Default
|
|
99
|
-
|
|
100
|
-
```ts
|
|
101
|
-
true for template literals, false for plain strings
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
##### identInterpolations?
|
|
105
|
-
|
|
106
|
-
```ts
|
|
107
|
-
optional identInterpolations: boolean;
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Defined in: [packages/utils/src/dedent.ts:21](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L21)
|
|
111
|
-
|
|
112
|
-
Whether to preserve relative indentation of interpolated multi-line values
|
|
113
|
-
When true, multi-line interpolations are re-indented to match the surrounding context
|
|
114
|
-
|
|
115
|
-
###### Default
|
|
116
|
-
|
|
117
|
-
```ts
|
|
118
|
-
true
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
##### showNullishOrFalseValues?
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
optional showNullishOrFalseValues: boolean;
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Defined in: [packages/utils/src/dedent.ts:27](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L27)
|
|
128
|
-
|
|
129
|
-
Whether to display nullish or false values (false, null, undefined) in interpolations
|
|
130
|
-
When false, nullish or false values are skipped entirely
|
|
131
|
-
|
|
132
|
-
###### Default
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
false
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
##### trimWhitespace?
|
|
139
|
-
|
|
140
|
-
```ts
|
|
141
|
-
optional trimWhitespace: boolean;
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
Defined in: [packages/utils/src/dedent.ts:15](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L15)
|
|
145
|
-
|
|
146
|
-
Whether to trim leading and trailing whitespace from the final result
|
|
147
|
-
|
|
148
|
-
###### Default
|
|
149
|
-
|
|
150
|
-
```ts
|
|
151
|
-
true
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Type Aliases
|
|
155
|
-
|
|
156
|
-
### CreateDedent()
|
|
157
|
-
|
|
158
|
-
```ts
|
|
159
|
-
type CreateDedent = (options) => Dedent;
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
Defined in: [packages/utils/src/dedent.ts:53](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L53)
|
|
163
|
-
|
|
164
|
-
Factory function type for creating dedent functions with custom options
|
|
165
|
-
|
|
166
|
-
#### Parameters
|
|
167
|
-
|
|
168
|
-
##### options
|
|
169
|
-
|
|
170
|
-
[`DedentOptions`](#dedentoptions)
|
|
171
|
-
|
|
172
|
-
#### Returns
|
|
173
|
-
|
|
174
|
-
[`Dedent`](#dedent)
|
|
175
|
-
|
|
176
|
-
## Variables
|
|
177
|
-
|
|
178
|
-
### dedent
|
|
179
|
-
|
|
180
|
-
```ts
|
|
181
|
-
const dedent: Dedent;
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
Defined in: [packages/utils/src/dedent.ts:75](https://github.com/lucasols/utils/blob/main/packages/utils/src/dedent.ts#L75)
|
|
185
|
-
|
|
186
|
-
Remove common leading indentation from multi-line strings while preserving relative indentation.
|
|
187
|
-
Can be used as a tagged template literal or called with a plain string.
|
|
188
|
-
|
|
189
|
-
By default, it will dedent interpolated multi-line strings to match the surrounding context.
|
|
190
|
-
And it will not show falsy values.
|
|
191
|
-
|
|
192
|
-
#### Example
|
|
193
|
-
|
|
194
|
-
```typescript
|
|
195
|
-
const text = dedent`
|
|
196
|
-
function hello() {
|
|
197
|
-
console.log('world');
|
|
198
|
-
}
|
|
199
|
-
`;
|
|
200
|
-
// Result:
|
|
201
|
-
"function hello() {
|
|
202
|
-
console.log('world');
|
|
203
|
-
}"
|
|
204
|
-
```
|
package/docs/deepEqual.md
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / deepEqual
|
|
6
|
-
|
|
7
|
-
# deepEqual
|
|
8
|
-
|
|
9
|
-
## Functions
|
|
10
|
-
|
|
11
|
-
### deepEqual()
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
function deepEqual(
|
|
15
|
-
foo,
|
|
16
|
-
bar,
|
|
17
|
-
maxDepth): boolean;
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Defined in: [packages/utils/src/deepEqual.ts:30](https://github.com/lucasols/utils/blob/main/packages/utils/src/deepEqual.ts#L30)
|
|
21
|
-
|
|
22
|
-
Deep equality comparison between two values
|
|
23
|
-
|
|
24
|
-
#### Parameters
|
|
25
|
-
|
|
26
|
-
##### foo
|
|
27
|
-
|
|
28
|
-
`any`
|
|
29
|
-
|
|
30
|
-
First value to compare
|
|
31
|
-
|
|
32
|
-
##### bar
|
|
33
|
-
|
|
34
|
-
`any`
|
|
35
|
-
|
|
36
|
-
Second value to compare
|
|
37
|
-
|
|
38
|
-
##### maxDepth
|
|
39
|
-
|
|
40
|
-
`number` = `20`
|
|
41
|
-
|
|
42
|
-
Maximum comparison depth (default: 20)
|
|
43
|
-
|
|
44
|
-
#### Returns
|
|
45
|
-
|
|
46
|
-
`boolean`
|
|
47
|
-
|
|
48
|
-
True if values are deeply equal, false otherwise
|
|
49
|
-
|
|
50
|
-
#### Example
|
|
51
|
-
|
|
52
|
-
```ts
|
|
53
|
-
deepEqual({a: 1}, {a: 1}) // true
|
|
54
|
-
deepEqual({a: 1}, {a: 2}) // false
|
|
55
|
-
deepEqual([1, {b: 2}], [1, {b: 2}]) // true
|
|
56
|
-
deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
|
|
57
|
-
deepEqual(new Set([1, 2]), new Set([1, 2])) // true
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
***
|
|
61
|
-
|
|
62
|
-
### deepEqualWithMaxDepth()
|
|
63
|
-
|
|
64
|
-
```ts
|
|
65
|
-
function deepEqualWithMaxDepth(maxDepth): (foo, bar) => boolean;
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Defined in: [packages/utils/src/deepEqual.ts:94](https://github.com/lucasols/utils/blob/main/packages/utils/src/deepEqual.ts#L94)
|
|
69
|
-
|
|
70
|
-
#### Parameters
|
|
71
|
-
|
|
72
|
-
##### maxDepth
|
|
73
|
-
|
|
74
|
-
`number`
|
|
75
|
-
|
|
76
|
-
#### Returns
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
(foo, bar): boolean;
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
##### Parameters
|
|
83
|
-
|
|
84
|
-
###### foo
|
|
85
|
-
|
|
86
|
-
`any`
|
|
87
|
-
|
|
88
|
-
###### bar
|
|
89
|
-
|
|
90
|
-
`any`
|
|
91
|
-
|
|
92
|
-
##### Returns
|
|
93
|
-
|
|
94
|
-
`boolean`
|