@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.
Files changed (162) 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-GHAQOUA6.js → chunk-23KPGKDT.js} +22 -1
  16. package/dist/{chunk-ADM37GSC.js → chunk-7L4KCZJJ.js} +12 -10
  17. package/dist/{chunk-KW55OTUG.js → chunk-B3KFV2MH.js} +2 -2
  18. package/dist/chunk-DTE2QMWE.js +48 -0
  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/consoleFmt.cjs +1 -0
  23. package/dist/consoleFmt.d.cts +6 -0
  24. package/dist/consoleFmt.d.ts +6 -0
  25. package/dist/consoleFmt.js +1 -0
  26. package/dist/debounce.d.cts +12 -20
  27. package/dist/debounce.d.ts +12 -20
  28. package/dist/dedent.d.cts +31 -31
  29. package/dist/dedent.d.ts +31 -31
  30. package/dist/deepEqual.d.cts +10 -9
  31. package/dist/deepEqual.d.ts +10 -9
  32. package/dist/filterObjectOrArrayKeys.d.cts +44 -19
  33. package/dist/filterObjectOrArrayKeys.d.ts +44 -19
  34. package/dist/getAutoIncrementId.d.cts +25 -23
  35. package/dist/getAutoIncrementId.d.ts +25 -23
  36. package/dist/getCompositeKey.d.cts +2 -1
  37. package/dist/getCompositeKey.d.ts +2 -1
  38. package/dist/getValueStableKey.d.cts +4 -3
  39. package/dist/getValueStableKey.d.ts +4 -3
  40. package/dist/mutationUtils.d.cts +2 -2
  41. package/dist/mutationUtils.d.ts +2 -2
  42. package/dist/objUtils.cjs +51 -2
  43. package/dist/objUtils.d.cts +8 -3
  44. package/dist/objUtils.d.ts +8 -3
  45. package/dist/objUtils.js +11 -3
  46. package/dist/parallelAsyncCalls.cjs +2 -1
  47. package/dist/parallelAsyncCalls.d.cts +5 -4
  48. package/dist/parallelAsyncCalls.d.ts +5 -4
  49. package/dist/parallelAsyncCalls.js +2 -1
  50. package/dist/retryOnError.d.cts +23 -20
  51. package/dist/retryOnError.d.ts +23 -20
  52. package/dist/runShellCmd.d.cts +40 -40
  53. package/dist/runShellCmd.d.ts +40 -40
  54. package/dist/safeJson.d.cts +6 -2
  55. package/dist/safeJson.d.ts +6 -2
  56. package/dist/saferTyping.d.cts +21 -14
  57. package/dist/saferTyping.d.ts +21 -14
  58. package/dist/shallowEqual.d.cts +1 -1
  59. package/dist/shallowEqual.d.ts +1 -1
  60. package/dist/stringUtils.cjs +2 -2
  61. package/dist/stringUtils.d.cts +6 -7
  62. package/dist/stringUtils.d.ts +6 -7
  63. package/dist/stringUtils.js +1 -1
  64. package/dist/testUtils.cjs +11 -9
  65. package/dist/testUtils.d.cts +32 -14
  66. package/dist/testUtils.d.ts +32 -14
  67. package/dist/testUtils.js +4 -3
  68. package/dist/throttle.d.cts +57 -48
  69. package/dist/throttle.d.ts +57 -48
  70. package/dist/timers.d.cts +68 -63
  71. package/dist/timers.d.ts +68 -63
  72. package/dist/tsResult.d.cts +7 -6
  73. package/dist/tsResult.d.ts +7 -6
  74. package/dist/typeGuards.d.cts +65 -64
  75. package/dist/typeGuards.d.ts +65 -64
  76. package/dist/typeUtils.d.cts +18 -4
  77. package/dist/typeUtils.d.ts +18 -4
  78. package/dist/typedStrings.d.cts +68 -57
  79. package/dist/typedStrings.d.ts +68 -57
  80. package/dist/typingFnUtils.d.cts +12 -6
  81. package/dist/typingFnUtils.d.ts +12 -6
  82. package/dist/typingFnUtils.js +12 -35
  83. package/dist/typingTestUtils.cjs +7 -1
  84. package/dist/typingTestUtils.d.cts +52 -11
  85. package/dist/typingTestUtils.d.ts +52 -11
  86. package/dist/typingTestUtils.js +7 -1
  87. package/dist/typingUtils.d.cts +4 -1
  88. package/dist/typingUtils.d.ts +4 -1
  89. package/dist/yamlStringify.cjs +11 -9
  90. package/dist/yamlStringify.js +2 -2
  91. package/package.json +6 -2
  92. package/docs/README.md +0 -72
  93. package/docs/_media/modules.md +0 -58
  94. package/docs/arrayUtils/-internal-.md +0 -179
  95. package/docs/arrayUtils/README.md +0 -550
  96. package/docs/assertions/-internal-.md +0 -63
  97. package/docs/assertions/README.md +0 -565
  98. package/docs/asyncQueue/-internal-.md +0 -297
  99. package/docs/asyncQueue/README.md +0 -1485
  100. package/docs/awaitDebounce.md +0 -66
  101. package/docs/cache/-internal-.md +0 -168
  102. package/docs/cache/README.md +0 -360
  103. package/docs/castValues.md +0 -47
  104. package/docs/concurrentCalls/-internal-.md +0 -490
  105. package/docs/concurrentCalls/README.md +0 -299
  106. package/docs/consoleFmt.md +0 -91
  107. package/docs/conversions.md +0 -27
  108. package/docs/createThrottleController/-internal-.md +0 -73
  109. package/docs/createThrottleController/README.md +0 -31
  110. package/docs/debounce.md +0 -188
  111. package/docs/dedent/-internal-.md +0 -17
  112. package/docs/dedent/README.md +0 -204
  113. package/docs/deepEqual.md +0 -94
  114. package/docs/enhancedMap.md +0 -358
  115. package/docs/exhaustiveMatch/-internal-.md +0 -39
  116. package/docs/exhaustiveMatch/README.md +0 -146
  117. package/docs/filterObjectOrArrayKeys.md +0 -109
  118. package/docs/getAutoIncrementId.md +0 -93
  119. package/docs/getCompositeKey.md +0 -39
  120. package/docs/getValueStableKey.md +0 -57
  121. package/docs/hash.md +0 -31
  122. package/docs/interpolate/-internal-.md +0 -61
  123. package/docs/interpolate/README.md +0 -62
  124. package/docs/keepPrevIfUnchanged.md +0 -43
  125. package/docs/levenshtein.md +0 -93
  126. package/docs/main.md +0 -21
  127. package/docs/mathUtils.md +0 -137
  128. package/docs/modules.md +0 -58
  129. package/docs/mutationUtils.md +0 -44
  130. package/docs/objUtils.md +0 -237
  131. package/docs/parallelAsyncCalls/-internal-.md +0 -347
  132. package/docs/parallelAsyncCalls/README.md +0 -45
  133. package/docs/promiseUtils/-internal-.md +0 -69
  134. package/docs/promiseUtils/README.md +0 -31
  135. package/docs/retryOnError/-internal-.md +0 -111
  136. package/docs/retryOnError/README.md +0 -168
  137. package/docs/runShellCmd/-internal-.md +0 -111
  138. package/docs/runShellCmd/README.md +0 -201
  139. package/docs/safeJson.md +0 -51
  140. package/docs/saferTyping.md +0 -228
  141. package/docs/serializeXML.md +0 -100
  142. package/docs/shallowEqual.md +0 -33
  143. package/docs/sleep.md +0 -27
  144. package/docs/stringUtils/-internal-.md +0 -17
  145. package/docs/stringUtils/README.md +0 -270
  146. package/docs/testUtils.md +0 -382
  147. package/docs/throttle/-internal-.md +0 -47
  148. package/docs/throttle/README.md +0 -178
  149. package/docs/time.md +0 -274
  150. package/docs/timers.md +0 -256
  151. package/docs/tsResult/-internal-.md +0 -327
  152. package/docs/tsResult/README.md +0 -702
  153. package/docs/typeGuards.md +0 -399
  154. package/docs/typeUtils/-internal-.md +0 -99
  155. package/docs/typeUtils/README.md +0 -195
  156. package/docs/typeUtils.typesTest.md +0 -7
  157. package/docs/typedStrings.md +0 -458
  158. package/docs/typingFnUtils/-internal-.md +0 -43
  159. package/docs/typingFnUtils/README.md +0 -317
  160. package/docs/typingTestUtils.md +0 -172
  161. package/docs/typingUtils.md +0 -135
  162. package/docs/yamlStringify.md +0 -83
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-IATIXMCE.js";
4
4
  import {
5
5
  truncateString
6
- } from "./chunk-KW55OTUG.js";
6
+ } from "./chunk-B3KFV2MH.js";
7
7
  import {
8
8
  isObject,
9
9
  isPlainObject
@@ -34,14 +34,12 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
34
34
  const entries = Object.entries(value).filter(
35
35
  ([, val]) => val !== void 0 || showUndefined
36
36
  );
37
- const isSimpleObject = entries.every(
38
- ([, val]) => {
39
- if (typeof val === "string") {
40
- return !val.includes("'") && !val.includes('"') && !val.includes("\\");
41
- }
42
- return typeof val === "number" || typeof val === "boolean" || val === null || val === void 0;
37
+ const isSimpleObject = entries.every(([, val]) => {
38
+ if (typeof val === "string") {
39
+ return !val.includes("'") && !val.includes('"') && !val.includes("\\");
43
40
  }
44
- );
41
+ return typeof val === "number" || typeof val === "boolean" || val === null || val === void 0;
42
+ });
45
43
  const shouldCollapse = isArrayItem ? entries.length > 1 : entries.length > 0;
46
44
  if (isSimpleObject && shouldCollapse) {
47
45
  let line = "{ ";
@@ -94,7 +92,9 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
94
92
  false
95
93
  );
96
94
  const willBeCollapsed = isObject(objVal) && (Object.keys(objVal).length === 0 || collapseObjects && depth + 1 > 0 && (() => {
97
- const filteredEntries = Object.entries(objVal).filter(([, val]) => val !== void 0 || showUndefined);
95
+ const filteredEntries = Object.entries(objVal).filter(
96
+ ([, val]) => val !== void 0 || showUndefined
97
+ );
98
98
  const shouldCollapseThis = isArrayItem ? filteredEntries.length > 1 : filteredEntries.length > 0;
99
99
  return shouldCollapseThis && filteredEntries.every(([, val]) => {
100
100
  if (typeof val === "string") {
@@ -104,7 +104,9 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
104
104
  });
105
105
  })());
106
106
  const prevWasCollapsed = prevValue && isObject(prevValue) && (Object.keys(prevValue).length === 0 || collapseObjects && depth + 1 > 0 && (() => {
107
- const filteredEntries = Object.entries(prevValue).filter(([, val]) => val !== void 0 || showUndefined);
107
+ const filteredEntries = Object.entries(prevValue).filter(
108
+ ([, val]) => val !== void 0 || showUndefined
109
+ );
108
110
  const shouldCollapseThis = isArrayItem ? filteredEntries.length > 1 : filteredEntries.length > 0;
109
111
  return shouldCollapseThis && filteredEntries.every(([, val]) => {
110
112
  if (typeof val === "string") {
@@ -33,10 +33,10 @@ function convertToCamelCase(str) {
33
33
  return pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1);
34
34
  }
35
35
  function convertToSentenceCase(str) {
36
- return str.split(/[\s_-]+/).map((word) => word.toLowerCase()).join(" ").replace(/^\w/, (char) => char.toUpperCase());
36
+ return str.replace(/[\s\-.]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((word) => word.toLowerCase()).join(" ").replace(/^\w/, (char) => char.toUpperCase());
37
37
  }
38
38
  function convertToTitleCase(str) {
39
- return str.split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
39
+ return str.replace(/[\s\-.]+/g, " ").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z])([A-Z][a-z])/g, "$1 $2").split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
40
40
  }
41
41
  function truncateString(str, length, ellipsis = "\u2026") {
42
42
  if (str.length <= length) return str;
@@ -0,0 +1,48 @@
1
+ // src/typingFnUtils.ts
2
+ function asNonPartial(obj) {
3
+ return obj;
4
+ }
5
+ function typedObjectEntries(obj) {
6
+ return Object.entries(obj);
7
+ }
8
+ function typedObjectKeys(obj) {
9
+ return Object.keys(obj);
10
+ }
11
+ function asType(value) {
12
+ return value;
13
+ }
14
+ function narrowStringToUnion(key, union) {
15
+ if (!key) return void 0;
16
+ if (union instanceof Set) {
17
+ return union.has(key) ? key : void 0;
18
+ }
19
+ if (union.includes(key)) {
20
+ return key;
21
+ }
22
+ return void 0;
23
+ }
24
+ function typeOnRightExtendsLeftType() {
25
+ return void 0;
26
+ }
27
+ var isSubTypeOf = typeOnRightExtendsLeftType;
28
+ function isObjKey(key, obj) {
29
+ return typeof key === "string" && key in obj;
30
+ }
31
+ function unionsAreTheSame(_diff) {
32
+ }
33
+ function asPartialUndefinedValues(value) {
34
+ return value;
35
+ }
36
+
37
+ export {
38
+ asNonPartial,
39
+ typedObjectEntries,
40
+ typedObjectKeys,
41
+ asType,
42
+ narrowStringToUnion,
43
+ typeOnRightExtendsLeftType,
44
+ isSubTypeOf,
45
+ isObjKey,
46
+ unionsAreTheSame,
47
+ asPartialUndefinedValues
48
+ };
@@ -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";
@@ -73,6 +73,7 @@ function bgColor(color, text) {
73
73
  return `${bgColorToCodeASCII[color]}${text}${resetBgColor}\x1B[0m`;
74
74
  }
75
75
  var consoleFmt = {
76
+ /** @deprecated Use `styleText` from `node:util` instead. */
76
77
  color: consoleColors,
77
78
  bold,
78
79
  underline,
@@ -16,8 +16,11 @@ declare const colorToCodeASCII: {
16
16
  brightCyan: string;
17
17
  brightWhite: string;
18
18
  };
19
+ /** @deprecated Use `styleText` from `node:util` instead. */
19
20
  declare function consoleColors(color: keyof typeof colorToCodeASCII, text: string): string;
21
+ /** @deprecated Use `styleText` from `node:util` instead. */
20
22
  declare function bold(text: string): string;
23
+ /** @deprecated Use `styleText` from `node:util` instead. */
21
24
  declare function underline(text: string): string;
22
25
  declare const bgColorToCodeASCII: {
23
26
  red: string;
@@ -37,8 +40,11 @@ declare const bgColorToCodeASCII: {
37
40
  brightCyan: string;
38
41
  brightWhite: string;
39
42
  };
43
+ /** @deprecated Use `styleText` from `node:util` instead. */
40
44
  declare function bgColor(color: keyof typeof bgColorToCodeASCII, text: string): string;
45
+ /** @deprecated Use `styleText` from `node:util` instead. */
41
46
  declare const consoleFmt: {
47
+ /** @deprecated Use `styleText` from `node:util` instead. */
42
48
  color: typeof consoleColors;
43
49
  bold: typeof bold;
44
50
  underline: typeof underline;
@@ -16,8 +16,11 @@ declare const colorToCodeASCII: {
16
16
  brightCyan: string;
17
17
  brightWhite: string;
18
18
  };
19
+ /** @deprecated Use `styleText` from `node:util` instead. */
19
20
  declare function consoleColors(color: keyof typeof colorToCodeASCII, text: string): string;
21
+ /** @deprecated Use `styleText` from `node:util` instead. */
20
22
  declare function bold(text: string): string;
23
+ /** @deprecated Use `styleText` from `node:util` instead. */
21
24
  declare function underline(text: string): string;
22
25
  declare const bgColorToCodeASCII: {
23
26
  red: string;
@@ -37,8 +40,11 @@ declare const bgColorToCodeASCII: {
37
40
  brightCyan: string;
38
41
  brightWhite: string;
39
42
  };
43
+ /** @deprecated Use `styleText` from `node:util` instead. */
40
44
  declare function bgColor(color: keyof typeof bgColorToCodeASCII, text: string): string;
45
+ /** @deprecated Use `styleText` from `node:util` instead. */
41
46
  declare const consoleFmt: {
47
+ /** @deprecated Use `styleText` from `node:util` instead. */
42
48
  color: typeof consoleColors;
43
49
  bold: typeof bold;
44
50
  underline: typeof underline;
@@ -49,6 +49,7 @@ function bgColor(color, text) {
49
49
  return `${bgColorToCodeASCII[color]}${text}${resetBgColor}\x1B[0m`;
50
50
  }
51
51
  var consoleFmt = {
52
+ /** @deprecated Use `styleText` from `node:util` instead. */
52
53
  color: consoleColors,
53
54
  bold,
54
55
  underline,
@@ -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;