@ls-stack/utils 3.17.1 → 3.19.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.
Files changed (114) hide show
  1. package/README.md +1 -15
  2. package/docs/README.md +72 -0
  3. package/docs/_media/modules.md +52 -0
  4. package/docs/arrayUtils/-internal-.md +17 -0
  5. package/docs/arrayUtils/README.md +423 -0
  6. package/docs/assertions/-internal-.md +63 -0
  7. package/docs/assertions/README.md +565 -0
  8. package/docs/asyncQueue/-internal-.md +815 -0
  9. package/docs/asyncQueue/README.md +75 -0
  10. package/docs/awaitDebounce.md +66 -0
  11. package/docs/cache/-internal-.md +168 -0
  12. package/docs/cache/README.md +360 -0
  13. package/docs/castValues.md +47 -0
  14. package/docs/concurrentCalls/-internal-.md +416 -0
  15. package/docs/concurrentCalls/README.md +77 -0
  16. package/docs/consoleFmt.md +91 -0
  17. package/docs/conversions.md +27 -0
  18. package/docs/createThrottleController/-internal-.md +73 -0
  19. package/docs/createThrottleController/README.md +31 -0
  20. package/docs/debounce.md +188 -0
  21. package/docs/dedent.md +117 -0
  22. package/docs/deepEqual.md +94 -0
  23. package/docs/enhancedMap.md +358 -0
  24. package/docs/exhaustiveMatch/-internal-.md +39 -0
  25. package/docs/exhaustiveMatch/README.md +146 -0
  26. package/docs/getAutoIncrementId.md +93 -0
  27. package/docs/getCompositeKey.md +39 -0
  28. package/docs/getValueStableKey.md +57 -0
  29. package/docs/hash.md +31 -0
  30. package/docs/interpolate/-internal-.md +61 -0
  31. package/docs/interpolate/README.md +62 -0
  32. package/docs/levenshtein.md +93 -0
  33. package/docs/main.md +21 -0
  34. package/docs/mathUtils.md +137 -0
  35. package/docs/modules.md +52 -0
  36. package/docs/objUtils.md +237 -0
  37. package/docs/parallelAsyncCalls/-internal-.md +347 -0
  38. package/docs/parallelAsyncCalls/README.md +45 -0
  39. package/docs/promiseUtils/-internal-.md +69 -0
  40. package/docs/promiseUtils/README.md +31 -0
  41. package/docs/retryOnError.md +67 -0
  42. package/docs/runShellCmd/-internal-.md +111 -0
  43. package/docs/runShellCmd/README.md +201 -0
  44. package/docs/safeJson.md +51 -0
  45. package/docs/saferTyping.md +228 -0
  46. package/docs/serializeXML.md +100 -0
  47. package/docs/shallowEqual.md +33 -0
  48. package/docs/sleep.md +27 -0
  49. package/docs/stringUtils/-internal-.md +17 -0
  50. package/docs/stringUtils/README.md +166 -0
  51. package/docs/testUtils.md +315 -0
  52. package/docs/throttle/-internal-.md +47 -0
  53. package/docs/throttle/README.md +178 -0
  54. package/docs/time.md +274 -0
  55. package/docs/timers.md +256 -0
  56. package/docs/tsResult/-internal-.md +327 -0
  57. package/docs/tsResult/README.md +696 -0
  58. package/docs/typeGuards.md +399 -0
  59. package/docs/typingFnUtils/-internal-.md +27 -0
  60. package/docs/typingFnUtils/README.md +293 -0
  61. package/docs/typingTestUtils.md +172 -0
  62. package/docs/typingUtils.md +111 -0
  63. package/docs/yamlStringify.md +45 -0
  64. package/lib/arrayUtils.js +3 -3
  65. package/lib/assertions.js +2 -2
  66. package/lib/awaitDebounce.cjs +106 -0
  67. package/lib/awaitDebounce.d.cts +38 -0
  68. package/lib/awaitDebounce.d.ts +38 -0
  69. package/lib/awaitDebounce.js +28 -0
  70. package/lib/cache.js +2 -2
  71. package/lib/{chunk-NH2LCAQS.js → chunk-6FIBVC2P.js} +1 -1
  72. package/lib/{chunk-GKOTKAIV.js → chunk-7CQPOM5I.js} +1 -1
  73. package/lib/{chunk-WS4WEVHU.js → chunk-C2SVCIWE.js} +1 -1
  74. package/lib/{chunk-SSKW673U.js → chunk-JF2MDHOJ.js} +5 -1
  75. package/lib/chunk-NW5H5EW7.js +100 -0
  76. package/lib/{chunk-DMW5Q4T2.js → chunk-SRVMMYSW.js} +1 -1
  77. package/lib/concurrentCalls.js +3 -3
  78. package/lib/createThrottleController.js +3 -3
  79. package/lib/debounce.js +4 -95
  80. package/lib/enhancedMap.js +3 -3
  81. package/lib/getAutoIncrementId.cjs +44 -0
  82. package/lib/getAutoIncrementId.d.cts +44 -0
  83. package/lib/getAutoIncrementId.d.ts +44 -0
  84. package/lib/getAutoIncrementId.js +18 -0
  85. package/lib/getCompositeKey.js +3 -3
  86. package/lib/getValueStableKey.js +3 -3
  87. package/lib/interpolate.js +2 -2
  88. package/lib/parallelAsyncCalls.js +2 -2
  89. package/lib/runShellCmd.d.cts +50 -0
  90. package/lib/runShellCmd.d.ts +50 -0
  91. package/lib/serializeXML.cjs +7 -2
  92. package/lib/serializeXML.d.cts +1 -1
  93. package/lib/serializeXML.d.ts +1 -1
  94. package/lib/serializeXML.js +7 -5
  95. package/lib/testUtils.js +3 -3
  96. package/lib/throttle.cjs +250 -0
  97. package/lib/throttle.d.cts +89 -0
  98. package/lib/throttle.d.ts +89 -0
  99. package/lib/throttle.js +38 -0
  100. package/lib/timers.cjs +93 -0
  101. package/lib/timers.d.cts +110 -0
  102. package/lib/timers.d.ts +110 -0
  103. package/lib/timers.js +65 -0
  104. package/lib/tsResult.js +2 -2
  105. package/lib/typeGuards.cjs +7 -2
  106. package/lib/typeGuards.d.cts +2 -1
  107. package/lib/typeGuards.d.ts +2 -1
  108. package/lib/typeGuards.js +5 -3
  109. package/lib/typingFnUtils.cjs +5 -1
  110. package/lib/typingFnUtils.d.cts +1 -1
  111. package/lib/typingFnUtils.d.ts +1 -1
  112. package/lib/typingFnUtils.js +5 -1
  113. package/lib/yamlStringify.js +5 -5
  114. package/package.json +26 -12
@@ -0,0 +1,358 @@
1
+ [**@ls-stack/utils**](README.md)
2
+
3
+ ***
4
+
5
+ [@ls-stack/utils](modules.md) / enhancedMap
6
+
7
+ # enhancedMap
8
+
9
+ ## Classes
10
+
11
+ ### EnhancedMap\<K, V\>
12
+
13
+ Defined in: [packages/utils/src/enhancedMap.ts:5](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L5)
14
+
15
+ #### Extends
16
+
17
+ - `Map`\<`K`, `V`\>
18
+
19
+ #### Type Parameters
20
+
21
+ ##### K
22
+
23
+ `K`
24
+
25
+ ##### V
26
+
27
+ `V`
28
+
29
+ #### Constructors
30
+
31
+ ##### Constructor
32
+
33
+ ```ts
34
+ new EnhancedMap<K, V>(entries?): EnhancedMap<K, V>;
35
+ ```
36
+
37
+ Defined in: node\_modules/.pnpm/typescript@5.7.3/node\_modules/typescript/lib/lib.es2015.collection.d.ts:50
38
+
39
+ ###### Parameters
40
+
41
+ ###### entries?
42
+
43
+ `null` | readonly readonly \[`K`, `V`\][]
44
+
45
+ ###### Returns
46
+
47
+ [`EnhancedMap`](#enhancedmap)\<`K`, `V`\>
48
+
49
+ ###### Inherited from
50
+
51
+ ```ts
52
+ Map<K, V>.constructor
53
+ ```
54
+
55
+ ##### Constructor
56
+
57
+ ```ts
58
+ new EnhancedMap<K, V>(iterable?): EnhancedMap<K, V>;
59
+ ```
60
+
61
+ Defined in: node\_modules/.pnpm/typescript@5.7.3/node\_modules/typescript/lib/lib.es2015.collection.d.ts:49
62
+
63
+ ###### Parameters
64
+
65
+ ###### iterable?
66
+
67
+ `null` | `Iterable`\<readonly \[`K`, `V`\], `any`, `any`\>
68
+
69
+ ###### Returns
70
+
71
+ [`EnhancedMap`](#enhancedmap)\<`K`, `V`\>
72
+
73
+ ###### Inherited from
74
+
75
+ ```ts
76
+ Map<K, V>.constructor
77
+ ```
78
+
79
+ #### Methods
80
+
81
+ ##### find()
82
+
83
+ ```ts
84
+ find(predicate):
85
+ | undefined
86
+ | {
87
+ key: K;
88
+ value: V;
89
+ };
90
+ ```
91
+
92
+ Defined in: [packages/utils/src/enhancedMap.ts:6](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L6)
93
+
94
+ ###### Parameters
95
+
96
+ ###### predicate
97
+
98
+ (`value`, `key`) => `boolean`
99
+
100
+ ###### Returns
101
+
102
+ \| `undefined`
103
+ \| \{
104
+ `key`: `K`;
105
+ `value`: `V`;
106
+ \}
107
+
108
+ ##### getOrInsert()
109
+
110
+ ```ts
111
+ getOrInsert(key, fallback): V;
112
+ ```
113
+
114
+ Defined in: [packages/utils/src/enhancedMap.ts:44](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L44)
115
+
116
+ ###### Parameters
117
+
118
+ ###### key
119
+
120
+ `K`
121
+
122
+ ###### fallback
123
+
124
+ () => `V`
125
+
126
+ ###### Returns
127
+
128
+ `V`
129
+
130
+ ##### getOrThrow()
131
+
132
+ ```ts
133
+ getOrThrow(key): V;
134
+ ```
135
+
136
+ Defined in: [packages/utils/src/enhancedMap.ts:34](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L34)
137
+
138
+ ###### Parameters
139
+
140
+ ###### key
141
+
142
+ `K`
143
+
144
+ ###### Returns
145
+
146
+ `V`
147
+
148
+ ##### setMultiple()
149
+
150
+ ###### Call Signature
151
+
152
+ ```ts
153
+ setMultiple(values): this;
154
+ ```
155
+
156
+ Defined in: [packages/utils/src/enhancedMap.ts:18](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L18)
157
+
158
+ ###### Parameters
159
+
160
+ ###### values
161
+
162
+ `Record`\<`K` & `string`, `V`\>
163
+
164
+ ###### Returns
165
+
166
+ `this`
167
+
168
+ ###### Call Signature
169
+
170
+ ```ts
171
+ setMultiple(...values): this;
172
+ ```
173
+
174
+ Defined in: [packages/utils/src/enhancedMap.ts:19](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L19)
175
+
176
+ ###### Parameters
177
+
178
+ ###### values
179
+
180
+ ...\[`K`, `V`\][]
181
+
182
+ ###### Returns
183
+
184
+ `this`
185
+
186
+ ##### toFilteredValues()
187
+
188
+ ```ts
189
+ toFilteredValues(predicate): V[];
190
+ ```
191
+
192
+ Defined in: [packages/utils/src/enhancedMap.ts:52](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L52)
193
+
194
+ ###### Parameters
195
+
196
+ ###### predicate
197
+
198
+ (`value`, `key`) => `boolean`
199
+
200
+ ###### Returns
201
+
202
+ `V`[]
203
+
204
+ ##### toKeys()
205
+
206
+ ```ts
207
+ toKeys(): K[];
208
+ ```
209
+
210
+ Defined in: [packages/utils/src/enhancedMap.ts:104](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L104)
211
+
212
+ ###### Returns
213
+
214
+ `K`[]
215
+
216
+ ##### toMap()
217
+
218
+ ```ts
219
+ toMap<T>(mapFunction): T[];
220
+ ```
221
+
222
+ Defined in: [packages/utils/src/enhancedMap.ts:64](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L64)
223
+
224
+ ###### Type Parameters
225
+
226
+ ###### T
227
+
228
+ `T`
229
+
230
+ ###### Parameters
231
+
232
+ ###### mapFunction
233
+
234
+ (`value`, `key`, `reject`) => *typeof* [`enhancedMapReject`](#enhancedmapreject) \| `T`
235
+
236
+ ###### Returns
237
+
238
+ `T`[]
239
+
240
+ ##### toObjMap()
241
+
242
+ ```ts
243
+ toObjMap<ObjKey, ObjValue>(mapFunction): Record<ObjKey, ObjValue>;
244
+ ```
245
+
246
+ Defined in: [packages/utils/src/enhancedMap.ts:84](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L84)
247
+
248
+ ###### Type Parameters
249
+
250
+ ###### ObjKey
251
+
252
+ `ObjKey` *extends* `PropertyKey`
253
+
254
+ ###### ObjValue
255
+
256
+ `ObjValue`
257
+
258
+ ###### Parameters
259
+
260
+ ###### mapFunction
261
+
262
+ (`value`, `key`) => `false` \| \[`ObjKey`, `ObjValue`\]
263
+
264
+ ###### Returns
265
+
266
+ `Record`\<`ObjKey`, `ObjValue`\>
267
+
268
+ ##### toValues()
269
+
270
+ ```ts
271
+ toValues(): V[];
272
+ ```
273
+
274
+ Defined in: [packages/utils/src/enhancedMap.ts:100](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L100)
275
+
276
+ ###### Returns
277
+
278
+ `V`[]
279
+
280
+ ##### from()
281
+
282
+ ###### Call Signature
283
+
284
+ ```ts
285
+ static from<T, K>(array, key): EnhancedMap<T[K], T>;
286
+ ```
287
+
288
+ Defined in: [packages/utils/src/enhancedMap.ts:108](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L108)
289
+
290
+ ###### Type Parameters
291
+
292
+ ###### T
293
+
294
+ `T` *extends* `Record`\<`string`, `unknown`\>
295
+
296
+ ###### K
297
+
298
+ `K` *extends* `string` \| `number` \| `symbol`
299
+
300
+ ###### Parameters
301
+
302
+ ###### array
303
+
304
+ `undefined` | `null` | `Iterable`\<`T`, `any`, `any`\> | `T`[]
305
+
306
+ ###### key
307
+
308
+ `K`
309
+
310
+ ###### Returns
311
+
312
+ [`EnhancedMap`](#enhancedmap)\<`T`\[`K`\], `T`\>
313
+
314
+ ###### Call Signature
315
+
316
+ ```ts
317
+ static from<T, K, V>(array, mapFunction): EnhancedMap<K, V>;
318
+ ```
319
+
320
+ Defined in: [packages/utils/src/enhancedMap.ts:112](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L112)
321
+
322
+ ###### Type Parameters
323
+
324
+ ###### T
325
+
326
+ `T`
327
+
328
+ ###### K
329
+
330
+ `K`
331
+
332
+ ###### V
333
+
334
+ `V`
335
+
336
+ ###### Parameters
337
+
338
+ ###### array
339
+
340
+ `undefined` | `null` | `T`[] | `Iterable`\<`T`, `any`, `any`\>
341
+
342
+ ###### mapFunction
343
+
344
+ (`item`) => `false` \| \[`K`, `V`\]
345
+
346
+ ###### Returns
347
+
348
+ [`EnhancedMap`](#enhancedmap)\<`K`, `V`\>
349
+
350
+ ## Variables
351
+
352
+ ### enhancedMapReject
353
+
354
+ ```ts
355
+ const enhancedMapReject: typeof enhancedMapReject;
356
+ ```
357
+
358
+ Defined in: [packages/utils/src/enhancedMap.ts:3](https://github.com/lucasols/utils/blob/main/packages/utils/src/enhancedMap.ts#L3)
@@ -0,0 +1,39 @@
1
+ [**@ls-stack/utils**](../README.md)
2
+
3
+ ***
4
+
5
+ [@ls-stack/utils](../modules.md) / [exhaustiveMatch](README.md) / \<internal\>
6
+
7
+ # \<internal\>
8
+
9
+ ## Type Aliases
10
+
11
+ ### Pattern\<R\>
12
+
13
+ ```ts
14
+ type Pattern<R> = { [K in T]: (() => R) | "_nxt" | "_never" };
15
+ ```
16
+
17
+ Defined in: [packages/utils/src/exhaustiveMatch.ts:2](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L2)
18
+
19
+ #### Type Parameters
20
+
21
+ ##### R
22
+
23
+ `R`
24
+
25
+ ***
26
+
27
+ ### Pattern\<R\>
28
+
29
+ ```ts
30
+ type Pattern<R> = { [P in K]: ((props: Extract<T, Record<D, P>>) => R) | "_never" };
31
+ ```
32
+
33
+ Defined in: [packages/utils/src/exhaustiveMatch.ts:52](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L52)
34
+
35
+ #### Type Parameters
36
+
37
+ ##### R
38
+
39
+ `R`
@@ -0,0 +1,146 @@
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:47](https://github.com/lucasols/utils/blob/main/packages/utils/src/exhaustiveMatch.ts#L47)
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`
@@ -0,0 +1,93 @@
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
+ ```
@@ -0,0 +1,39 @@
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.
@@ -0,0 +1,57 @@
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.