@ls-stack/utils 3.39.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/consoleFmt.cjs +1 -0
- package/dist/consoleFmt.d.cts +6 -0
- package/dist/consoleFmt.d.ts +6 -0
- package/dist/consoleFmt.js +1 -0
- 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 +6 -2
- 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 -91
- 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,146 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](../modules.md) / exhaustiveMatch
|
|
6
|
-
|
|
7
|
-
# exhaustiveMatch
|
|
8
|
-
|
|
9
|
-
## Modules
|
|
10
|
-
|
|
11
|
-
- [\<internal\>](-internal-.md)
|
|
12
|
-
|
|
13
|
-
## Functions
|
|
14
|
-
|
|
15
|
-
### exhaustiveMatch()
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
function exhaustiveMatch<T>(value): object;
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Defined in: [packages/utils/src/exhaustiveMatch.ts:1](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L1)
|
|
22
|
-
|
|
23
|
-
#### Type Parameters
|
|
24
|
-
|
|
25
|
-
##### T
|
|
26
|
-
|
|
27
|
-
`T` *extends* `string`
|
|
28
|
-
|
|
29
|
-
#### Parameters
|
|
30
|
-
|
|
31
|
-
##### value
|
|
32
|
-
|
|
33
|
-
`T`
|
|
34
|
-
|
|
35
|
-
#### Returns
|
|
36
|
-
|
|
37
|
-
##### with()
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
with: <R>(pattern) => R = matchWith;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
The pattern can be:
|
|
44
|
-
- a function that returns the result
|
|
45
|
-
- '_nxt' to try the next pattern
|
|
46
|
-
- '_never' to indicate that this pattern should never be matched
|
|
47
|
-
|
|
48
|
-
###### Type Parameters
|
|
49
|
-
|
|
50
|
-
###### R
|
|
51
|
-
|
|
52
|
-
`R`
|
|
53
|
-
|
|
54
|
-
###### Parameters
|
|
55
|
-
|
|
56
|
-
###### pattern
|
|
57
|
-
|
|
58
|
-
[`Pattern`](-internal-.md#pattern)\<`R`\>
|
|
59
|
-
|
|
60
|
-
###### Returns
|
|
61
|
-
|
|
62
|
-
`R`
|
|
63
|
-
|
|
64
|
-
##### withObject()
|
|
65
|
-
|
|
66
|
-
```ts
|
|
67
|
-
withObject: <R>(pattern) => R;
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
match with early evaluation of the values
|
|
71
|
-
|
|
72
|
-
###### Type Parameters
|
|
73
|
-
|
|
74
|
-
###### R
|
|
75
|
-
|
|
76
|
-
`R`
|
|
77
|
-
|
|
78
|
-
###### Parameters
|
|
79
|
-
|
|
80
|
-
###### pattern
|
|
81
|
-
|
|
82
|
-
`Record`\<`T`, `R`\>
|
|
83
|
-
|
|
84
|
-
###### Returns
|
|
85
|
-
|
|
86
|
-
`R`
|
|
87
|
-
|
|
88
|
-
***
|
|
89
|
-
|
|
90
|
-
### exhaustiveMatchObjUnion()
|
|
91
|
-
|
|
92
|
-
```ts
|
|
93
|
-
function exhaustiveMatchObjUnion<T, D, K>(obj, key): object;
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Defined in: [packages/utils/src/exhaustiveMatch.ts:51](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L51)
|
|
97
|
-
|
|
98
|
-
#### Type Parameters
|
|
99
|
-
|
|
100
|
-
##### T
|
|
101
|
-
|
|
102
|
-
`T` *extends* `Record`\<`string`, `unknown`\>
|
|
103
|
-
|
|
104
|
-
##### D
|
|
105
|
-
|
|
106
|
-
`D` *extends* `string` \| `number` \| `symbol`
|
|
107
|
-
|
|
108
|
-
##### K
|
|
109
|
-
|
|
110
|
-
`K` *extends* `string`
|
|
111
|
-
|
|
112
|
-
#### Parameters
|
|
113
|
-
|
|
114
|
-
##### obj
|
|
115
|
-
|
|
116
|
-
`T`
|
|
117
|
-
|
|
118
|
-
##### key
|
|
119
|
-
|
|
120
|
-
`D`
|
|
121
|
-
|
|
122
|
-
#### Returns
|
|
123
|
-
|
|
124
|
-
`object`
|
|
125
|
-
|
|
126
|
-
##### with()
|
|
127
|
-
|
|
128
|
-
```ts
|
|
129
|
-
with: <R>(pattern) => R = withLazy;
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
###### Type Parameters
|
|
133
|
-
|
|
134
|
-
###### R
|
|
135
|
-
|
|
136
|
-
`R`
|
|
137
|
-
|
|
138
|
-
###### Parameters
|
|
139
|
-
|
|
140
|
-
###### pattern
|
|
141
|
-
|
|
142
|
-
[`Pattern`](-internal-.md#pattern-1)\<`R`\>
|
|
143
|
-
|
|
144
|
-
###### Returns
|
|
145
|
-
|
|
146
|
-
`R`
|
|
@@ -1,109 +0,0 @@
|
|
|
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:60](https://github.com/lucasols/utils/blob/main/packages/utils/src/filterObjectOrArrayKeys.ts#L60)
|
|
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
|
-
- Pattern expansion with parentheses:
|
|
46
|
-
- `'prop.test.(prop1|prop2|prop3)'` - Expands to `prop.test.prop1`, `prop.test.prop2`, and `prop.test.prop3`
|
|
47
|
-
- `'components[*].(table_id|columns|filters[*].value)'` - Expands to `components[*].table_id`, `components[*].columns`, and `components[*].filters[*].value`
|
|
48
|
-
- `'(users|admins)[*].name'` - Expands to `users[*].name` and `admins[*].name`
|
|
49
|
-
- Array filtering by value:
|
|
50
|
-
- `'users[%name="John"]'` - Filters the `users` with the `name` property equal to `John`
|
|
51
|
-
- `'users[%name="John" | "Jane"]'` - Value-level OR using `|` for multiple values of same property
|
|
52
|
-
- `'users[%name="Alice" || %age=35]'` - Property-level OR using `||` for different properties
|
|
53
|
-
- `'users[%age=30 && %role="admin"]'` - Property-level AND using `&&` for different properties
|
|
54
|
-
- Note: Mixing `&&` and `||` in the same filter is not supported - use separate filter patterns instead
|
|
55
|
-
- `'users[%config.name="John" | "Jane"]'` - Dot notation is supported
|
|
56
|
-
- `'users[%name*="oh"]'` - Contains operator (*=) - filters users where name contains "oh"
|
|
57
|
-
- `'users[%name^="Jo"]'` - Starts with operator (^=) - filters users where name starts with "Jo"
|
|
58
|
-
- `'users[%name$="hn"]'` - Ends with operator ($=) - filters users where name ends with "hn"
|
|
59
|
-
- `'users[%name!="John"]'` - Not equal operator (!=) - filters users where name is not "John"
|
|
60
|
-
- `'users[%name!*="admin"]'` - Not contains operator (!*=) - filters users where name doesn't contain "admin"
|
|
61
|
-
- `'users[i%name="john"]'` - Case-insensitive matching (i% prefix) - matches "John", "JOHN", "john", etc.
|
|
62
|
-
|
|
63
|
-
#### Parameters
|
|
64
|
-
|
|
65
|
-
##### objOrArray
|
|
66
|
-
|
|
67
|
-
The object or array to filter.
|
|
68
|
-
|
|
69
|
-
`Record`\<`string`, `any`\> | `Record`\<`string`, `any`\>[]
|
|
70
|
-
|
|
71
|
-
##### options
|
|
72
|
-
|
|
73
|
-
The options for the filter.
|
|
74
|
-
|
|
75
|
-
###### filterKeys?
|
|
76
|
-
|
|
77
|
-
`string` \| `string`[]
|
|
78
|
-
|
|
79
|
-
The keys to filter.
|
|
80
|
-
|
|
81
|
-
###### rejectEmptyObjectsInArray?
|
|
82
|
-
|
|
83
|
-
`boolean` = `true`
|
|
84
|
-
|
|
85
|
-
Whether to reject empty objects in arrays (default: true).
|
|
86
|
-
|
|
87
|
-
###### rejectKeys?
|
|
88
|
-
|
|
89
|
-
`string` \| `string`[]
|
|
90
|
-
|
|
91
|
-
The keys to reject.
|
|
92
|
-
|
|
93
|
-
###### sortKeys?
|
|
94
|
-
|
|
95
|
-
`false` \| `"asc"` \| `"simpleValuesFirst"` \| `"desc"` = `'simpleValuesFirst'`
|
|
96
|
-
|
|
97
|
-
Sort all keys by a specific order (optional, preserves original order when not specified).
|
|
98
|
-
|
|
99
|
-
###### sortPatterns?
|
|
100
|
-
|
|
101
|
-
`string`[]
|
|
102
|
-
|
|
103
|
-
Sort specific keys by pattern. Use to control the order of specific properties. The same patterns as `filterKeys` are supported.
|
|
104
|
-
|
|
105
|
-
#### Returns
|
|
106
|
-
|
|
107
|
-
`Record`\<`string`, `any`\> \| `Record`\<`string`, `any`\>[]
|
|
108
|
-
|
|
109
|
-
The filtered object or array.
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / getAutoIncrementId
|
|
6
|
-
|
|
7
|
-
# getAutoIncrementId
|
|
8
|
-
|
|
9
|
-
## Functions
|
|
10
|
-
|
|
11
|
-
### getAutoIncrementId()
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
function getAutoIncrementId(): number;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/getAutoIncrementId.ts:19](https://github.com/lucasols/utils/blob/main/packages/utils/src/getAutoIncrementId.ts#L19)
|
|
18
|
-
|
|
19
|
-
Returns a unique auto-incrementing number each time it's called.
|
|
20
|
-
This is useful for generating simple unique identifiers within a single session/process.
|
|
21
|
-
|
|
22
|
-
**Note:** This is not suitable for distributed systems or persistent storage.
|
|
23
|
-
For cryptographically secure or collision-resistant IDs, use `nanoid()` instead.
|
|
24
|
-
|
|
25
|
-
#### Returns
|
|
26
|
-
|
|
27
|
-
`number`
|
|
28
|
-
|
|
29
|
-
A unique incrementing number starting from 1
|
|
30
|
-
|
|
31
|
-
#### Example
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
const id1 = getAutoIncrementId(); // 1
|
|
35
|
-
const id2 = getAutoIncrementId(); // 2
|
|
36
|
-
const id3 = getAutoIncrementId(); // 3
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
***
|
|
40
|
-
|
|
41
|
-
### getLocalAutoIncrementIdGenerator()
|
|
42
|
-
|
|
43
|
-
```ts
|
|
44
|
-
function getLocalAutoIncrementIdGenerator(options): () => string;
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Defined in: [packages/utils/src/getAutoIncrementId.ts:44](https://github.com/lucasols/utils/blob/main/packages/utils/src/getAutoIncrementId.ts#L44)
|
|
48
|
-
|
|
49
|
-
Creates a local auto-increment ID generator with optional prefix and suffix.
|
|
50
|
-
Each generator maintains its own independent counter starting from 1.
|
|
51
|
-
This is useful when you need multiple independent ID sequences or formatted IDs.
|
|
52
|
-
|
|
53
|
-
#### Parameters
|
|
54
|
-
|
|
55
|
-
##### options
|
|
56
|
-
|
|
57
|
-
Configuration object
|
|
58
|
-
|
|
59
|
-
###### prefix?
|
|
60
|
-
|
|
61
|
-
`string`
|
|
62
|
-
|
|
63
|
-
Optional prefix to prepend to each generated ID
|
|
64
|
-
|
|
65
|
-
###### suffix?
|
|
66
|
-
|
|
67
|
-
`string`
|
|
68
|
-
|
|
69
|
-
Optional suffix to append to each generated ID
|
|
70
|
-
|
|
71
|
-
#### Returns
|
|
72
|
-
|
|
73
|
-
A function that generates formatted auto-increment IDs
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
(): string;
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
##### Returns
|
|
80
|
-
|
|
81
|
-
`string`
|
|
82
|
-
|
|
83
|
-
#### Example
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
const userIdGen = getLocalAutoIncrementIdGenerator({ prefix: 'user-' });
|
|
87
|
-
const postIdGen = getLocalAutoIncrementIdGenerator({ prefix: 'post-', suffix: '-draft' });
|
|
88
|
-
|
|
89
|
-
console.log(userIdGen()); // "user-1"
|
|
90
|
-
console.log(userIdGen()); // "user-2"
|
|
91
|
-
console.log(postIdGen()); // "post-1-draft"
|
|
92
|
-
console.log(postIdGen()); // "post-2-draft"
|
|
93
|
-
```
|
package/docs/getCompositeKey.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / getCompositeKey
|
|
6
|
-
|
|
7
|
-
# getCompositeKey
|
|
8
|
-
|
|
9
|
-
## Functions
|
|
10
|
-
|
|
11
|
-
### getCompositeKey()
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
function getCompositeKey(input, maxSortingDepth): string;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/getCompositeKey.ts:10](https://github.com/lucasols/utils/blob/main/packages/utils/src/getCompositeKey.ts#L10)
|
|
18
|
-
|
|
19
|
-
Returns a stable key for the input value.
|
|
20
|
-
|
|
21
|
-
#### Parameters
|
|
22
|
-
|
|
23
|
-
##### input
|
|
24
|
-
|
|
25
|
-
`unknown`
|
|
26
|
-
|
|
27
|
-
The value to get a stable key for.
|
|
28
|
-
|
|
29
|
-
##### maxSortingDepth
|
|
30
|
-
|
|
31
|
-
`number` = `3`
|
|
32
|
-
|
|
33
|
-
The maximum depth to sort the input value. Default is 3.
|
|
34
|
-
|
|
35
|
-
#### Returns
|
|
36
|
-
|
|
37
|
-
`string`
|
|
38
|
-
|
|
39
|
-
A stable key for the input value.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / getValueStableKey
|
|
6
|
-
|
|
7
|
-
# getValueStableKey
|
|
8
|
-
|
|
9
|
-
## Variables
|
|
10
|
-
|
|
11
|
-
### ~~getValueStableKey()~~
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
const getValueStableKey: (input, maxSortingDepth) => string = getCompositeKey;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/getValueStableKey.ts:12](https://github.com/lucasols/utils/blob/main/packages/utils/src/getValueStableKey.ts#L12)
|
|
18
|
-
|
|
19
|
-
Returns a stable key for the input value.
|
|
20
|
-
|
|
21
|
-
Returns a stable key for the input value.
|
|
22
|
-
|
|
23
|
-
#### Parameters
|
|
24
|
-
|
|
25
|
-
##### input
|
|
26
|
-
|
|
27
|
-
`unknown`
|
|
28
|
-
|
|
29
|
-
The value to get a stable key for.
|
|
30
|
-
|
|
31
|
-
##### maxSortingDepth
|
|
32
|
-
|
|
33
|
-
`number` = `3`
|
|
34
|
-
|
|
35
|
-
The maximum depth to sort the input value. Default is 3.
|
|
36
|
-
|
|
37
|
-
#### Returns
|
|
38
|
-
|
|
39
|
-
`string`
|
|
40
|
-
|
|
41
|
-
A stable key for the input value.
|
|
42
|
-
|
|
43
|
-
#### Param
|
|
44
|
-
|
|
45
|
-
The value to get a stable key for.
|
|
46
|
-
|
|
47
|
-
#### Param
|
|
48
|
-
|
|
49
|
-
The maximum depth to sort the input value. Default is 3.
|
|
50
|
-
|
|
51
|
-
#### Returns
|
|
52
|
-
|
|
53
|
-
A stable key for the input value.
|
|
54
|
-
|
|
55
|
-
#### Deprecated
|
|
56
|
-
|
|
57
|
-
Use `getCompositeKey` from `@ls-stack/utils/getCompositeKey` instead.
|
package/docs/hash.md
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / hash
|
|
6
|
-
|
|
7
|
-
# hash
|
|
8
|
-
|
|
9
|
-
## Functions
|
|
10
|
-
|
|
11
|
-
### murmur2()
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
function murmur2(str): string;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/hash.ts:8](https://github.com/lucasols/utils/blob/main/packages/utils/src/hash.ts#L8)
|
|
18
|
-
|
|
19
|
-
#### Parameters
|
|
20
|
-
|
|
21
|
-
##### str
|
|
22
|
-
|
|
23
|
-
`string`
|
|
24
|
-
|
|
25
|
-
The string to hash.
|
|
26
|
-
|
|
27
|
-
#### Returns
|
|
28
|
-
|
|
29
|
-
`string`
|
|
30
|
-
|
|
31
|
-
The hash of the string.
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](../modules.md) / [interpolate](README.md) / \<internal\>
|
|
6
|
-
|
|
7
|
-
# \<internal\>
|
|
8
|
-
|
|
9
|
-
## Type Aliases
|
|
10
|
-
|
|
11
|
-
### InterpolateArgs
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
type InterpolateArgs = object;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/interpolate.ts:29](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L29)
|
|
18
|
-
|
|
19
|
-
#### Properties
|
|
20
|
-
|
|
21
|
-
##### clamp?
|
|
22
|
-
|
|
23
|
-
```ts
|
|
24
|
-
optional clamp: boolean | "start" | "end";
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Defined in: [packages/utils/src/interpolate.ts:33](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L33)
|
|
28
|
-
|
|
29
|
-
##### in
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
in: number[];
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Defined in: [packages/utils/src/interpolate.ts:31](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L31)
|
|
36
|
-
|
|
37
|
-
##### input
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
input: number;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Defined in: [packages/utils/src/interpolate.ts:30](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L30)
|
|
44
|
-
|
|
45
|
-
##### out
|
|
46
|
-
|
|
47
|
-
```ts
|
|
48
|
-
out: number[];
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Defined in: [packages/utils/src/interpolate.ts:32](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L32)
|
|
52
|
-
|
|
53
|
-
***
|
|
54
|
-
|
|
55
|
-
### Interval
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
type Interval = [number, number];
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
Defined in: [packages/utils/src/interpolate.ts:4](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L4)
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](../modules.md) / interpolate
|
|
6
|
-
|
|
7
|
-
# interpolate
|
|
8
|
-
|
|
9
|
-
## Modules
|
|
10
|
-
|
|
11
|
-
- [\<internal\>](-internal-.md)
|
|
12
|
-
|
|
13
|
-
## Functions
|
|
14
|
-
|
|
15
|
-
### cyclicLerp()
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
function cyclicLerp(
|
|
19
|
-
input,
|
|
20
|
-
__namedParameters,
|
|
21
|
-
__namedParameters): number;
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Defined in: [packages/utils/src/interpolate.ts:10](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L10)
|
|
25
|
-
|
|
26
|
-
#### Parameters
|
|
27
|
-
|
|
28
|
-
##### input
|
|
29
|
-
|
|
30
|
-
`number`
|
|
31
|
-
|
|
32
|
-
##### \_\_namedParameters
|
|
33
|
-
|
|
34
|
-
[`Interval`](-internal-.md#interval)
|
|
35
|
-
|
|
36
|
-
##### \_\_namedParameters
|
|
37
|
-
|
|
38
|
-
[`Interval`](-internal-.md#interval)
|
|
39
|
-
|
|
40
|
-
#### Returns
|
|
41
|
-
|
|
42
|
-
`number`
|
|
43
|
-
|
|
44
|
-
***
|
|
45
|
-
|
|
46
|
-
### interpolate()
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
function interpolate(__namedParameters): number;
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Defined in: [packages/utils/src/interpolate.ts:36](https://github.com/lucasols/utils/blob/main/packages/utils/src/interpolate.ts#L36)
|
|
53
|
-
|
|
54
|
-
#### Parameters
|
|
55
|
-
|
|
56
|
-
##### \_\_namedParameters
|
|
57
|
-
|
|
58
|
-
[`InterpolateArgs`](-internal-.md#interpolateargs)
|
|
59
|
-
|
|
60
|
-
#### Returns
|
|
61
|
-
|
|
62
|
-
`number`
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
[**@ls-stack/utils**](README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@ls-stack/utils](modules.md) / keepPrevIfUnchanged
|
|
6
|
-
|
|
7
|
-
# keepPrevIfUnchanged
|
|
8
|
-
|
|
9
|
-
## Functions
|
|
10
|
-
|
|
11
|
-
### keepPrevIfUnchanged()
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
function keepPrevIfUnchanged<T>(__namedParameters): T;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Defined in: [packages/utils/src/keepPrevIfUnchanged.ts:3](https://github.com/lucasols/utils/blob/main/packages/utils/src/keepPrevIfUnchanged.ts#L3)
|
|
18
|
-
|
|
19
|
-
#### Type Parameters
|
|
20
|
-
|
|
21
|
-
##### T
|
|
22
|
-
|
|
23
|
-
`T`
|
|
24
|
-
|
|
25
|
-
#### Parameters
|
|
26
|
-
|
|
27
|
-
##### \_\_namedParameters
|
|
28
|
-
|
|
29
|
-
###### equalityFn?
|
|
30
|
-
|
|
31
|
-
(`foo`, `bar`) => `boolean` = `deepEqual`
|
|
32
|
-
|
|
33
|
-
###### newValue
|
|
34
|
-
|
|
35
|
-
`T`
|
|
36
|
-
|
|
37
|
-
###### prev
|
|
38
|
-
|
|
39
|
-
`T`
|
|
40
|
-
|
|
41
|
-
#### Returns
|
|
42
|
-
|
|
43
|
-
`T`
|