@ls-stack/utils 3.40.0 → 3.42.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 (159) hide show
  1. package/dist/arrayUtils.d.cts +70 -57
  2. package/dist/arrayUtils.d.ts +70 -57
  3. package/dist/assertions.d.cts +128 -117
  4. package/dist/assertions.d.ts +128 -117
  5. package/dist/asyncQueue.cjs +117 -112
  6. package/dist/asyncQueue.d.cts +217 -215
  7. package/dist/asyncQueue.d.ts +217 -215
  8. package/dist/asyncQueue.js +117 -112
  9. package/dist/awaitDebounce.d.cts +26 -23
  10. package/dist/awaitDebounce.d.ts +26 -23
  11. package/dist/cache.cjs +2 -1
  12. package/dist/cache.d.cts +15 -9
  13. package/dist/cache.d.ts +15 -9
  14. package/dist/cache.js +2 -1
  15. package/dist/{chunk-ADM37GSC.js → chunk-7L4KCZJJ.js} +12 -10
  16. package/dist/{chunk-KW55OTUG.js → chunk-B3KFV2MH.js} +2 -2
  17. package/dist/chunk-GMJTLFM6.js +60 -0
  18. package/dist/{chunk-GHAQOUA6.js → chunk-Y45CE75W.js} +22 -1
  19. package/dist/concurrentCalls.d.cts +8 -4
  20. package/dist/concurrentCalls.d.ts +8 -4
  21. package/dist/concurrentCalls.js +1 -1
  22. package/dist/debounce.d.cts +12 -20
  23. package/dist/debounce.d.ts +12 -20
  24. package/dist/dedent.d.cts +31 -31
  25. package/dist/dedent.d.ts +31 -31
  26. package/dist/deepEqual.d.cts +10 -9
  27. package/dist/deepEqual.d.ts +10 -9
  28. package/dist/filterObjectOrArrayKeys.d.cts +44 -19
  29. package/dist/filterObjectOrArrayKeys.d.ts +44 -19
  30. package/dist/getAutoIncrementId.d.cts +25 -23
  31. package/dist/getAutoIncrementId.d.ts +25 -23
  32. package/dist/getCompositeKey.d.cts +2 -1
  33. package/dist/getCompositeKey.d.ts +2 -1
  34. package/dist/getValueStableKey.d.cts +4 -3
  35. package/dist/getValueStableKey.d.ts +4 -3
  36. package/dist/mutationUtils.d.cts +2 -2
  37. package/dist/mutationUtils.d.ts +2 -2
  38. package/dist/objUtils.cjs +51 -2
  39. package/dist/objUtils.d.cts +8 -3
  40. package/dist/objUtils.d.ts +8 -3
  41. package/dist/objUtils.js +11 -3
  42. package/dist/parallelAsyncCalls.cjs +2 -1
  43. package/dist/parallelAsyncCalls.d.cts +5 -4
  44. package/dist/parallelAsyncCalls.d.ts +5 -4
  45. package/dist/parallelAsyncCalls.js +2 -1
  46. package/dist/retryOnError.d.cts +23 -20
  47. package/dist/retryOnError.d.ts +23 -20
  48. package/dist/runShellCmd.d.cts +40 -40
  49. package/dist/runShellCmd.d.ts +40 -40
  50. package/dist/safeJson.d.cts +6 -2
  51. package/dist/safeJson.d.ts +6 -2
  52. package/dist/saferTyping.d.cts +21 -14
  53. package/dist/saferTyping.d.ts +21 -14
  54. package/dist/shallowEqual.d.cts +1 -1
  55. package/dist/shallowEqual.d.ts +1 -1
  56. package/dist/stringUtils.cjs +2 -2
  57. package/dist/stringUtils.d.cts +6 -7
  58. package/dist/stringUtils.d.ts +6 -7
  59. package/dist/stringUtils.js +1 -1
  60. package/dist/testUtils.cjs +11 -9
  61. package/dist/testUtils.d.cts +32 -14
  62. package/dist/testUtils.d.ts +32 -14
  63. package/dist/testUtils.js +4 -3
  64. package/dist/throttle.d.cts +57 -48
  65. package/dist/throttle.d.ts +57 -48
  66. package/dist/timers.d.cts +68 -63
  67. package/dist/timers.d.ts +68 -63
  68. package/dist/tsResult.d.cts +7 -6
  69. package/dist/tsResult.d.ts +7 -6
  70. package/dist/typeGuards.d.cts +65 -64
  71. package/dist/typeGuards.d.ts +65 -64
  72. package/dist/typeUtils.d.cts +18 -4
  73. package/dist/typeUtils.d.ts +18 -4
  74. package/dist/typedStrings.d.cts +68 -57
  75. package/dist/typedStrings.d.ts +68 -57
  76. package/dist/typingFnUtils.cjs +15 -0
  77. package/dist/typingFnUtils.d.cts +34 -7
  78. package/dist/typingFnUtils.d.ts +34 -7
  79. package/dist/typingFnUtils.js +18 -35
  80. package/dist/typingTestUtils.cjs +7 -1
  81. package/dist/typingTestUtils.d.cts +52 -11
  82. package/dist/typingTestUtils.d.ts +52 -11
  83. package/dist/typingTestUtils.js +7 -1
  84. package/dist/typingUtils.d.cts +4 -1
  85. package/dist/typingUtils.d.ts +4 -1
  86. package/dist/yamlStringify.cjs +11 -9
  87. package/dist/yamlStringify.js +2 -2
  88. package/package.json +5 -1
  89. package/docs/README.md +0 -72
  90. package/docs/_media/modules.md +0 -58
  91. package/docs/arrayUtils/-internal-.md +0 -179
  92. package/docs/arrayUtils/README.md +0 -550
  93. package/docs/assertions/-internal-.md +0 -63
  94. package/docs/assertions/README.md +0 -565
  95. package/docs/asyncQueue/-internal-.md +0 -297
  96. package/docs/asyncQueue/README.md +0 -1485
  97. package/docs/awaitDebounce.md +0 -66
  98. package/docs/cache/-internal-.md +0 -168
  99. package/docs/cache/README.md +0 -360
  100. package/docs/castValues.md +0 -47
  101. package/docs/concurrentCalls/-internal-.md +0 -490
  102. package/docs/concurrentCalls/README.md +0 -299
  103. package/docs/consoleFmt.md +0 -115
  104. package/docs/conversions.md +0 -27
  105. package/docs/createThrottleController/-internal-.md +0 -73
  106. package/docs/createThrottleController/README.md +0 -31
  107. package/docs/debounce.md +0 -188
  108. package/docs/dedent/-internal-.md +0 -17
  109. package/docs/dedent/README.md +0 -204
  110. package/docs/deepEqual.md +0 -94
  111. package/docs/enhancedMap.md +0 -358
  112. package/docs/exhaustiveMatch/-internal-.md +0 -39
  113. package/docs/exhaustiveMatch/README.md +0 -146
  114. package/docs/filterObjectOrArrayKeys.md +0 -109
  115. package/docs/getAutoIncrementId.md +0 -93
  116. package/docs/getCompositeKey.md +0 -39
  117. package/docs/getValueStableKey.md +0 -57
  118. package/docs/hash.md +0 -31
  119. package/docs/interpolate/-internal-.md +0 -61
  120. package/docs/interpolate/README.md +0 -62
  121. package/docs/keepPrevIfUnchanged.md +0 -43
  122. package/docs/levenshtein.md +0 -93
  123. package/docs/main.md +0 -21
  124. package/docs/mathUtils.md +0 -137
  125. package/docs/modules.md +0 -58
  126. package/docs/mutationUtils.md +0 -44
  127. package/docs/objUtils.md +0 -237
  128. package/docs/parallelAsyncCalls/-internal-.md +0 -347
  129. package/docs/parallelAsyncCalls/README.md +0 -45
  130. package/docs/promiseUtils/-internal-.md +0 -69
  131. package/docs/promiseUtils/README.md +0 -31
  132. package/docs/retryOnError/-internal-.md +0 -111
  133. package/docs/retryOnError/README.md +0 -168
  134. package/docs/runShellCmd/-internal-.md +0 -111
  135. package/docs/runShellCmd/README.md +0 -201
  136. package/docs/safeJson.md +0 -51
  137. package/docs/saferTyping.md +0 -228
  138. package/docs/serializeXML.md +0 -100
  139. package/docs/shallowEqual.md +0 -33
  140. package/docs/sleep.md +0 -27
  141. package/docs/stringUtils/-internal-.md +0 -17
  142. package/docs/stringUtils/README.md +0 -270
  143. package/docs/testUtils.md +0 -382
  144. package/docs/throttle/-internal-.md +0 -47
  145. package/docs/throttle/README.md +0 -178
  146. package/docs/time.md +0 -274
  147. package/docs/timers.md +0 -256
  148. package/docs/tsResult/-internal-.md +0 -327
  149. package/docs/tsResult/README.md +0 -702
  150. package/docs/typeGuards.md +0 -399
  151. package/docs/typeUtils/-internal-.md +0 -99
  152. package/docs/typeUtils/README.md +0 -195
  153. package/docs/typeUtils.typesTest.md +0 -7
  154. package/docs/typedStrings.md +0 -458
  155. package/docs/typingFnUtils/-internal-.md +0 -43
  156. package/docs/typingFnUtils/README.md +0 -317
  157. package/docs/typingTestUtils.md +0 -172
  158. package/docs/typingUtils.md +0 -135
  159. package/docs/yamlStringify.md +0 -83
@@ -0,0 +1,60 @@
1
+ // src/typingFnUtils.ts
2
+ function asNonPartial(obj) {
3
+ return obj;
4
+ }
5
+ function typedObjectEntries(obj) {
6
+ return Object.entries(obj);
7
+ }
8
+ function strictTypedObjectEntries(obj) {
9
+ return Object.entries(obj);
10
+ }
11
+ function typedObjectKeys(obj) {
12
+ return Object.keys(obj);
13
+ }
14
+ function asType(value) {
15
+ return value;
16
+ }
17
+ function narrowStringToUnion(key, union) {
18
+ if (!key) return void 0;
19
+ if (union instanceof Set) {
20
+ return union.has(key) ? key : void 0;
21
+ }
22
+ if (union.includes(key)) {
23
+ return key;
24
+ }
25
+ return void 0;
26
+ }
27
+ function typeOnRightExtendsLeftType() {
28
+ return void 0;
29
+ }
30
+ var isSubTypeOf = typeOnRightExtendsLeftType;
31
+ function isObjKey(key, obj) {
32
+ return typeof key === "string" && key in obj;
33
+ }
34
+ function unionsAreTheSame(_diff) {
35
+ }
36
+ function asPartialUndefinedValues(value) {
37
+ return value;
38
+ }
39
+ function isNonEmptyArray(array) {
40
+ return array.length > 0;
41
+ }
42
+ function objectHasKey(obj, key) {
43
+ return key in obj;
44
+ }
45
+
46
+ export {
47
+ asNonPartial,
48
+ typedObjectEntries,
49
+ strictTypedObjectEntries,
50
+ typedObjectKeys,
51
+ asType,
52
+ narrowStringToUnion,
53
+ typeOnRightExtendsLeftType,
54
+ isSubTypeOf,
55
+ isObjKey,
56
+ unionsAreTheSame,
57
+ asPartialUndefinedValues,
58
+ isNonEmptyArray,
59
+ objectHasKey
60
+ };
@@ -1,3 +1,10 @@
1
+ import {
2
+ typedObjectEntries
3
+ } from "./chunk-GMJTLFM6.js";
4
+ import {
5
+ sortBy
6
+ } from "./chunk-27AL66CH.js";
7
+
1
8
  // src/objUtils.ts
2
9
  function objectTypedEntries(obj) {
3
10
  return Object.entries(obj);
@@ -38,6 +45,18 @@ function rejectObjUndefinedValues(obj) {
38
45
  }
39
46
  return result;
40
47
  }
48
+ function filterObjectKeys(obj, predicate) {
49
+ return Object.fromEntries(
50
+ Object.entries(obj).filter(
51
+ ([key, value]) => predicate(key, value)
52
+ )
53
+ );
54
+ }
55
+ function sortObjectKeys(obj, sortByFn, options) {
56
+ return Object.fromEntries(
57
+ sortBy(typedObjectEntries(obj), sortByFn, options)
58
+ );
59
+ }
41
60
 
42
61
  export {
43
62
  objectTypedEntries,
@@ -46,5 +65,7 @@ export {
46
65
  mapObjectToObject,
47
66
  omit,
48
67
  looseGetObjectProperty,
49
- rejectObjUndefinedValues
68
+ rejectObjUndefinedValues,
69
+ filterObjectKeys,
70
+ sortObjectKeys
50
71
  };
@@ -58,7 +58,8 @@ declare class ConcurrentCalls<R = unknown, E extends ResultValidErrors = Error>
58
58
  }>;
59
59
  }
60
60
  /**
61
- * Executes multiple asynchronous calls concurrently and collects the results in a easier to use format.
61
+ * Executes multiple asynchronous calls concurrently and collects the results in
62
+ * a easier to use format.
62
63
  *
63
64
  * @template R - The type of the result value.
64
65
  */
@@ -88,7 +89,8 @@ declare class ConcurrentCallsWithMetadata<M extends ValidMetadata, R = unknown,
88
89
  }>;
89
90
  }
90
91
  /**
91
- * Executes multiple asynchronous calls concurrently with metadata for each call and collects the results in a easier to use format.
92
+ * Executes multiple asynchronous calls concurrently with metadata for each call
93
+ * and collects the results in a easier to use format.
92
94
  *
93
95
  * @template M - The type of the call metadata.
94
96
  * @template R - The type of the result value.
@@ -97,13 +99,15 @@ declare function concurrentCallsWithMetadata<M extends ValidMetadata, R = unknow
97
99
  type ValueFromResult<R> = R extends Result<infer T, any> ? T : never;
98
100
  type ErrorFromResult<R> = R extends Result<any, infer E> ? E : never;
99
101
  /**
100
- * Executes multiple asynchronous result calls concurrently and collects the results in a easier to use format.
102
+ * Executes multiple asynchronous result calls concurrently and collects the
103
+ * results in a easier to use format.
101
104
  *
102
105
  * @template R - The type of the result function that will be called.
103
106
  */
104
107
  declare function concurrentResultCalls<ResultFn extends (...args: any[]) => Promise<Result<unknown, ResultValidErrors>>>(): ConcurrentCalls<ValueFromResult<Awaited<ReturnType<ResultFn>>>, ErrorFromResult<Awaited<ReturnType<ResultFn>>>>;
105
108
  /**
106
- * Executes multiple asynchronous result calls concurrently with metadata for each call and collects the results in a easier to use format.
109
+ * Executes multiple asynchronous result calls concurrently with metadata for
110
+ * each call and collects the results in a easier to use format.
107
111
  *
108
112
  * @template ResultFn - The type of the result function that will be called.
109
113
  */
@@ -58,7 +58,8 @@ declare class ConcurrentCalls<R = unknown, E extends ResultValidErrors = Error>
58
58
  }>;
59
59
  }
60
60
  /**
61
- * Executes multiple asynchronous calls concurrently and collects the results in a easier to use format.
61
+ * Executes multiple asynchronous calls concurrently and collects the results in
62
+ * a easier to use format.
62
63
  *
63
64
  * @template R - The type of the result value.
64
65
  */
@@ -88,7 +89,8 @@ declare class ConcurrentCallsWithMetadata<M extends ValidMetadata, R = unknown,
88
89
  }>;
89
90
  }
90
91
  /**
91
- * Executes multiple asynchronous calls concurrently with metadata for each call and collects the results in a easier to use format.
92
+ * Executes multiple asynchronous calls concurrently with metadata for each call
93
+ * and collects the results in a easier to use format.
92
94
  *
93
95
  * @template M - The type of the call metadata.
94
96
  * @template R - The type of the result value.
@@ -97,13 +99,15 @@ declare function concurrentCallsWithMetadata<M extends ValidMetadata, R = unknow
97
99
  type ValueFromResult<R> = R extends Result<infer T, any> ? T : never;
98
100
  type ErrorFromResult<R> = R extends Result<any, infer E> ? E : never;
99
101
  /**
100
- * Executes multiple asynchronous result calls concurrently and collects the results in a easier to use format.
102
+ * Executes multiple asynchronous result calls concurrently and collects the
103
+ * results in a easier to use format.
101
104
  *
102
105
  * @template R - The type of the result function that will be called.
103
106
  */
104
107
  declare function concurrentResultCalls<ResultFn extends (...args: any[]) => Promise<Result<unknown, ResultValidErrors>>>(): ConcurrentCalls<ValueFromResult<Awaited<ReturnType<ResultFn>>>, ErrorFromResult<Awaited<ReturnType<ResultFn>>>>;
105
108
  /**
106
- * Executes multiple asynchronous result calls concurrently with metadata for each call and collects the results in a easier to use format.
109
+ * Executes multiple asynchronous result calls concurrently with metadata for
110
+ * each call and collects the results in a easier to use format.
107
111
  *
108
112
  * @template ResultFn - The type of the result function that will be called.
109
113
  */
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  truncateString
3
- } from "./chunk-KW55OTUG.js";
3
+ } from "./chunk-B3KFV2MH.js";
4
4
  import {
5
5
  sleep
6
6
  } from "./chunk-5DZT3Z5Z.js";
@@ -1,38 +1,30 @@
1
1
  type DebounceOptions = {
2
- /**
3
- * @see _.leading
4
- */
2
+ /** @see _.leading */
5
3
  leading?: boolean;
6
- /**
7
- * @see _.maxWait
8
- */
4
+ /** @see _.maxWait */
9
5
  maxWait?: number;
10
- /**
11
- * @see _.trailing
12
- */
6
+ /** @see _.trailing */
13
7
  trailing?: boolean;
14
8
  };
15
9
  interface DebouncedFunc<T extends (...args: any[]) => void> {
16
10
  /**
17
11
  * Call the original function, but applying the debounce rules.
18
12
  *
19
- * If the debounced function can be run immediately, this calls it and returns its return
20
- * value.
13
+ * If the debounced function can be run immediately, this calls it and returns
14
+ * its return value.
21
15
  *
22
- * Otherwise, it returns the return value of the last invocation, or undefined if the debounced
23
- * function was not invoked yet.
16
+ * Otherwise, it returns the return value of the last invocation, or undefined
17
+ * if the debounced function was not invoked yet.
24
18
  */
25
19
  (...args: Parameters<T>): ReturnType<T> | undefined;
26
- /**
27
- * Throw away any pending invocation of the debounced function.
28
- */
20
+ /** Throw away any pending invocation of the debounced function. */
29
21
  cancel: () => void;
30
22
  /**
31
- * If there is a pending invocation of the debounced function, invoke it immediately and return
32
- * its return value.
23
+ * If there is a pending invocation of the debounced function, invoke it
24
+ * immediately and return its return value.
33
25
  *
34
- * Otherwise, return the value from the last invocation, or undefined if the debounced function
35
- * was never invoked.
26
+ * Otherwise, return the value from the last invocation, or undefined if the
27
+ * debounced function was never invoked.
36
28
  */
37
29
  flush: () => ReturnType<T> | undefined;
38
30
  }
@@ -1,38 +1,30 @@
1
1
  type DebounceOptions = {
2
- /**
3
- * @see _.leading
4
- */
2
+ /** @see _.leading */
5
3
  leading?: boolean;
6
- /**
7
- * @see _.maxWait
8
- */
4
+ /** @see _.maxWait */
9
5
  maxWait?: number;
10
- /**
11
- * @see _.trailing
12
- */
6
+ /** @see _.trailing */
13
7
  trailing?: boolean;
14
8
  };
15
9
  interface DebouncedFunc<T extends (...args: any[]) => void> {
16
10
  /**
17
11
  * Call the original function, but applying the debounce rules.
18
12
  *
19
- * If the debounced function can be run immediately, this calls it and returns its return
20
- * value.
13
+ * If the debounced function can be run immediately, this calls it and returns
14
+ * its return value.
21
15
  *
22
- * Otherwise, it returns the return value of the last invocation, or undefined if the debounced
23
- * function was not invoked yet.
16
+ * Otherwise, it returns the return value of the last invocation, or undefined
17
+ * if the debounced function was not invoked yet.
24
18
  */
25
19
  (...args: Parameters<T>): ReturnType<T> | undefined;
26
- /**
27
- * Throw away any pending invocation of the debounced function.
28
- */
20
+ /** Throw away any pending invocation of the debounced function. */
29
21
  cancel: () => void;
30
22
  /**
31
- * If there is a pending invocation of the debounced function, invoke it immediately and return
32
- * its return value.
23
+ * If there is a pending invocation of the debounced function, invoke it
24
+ * immediately and return its return value.
33
25
  *
34
- * Otherwise, return the value from the last invocation, or undefined if the debounced function
35
- * was never invoked.
26
+ * Otherwise, return the value from the last invocation, or undefined if the
27
+ * debounced function was never invoked.
36
28
  */
37
29
  flush: () => ReturnType<T> | undefined;
38
30
  }
package/dist/dedent.d.cts CHANGED
@@ -1,72 +1,72 @@
1
- /**
2
- * Configuration options for the dedent function behavior
3
- */
1
+ /** Configuration options for the dedent function behavior */
4
2
  interface DedentOptions {
5
3
  /**
6
- * Whether to process escape sequences like \n, \`, \$, and \{
7
- * When true, allows using escaped characters in template literals
4
+ * Whether to process escape sequences like \n, `, $, and { When true, allows
5
+ * using escaped characters in template literals
6
+ *
8
7
  * @default true for template literals, false for plain strings
9
8
  */
10
9
  escapeSpecialCharacters?: boolean;
11
10
  /**
12
11
  * Whether to trim leading and trailing whitespace from the final result
12
+ *
13
13
  * @default true
14
14
  */
15
15
  trimWhitespace?: boolean;
16
16
  /**
17
17
  * Whether to preserve relative indentation of interpolated multi-line values
18
- * When true, multi-line interpolations are re-indented to match the surrounding context
18
+ * When true, multi-line interpolations are re-indented to match the
19
+ * surrounding context
20
+ *
19
21
  * @default true
20
22
  */
21
23
  identInterpolations?: boolean;
22
24
  /**
23
- * Whether to display nullish or false values (false, null, undefined) in interpolations
24
- * When false, nullish or false values are skipped entirely
25
+ * Whether to display nullish or false values (false, null, undefined) in
26
+ * interpolations When false, nullish or false values are skipped entirely
27
+ *
25
28
  * @default false
26
29
  */
27
30
  showNullishOrFalseValues?: boolean;
28
31
  }
29
32
  type InterpolationValue = string | number | boolean | null | undefined;
30
33
  /**
31
- * Dedent function interface that can be used both as a template tag and a regular function
34
+ * Dedent function interface that can be used both as a template tag and a
35
+ * regular function
32
36
  */
33
37
  interface Dedent {
34
- /**
35
- * Process a plain string to remove common indentation
36
- */
38
+ /** Process a plain string to remove common indentation */
37
39
  (literals: string): string;
38
40
  /**
39
- * Process a template literal to remove common indentation while handling interpolations
41
+ * Process a template literal to remove common indentation while handling
42
+ * interpolations
40
43
  */
41
44
  (strings: TemplateStringsArray, ...values: InterpolationValue[]): string;
42
- /**
43
- * Create a new dedent function with custom options
44
- */
45
+ /** Create a new dedent function with custom options */
45
46
  withOptions: CreateDedent;
46
47
  }
47
- /**
48
- * Factory function type for creating dedent functions with custom options
49
- */
48
+ /** Factory function type for creating dedent functions with custom options */
50
49
  type CreateDedent = (options: DedentOptions) => Dedent;
51
50
  /**
52
- * Remove common leading indentation from multi-line strings while preserving relative indentation.
53
- * Can be used as a tagged template literal or called with a plain string.
51
+ * Remove common leading indentation from multi-line strings while preserving
52
+ * relative indentation. Can be used as a tagged template literal or called with
53
+ * a plain string.
54
54
  *
55
- * By default, it will dedent interpolated multi-line strings to match the surrounding context.
56
- * And it will not show falsy values.
55
+ * By default, it will dedent interpolated multi-line strings to match the
56
+ * surrounding context. And it will not show falsy values.
57
57
  *
58
58
  * @example
59
- * ```typescript
60
- * const text = dedent`
59
+ * ```typescript
60
+ * const text = dedent`;
61
61
  * function hello() {
62
62
  * console.log('world');
63
63
  * }
64
- * `;
65
- * // Result:
66
- * "function hello() {
67
- * console.log('world');
68
- * }"
69
- * ```
64
+ * `;
65
+ * // Result:
66
+ * "function hello() {
67
+ * console.log('world');
68
+ * }"
69
+ * ```;
70
70
  */
71
71
  declare const dedent: Dedent;
72
72
 
package/dist/dedent.d.ts CHANGED
@@ -1,72 +1,72 @@
1
- /**
2
- * Configuration options for the dedent function behavior
3
- */
1
+ /** Configuration options for the dedent function behavior */
4
2
  interface DedentOptions {
5
3
  /**
6
- * Whether to process escape sequences like \n, \`, \$, and \{
7
- * When true, allows using escaped characters in template literals
4
+ * Whether to process escape sequences like \n, `, $, and { When true, allows
5
+ * using escaped characters in template literals
6
+ *
8
7
  * @default true for template literals, false for plain strings
9
8
  */
10
9
  escapeSpecialCharacters?: boolean;
11
10
  /**
12
11
  * Whether to trim leading and trailing whitespace from the final result
12
+ *
13
13
  * @default true
14
14
  */
15
15
  trimWhitespace?: boolean;
16
16
  /**
17
17
  * Whether to preserve relative indentation of interpolated multi-line values
18
- * When true, multi-line interpolations are re-indented to match the surrounding context
18
+ * When true, multi-line interpolations are re-indented to match the
19
+ * surrounding context
20
+ *
19
21
  * @default true
20
22
  */
21
23
  identInterpolations?: boolean;
22
24
  /**
23
- * Whether to display nullish or false values (false, null, undefined) in interpolations
24
- * When false, nullish or false values are skipped entirely
25
+ * Whether to display nullish or false values (false, null, undefined) in
26
+ * interpolations When false, nullish or false values are skipped entirely
27
+ *
25
28
  * @default false
26
29
  */
27
30
  showNullishOrFalseValues?: boolean;
28
31
  }
29
32
  type InterpolationValue = string | number | boolean | null | undefined;
30
33
  /**
31
- * Dedent function interface that can be used both as a template tag and a regular function
34
+ * Dedent function interface that can be used both as a template tag and a
35
+ * regular function
32
36
  */
33
37
  interface Dedent {
34
- /**
35
- * Process a plain string to remove common indentation
36
- */
38
+ /** Process a plain string to remove common indentation */
37
39
  (literals: string): string;
38
40
  /**
39
- * Process a template literal to remove common indentation while handling interpolations
41
+ * Process a template literal to remove common indentation while handling
42
+ * interpolations
40
43
  */
41
44
  (strings: TemplateStringsArray, ...values: InterpolationValue[]): string;
42
- /**
43
- * Create a new dedent function with custom options
44
- */
45
+ /** Create a new dedent function with custom options */
45
46
  withOptions: CreateDedent;
46
47
  }
47
- /**
48
- * Factory function type for creating dedent functions with custom options
49
- */
48
+ /** Factory function type for creating dedent functions with custom options */
50
49
  type CreateDedent = (options: DedentOptions) => Dedent;
51
50
  /**
52
- * Remove common leading indentation from multi-line strings while preserving relative indentation.
53
- * Can be used as a tagged template literal or called with a plain string.
51
+ * Remove common leading indentation from multi-line strings while preserving
52
+ * relative indentation. Can be used as a tagged template literal or called with
53
+ * a plain string.
54
54
  *
55
- * By default, it will dedent interpolated multi-line strings to match the surrounding context.
56
- * And it will not show falsy values.
55
+ * By default, it will dedent interpolated multi-line strings to match the
56
+ * surrounding context. And it will not show falsy values.
57
57
  *
58
58
  * @example
59
- * ```typescript
60
- * const text = dedent`
59
+ * ```typescript
60
+ * const text = dedent`;
61
61
  * function hello() {
62
62
  * console.log('world');
63
63
  * }
64
- * `;
65
- * // Result:
66
- * "function hello() {
67
- * console.log('world');
68
- * }"
69
- * ```
64
+ * `;
65
+ * // Result:
66
+ * "function hello() {
67
+ * console.log('world');
68
+ * }"
69
+ * ```;
70
70
  */
71
71
  declare const dedent: Dedent;
72
72
 
@@ -1,18 +1,19 @@
1
1
  /**
2
2
  * Deep equality comparison between two values
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * deepEqual({a: 1}, {a: 1}) // true
7
+ * deepEqual({a: 1}, {a: 2}) // false
8
+ * deepEqual([1, {b: 2}], [1, {b: 2}]) // true
9
+ * deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
10
+ * deepEqual(new Set([1, 2]), new Set([1, 2])) // true
11
+ * ```;
12
+ *
3
13
  * @param foo First value to compare
4
14
  * @param bar Second value to compare
5
15
  * @param maxDepth Maximum comparison depth (default: 20)
6
16
  * @returns True if values are deeply equal, false otherwise
7
- *
8
- * @example
9
- * ```ts
10
- * deepEqual({a: 1}, {a: 1}) // true
11
- * deepEqual({a: 1}, {a: 2}) // false
12
- * deepEqual([1, {b: 2}], [1, {b: 2}]) // true
13
- * deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
14
- * deepEqual(new Set([1, 2]), new Set([1, 2])) // true
15
- * ```
16
17
  */
17
18
  declare function deepEqual(foo: any, bar: any, maxDepth?: number): boolean;
18
19
  declare function deepEqualWithMaxDepth(maxDepth: number): (foo: any, bar: any) => boolean;
@@ -1,18 +1,19 @@
1
1
  /**
2
2
  * Deep equality comparison between two values
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * deepEqual({a: 1}, {a: 1}) // true
7
+ * deepEqual({a: 1}, {a: 2}) // false
8
+ * deepEqual([1, {b: 2}], [1, {b: 2}]) // true
9
+ * deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
10
+ * deepEqual(new Set([1, 2]), new Set([1, 2])) // true
11
+ * ```;
12
+ *
3
13
  * @param foo First value to compare
4
14
  * @param bar Second value to compare
5
15
  * @param maxDepth Maximum comparison depth (default: 20)
6
16
  * @returns True if values are deeply equal, false otherwise
7
- *
8
- * @example
9
- * ```ts
10
- * deepEqual({a: 1}, {a: 1}) // true
11
- * deepEqual({a: 1}, {a: 2}) // false
12
- * deepEqual([1, {b: 2}], [1, {b: 2}]) // true
13
- * deepEqual(new Map([['a', 1]]), new Map([['a', 1]])) // true
14
- * deepEqual(new Set([1, 2]), new Set([1, 2])) // true
15
- * ```
16
17
  */
17
18
  declare function deepEqual(foo: any, bar: any, maxDepth?: number): boolean;
18
19
  declare function deepEqualWithMaxDepth(maxDepth: number): (foo: any, bar: any) => boolean;
@@ -2,22 +2,27 @@
2
2
  * Filters the keys of an object based on the provided patterns.
3
3
  *
4
4
  * Filtering patterns in `rejectKeys` and `filterKeys`:
5
+ *
5
6
  * - `'prop'` - Only root-level properties named 'prop'
6
7
  * - `'**prop'` - Any property named exactly 'prop' at any level (root or nested)
7
- * - `'*.prop'` - Any nested property named 'prop' at second level (excludes root-level matches)
8
+ * - `'*.prop'` - Any nested property named 'prop' at second level (excludes
9
+ * root-level matches)
8
10
  * - `'test.*.prop'` - Any property named 'prop' at second level of 'test'
9
11
  * - `'test.*.test.**prop'` - Any property named 'prop' inside of 'test.*.test'
10
12
  * - `'prop.nested'` - Exact nested property paths like `obj.prop.nested`
11
- * - `'prop.**nested'` - All nested properties inside root `prop` with name `nested`
13
+ * - `'prop.**nested'` - All nested properties inside root `prop` with name
14
+ * `nested`
12
15
  * - `'prop[0]'` - The first item of the `prop` array
13
16
  * - `'prop[*]'` - All items of the `prop` array
14
17
  * - `'prop[0].nested'` - `nested` prop of the first item of the `prop` array
15
18
  * - `'prop[*].nested'` - `nested` prop of all items of the `prop` array
16
19
  * - `'prop[*]**nested'` - all `nested` props of all items of the `prop` array
17
20
  * - `'prop[0-2]'` - The first three items of the `prop` array
18
- * - `'prop[4-*]'` - All items of the `prop` array from the fourth index to the end
21
+ * - `'prop[4-*]'` - All items of the `prop` array from the fourth index to the
22
+ * end
19
23
  * - `'prop[0-2].nested.**prop'` - Combining multiple nested patterns is supported
20
24
  * - Root array:
25
+ *
21
26
  * - `'[0]'` - The first item of the root array
22
27
  * - `'[*]'` - All items of the array
23
28
  * - `'[0].nested'` - `nested` prop of the first item of the array
@@ -26,30 +31,50 @@
26
31
  * - `'[0-2]'` - The first three items of the array
27
32
  * - `'[4-*]'` - All items of the array from the fourth index to the end
28
33
  * - Pattern expansion with parentheses:
29
- * - `'prop.test.(prop1|prop2|prop3)'` - Expands to `prop.test.prop1`, `prop.test.prop2`, and `prop.test.prop3`
30
- * - `'components[*].(table_id|columns|filters[*].value)'` - Expands to `components[*].table_id`, `components[*].columns`, and `components[*].filters[*].value`
34
+ *
35
+ * - `'prop.test.(prop1|prop2|prop3)'` - Expands to `prop.test.prop1`,
36
+ * `prop.test.prop2`, and `prop.test.prop3`
37
+ * - `'components[*].(table_id|columns|filters[*].value)'` - Expands to
38
+ * `components[*].table_id`, `components[*].columns`, and
39
+ * `components[*].filters[*].value`
31
40
  * - `'(users|admins)[*].name'` - Expands to `users[*].name` and `admins[*].name`
32
41
  * - Array filtering by value:
33
- * - `'users[%name="John"]'` - Filters the `users` with the `name` property equal to `John`
34
- * - `'users[%name="John" | "Jane"]'` - Value-level OR using `|` for multiple values of same property
35
- * - `'users[%name="Alice" || %age=35]'` - Property-level OR using `||` for different properties
36
- * - `'users[%age=30 && %role="admin"]'` - Property-level AND using `&&` for different properties
37
- * - Note: Mixing `&&` and `||` in the same filter is not supported - use separate filter patterns instead
42
+ *
43
+ * - `'users[%name="John"]'` - Filters the `users` with the `name` property equal
44
+ * to `John`
45
+ * - `'users[%name="John" | "Jane"]'` - Value-level OR using `|` for multiple
46
+ * values of same property
47
+ * - `'users[%name="Alice" || %age=35]'` - Property-level OR using `||` for
48
+ * different properties
49
+ * - `'users[%age=30 && %role="admin"]'` - Property-level AND using `&&` for
50
+ * different properties
51
+ * - Note: Mixing `&&` and `||` in the same filter is not supported - use separate
52
+ * filter patterns instead
38
53
  * - `'users[%config.name="John" | "Jane"]'` - Dot notation is supported
39
- * - `'users[%name*="oh"]'` - Contains operator (*=) - filters users where name contains "oh"
40
- * - `'users[%name^="Jo"]'` - Starts with operator (^=) - filters users where name starts with "Jo"
41
- * - `'users[%name$="hn"]'` - Ends with operator ($=) - filters users where name ends with "hn"
42
- * - `'users[%name!="John"]'` - Not equal operator (!=) - filters users where name is not "John"
43
- * - `'users[%name!*="admin"]'` - Not contains operator (!*=) - filters users where name doesn't contain "admin"
44
- * - `'users[i%name="john"]'` - Case-insensitive matching (i% prefix) - matches "John", "JOHN", "john", etc.
54
+ * - `'users[%name*="oh"]'` - Contains operator (*=) - filters users where name
55
+ * contains "oh"
56
+ * - `'users[%name^="Jo"]'` - Starts with operator (^=) - filters users where name
57
+ * starts with "Jo"
58
+ * - `'users[%name$="hn"]'` - Ends with operator ($=) - filters users where name
59
+ * ends with "hn"
60
+ * - `'users[%name!="John"]'` - Not equal operator (!=) - filters users where name
61
+ * is not "John"
62
+ * - `'users[%name!*="admin"]'` - Not contains operator (!*=) - filters users
63
+ * where name doesn't contain "admin"
64
+ * - `'users[i%name="john"]'` - Case-insensitive matching (i% prefix) - matches
65
+ * "John", "JOHN", "john", etc.
45
66
  *
46
67
  * @param objOrArray - The object or array to filter.
47
68
  * @param options - The options for the filter.
48
69
  * @param options.filterKeys - The keys to filter.
49
70
  * @param options.rejectKeys - The keys to reject.
50
- * @param options.rejectEmptyObjectsInArray - Whether to reject empty objects in arrays (default: true).
51
- * @param options.sortKeys - Sort all keys by a specific order (optional, preserves original order when not specified).
52
- * @param options.sortPatterns - Sort specific keys by pattern. Use to control the order of specific properties. The same patterns as `filterKeys` are supported.
71
+ * @param options.rejectEmptyObjectsInArray - Whether to reject empty objects in
72
+ * arrays (default: true).
73
+ * @param options.sortKeys - Sort all keys by a specific order (optional,
74
+ * preserves original order when not specified).
75
+ * @param options.sortPatterns - Sort specific keys by pattern. Use to control
76
+ * the order of specific properties. The same patterns as `filterKeys` are
77
+ * supported.
53
78
  * @returns The filtered object or array.
54
79
  */
55
80
  declare function filterObjectOrArrayKeys(objOrArray: Record<string, any> | Record<string, any>[], { filterKeys, rejectKeys, rejectEmptyObjectsInArray, sortKeys, sortPatterns, }: {