@ls-stack/utils 3.40.0 → 3.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) 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/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.d.cts +12 -6
  77. package/dist/typingFnUtils.d.ts +12 -6
  78. package/dist/typingFnUtils.js +12 -35
  79. package/dist/typingTestUtils.cjs +7 -1
  80. package/dist/typingTestUtils.d.cts +52 -11
  81. package/dist/typingTestUtils.d.ts +52 -11
  82. package/dist/typingTestUtils.js +7 -1
  83. package/dist/typingUtils.d.cts +4 -1
  84. package/dist/typingUtils.d.ts +4 -1
  85. package/dist/yamlStringify.cjs +11 -9
  86. package/dist/yamlStringify.js +2 -2
  87. package/package.json +5 -1
  88. package/docs/README.md +0 -72
  89. package/docs/_media/modules.md +0 -58
  90. package/docs/arrayUtils/-internal-.md +0 -179
  91. package/docs/arrayUtils/README.md +0 -550
  92. package/docs/assertions/-internal-.md +0 -63
  93. package/docs/assertions/README.md +0 -565
  94. package/docs/asyncQueue/-internal-.md +0 -297
  95. package/docs/asyncQueue/README.md +0 -1485
  96. package/docs/awaitDebounce.md +0 -66
  97. package/docs/cache/-internal-.md +0 -168
  98. package/docs/cache/README.md +0 -360
  99. package/docs/castValues.md +0 -47
  100. package/docs/concurrentCalls/-internal-.md +0 -490
  101. package/docs/concurrentCalls/README.md +0 -299
  102. package/docs/consoleFmt.md +0 -115
  103. package/docs/conversions.md +0 -27
  104. package/docs/createThrottleController/-internal-.md +0 -73
  105. package/docs/createThrottleController/README.md +0 -31
  106. package/docs/debounce.md +0 -188
  107. package/docs/dedent/-internal-.md +0 -17
  108. package/docs/dedent/README.md +0 -204
  109. package/docs/deepEqual.md +0 -94
  110. package/docs/enhancedMap.md +0 -358
  111. package/docs/exhaustiveMatch/-internal-.md +0 -39
  112. package/docs/exhaustiveMatch/README.md +0 -146
  113. package/docs/filterObjectOrArrayKeys.md +0 -109
  114. package/docs/getAutoIncrementId.md +0 -93
  115. package/docs/getCompositeKey.md +0 -39
  116. package/docs/getValueStableKey.md +0 -57
  117. package/docs/hash.md +0 -31
  118. package/docs/interpolate/-internal-.md +0 -61
  119. package/docs/interpolate/README.md +0 -62
  120. package/docs/keepPrevIfUnchanged.md +0 -43
  121. package/docs/levenshtein.md +0 -93
  122. package/docs/main.md +0 -21
  123. package/docs/mathUtils.md +0 -137
  124. package/docs/modules.md +0 -58
  125. package/docs/mutationUtils.md +0 -44
  126. package/docs/objUtils.md +0 -237
  127. package/docs/parallelAsyncCalls/-internal-.md +0 -347
  128. package/docs/parallelAsyncCalls/README.md +0 -45
  129. package/docs/promiseUtils/-internal-.md +0 -69
  130. package/docs/promiseUtils/README.md +0 -31
  131. package/docs/retryOnError/-internal-.md +0 -111
  132. package/docs/retryOnError/README.md +0 -168
  133. package/docs/runShellCmd/-internal-.md +0 -111
  134. package/docs/runShellCmd/README.md +0 -201
  135. package/docs/safeJson.md +0 -51
  136. package/docs/saferTyping.md +0 -228
  137. package/docs/serializeXML.md +0 -100
  138. package/docs/shallowEqual.md +0 -33
  139. package/docs/sleep.md +0 -27
  140. package/docs/stringUtils/-internal-.md +0 -17
  141. package/docs/stringUtils/README.md +0 -270
  142. package/docs/testUtils.md +0 -382
  143. package/docs/throttle/-internal-.md +0 -47
  144. package/docs/throttle/README.md +0 -178
  145. package/docs/time.md +0 -274
  146. package/docs/timers.md +0 -256
  147. package/docs/tsResult/-internal-.md +0 -327
  148. package/docs/tsResult/README.md +0 -702
  149. package/docs/typeGuards.md +0 -399
  150. package/docs/typeUtils/-internal-.md +0 -99
  151. package/docs/typeUtils/README.md +0 -195
  152. package/docs/typeUtils.typesTest.md +0 -7
  153. package/docs/typedStrings.md +0 -458
  154. package/docs/typingFnUtils/-internal-.md +0 -43
  155. package/docs/typingFnUtils/README.md +0 -317
  156. package/docs/typingTestUtils.md +0 -172
  157. package/docs/typingUtils.md +0 -135
  158. package/docs/yamlStringify.md +0 -83
@@ -1,12 +1,13 @@
1
1
  import { ResultValidErrors, Result } from 't-result';
2
2
 
3
- /**
4
- * Configuration options for retryOnError function.
5
- */
3
+ /** Configuration options for retryOnError function. */
6
4
  type RetryOptions = {
7
5
  /** Delay between retries in milliseconds or function returning delay */
8
6
  delayBetweenRetriesMs?: number | ((retry: number) => number);
9
- /** Function to determine if retry should happen, receives error and duration of last attempt */
7
+ /**
8
+ * Function to determine if retry should happen, receives error and duration
9
+ * of last attempt
10
+ */
10
11
  retryCondition?: (error: Error, lastAttempt: {
11
12
  duration: number;
12
13
  retry: number;
@@ -24,22 +25,23 @@ type RetryOptions = {
24
25
  /**
25
26
  * Retries a function on error with configurable retry logic.
26
27
  *
28
+ * @example
29
+ * await retryOnError(
30
+ * async (ctx) => {
31
+ * console.log(`Attempt ${ctx.retry + 1}`);
32
+ * return await fetchData();
33
+ * },
34
+ * 3,
35
+ * { delayBetweenRetriesMs: 1000 },
36
+ * );
37
+ *
27
38
  * @param fn - Function to retry that receives context with retry count
28
39
  * @param maxRetries - Maximum number of retries
29
40
  * @param options - Configuration options
30
- * @param retry - internal use only
31
- * @param originalMaxRetries - internal use only
32
- * @returns Promise resolving to the function result or rejecting with the final error
33
- *
34
- * @example
35
- * await retryOnError(
36
- * async (ctx) => {
37
- * console.log(`Attempt ${ctx.retry + 1}`);
38
- * return await fetchData();
39
- * },
40
- * 3,
41
- * { delayBetweenRetriesMs: 1000 }
42
- * );
41
+ * @param retry - Internal use only
42
+ * @param originalMaxRetries - Internal use only
43
+ * @returns Promise resolving to the function result or rejecting with the final
44
+ * error
43
45
  */
44
46
  declare function retryOnError<T>(fn: (ctx: {
45
47
  /** Current retry count, (0 for first attempt) */
@@ -56,9 +58,10 @@ declare function retryOnError<T>(fn: (ctx: {
56
58
  * @param options.debugId
57
59
  * @param options.disableRetries
58
60
  * @param options.onRetry
59
- * @param __retry - internal use only
60
- * @param __originalMaxRetries - internal use only
61
- * @returns Promise resolving to the function result or rejecting with the final error
61
+ * @param __retry - Internal use only
62
+ * @param __originalMaxRetries - Internal use only
63
+ * @returns Promise resolving to the function result or rejecting with the final
64
+ * error
62
65
  */
63
66
  declare function retryResultOnError<T, E extends ResultValidErrors>(fn: (ctx: {
64
67
  /** Current retry count, (0 for first attempt) */
@@ -1,12 +1,13 @@
1
1
  import { ResultValidErrors, Result } from 't-result';
2
2
 
3
- /**
4
- * Configuration options for retryOnError function.
5
- */
3
+ /** Configuration options for retryOnError function. */
6
4
  type RetryOptions = {
7
5
  /** Delay between retries in milliseconds or function returning delay */
8
6
  delayBetweenRetriesMs?: number | ((retry: number) => number);
9
- /** Function to determine if retry should happen, receives error and duration of last attempt */
7
+ /**
8
+ * Function to determine if retry should happen, receives error and duration
9
+ * of last attempt
10
+ */
10
11
  retryCondition?: (error: Error, lastAttempt: {
11
12
  duration: number;
12
13
  retry: number;
@@ -24,22 +25,23 @@ type RetryOptions = {
24
25
  /**
25
26
  * Retries a function on error with configurable retry logic.
26
27
  *
28
+ * @example
29
+ * await retryOnError(
30
+ * async (ctx) => {
31
+ * console.log(`Attempt ${ctx.retry + 1}`);
32
+ * return await fetchData();
33
+ * },
34
+ * 3,
35
+ * { delayBetweenRetriesMs: 1000 },
36
+ * );
37
+ *
27
38
  * @param fn - Function to retry that receives context with retry count
28
39
  * @param maxRetries - Maximum number of retries
29
40
  * @param options - Configuration options
30
- * @param retry - internal use only
31
- * @param originalMaxRetries - internal use only
32
- * @returns Promise resolving to the function result or rejecting with the final error
33
- *
34
- * @example
35
- * await retryOnError(
36
- * async (ctx) => {
37
- * console.log(`Attempt ${ctx.retry + 1}`);
38
- * return await fetchData();
39
- * },
40
- * 3,
41
- * { delayBetweenRetriesMs: 1000 }
42
- * );
41
+ * @param retry - Internal use only
42
+ * @param originalMaxRetries - Internal use only
43
+ * @returns Promise resolving to the function result or rejecting with the final
44
+ * error
43
45
  */
44
46
  declare function retryOnError<T>(fn: (ctx: {
45
47
  /** Current retry count, (0 for first attempt) */
@@ -56,9 +58,10 @@ declare function retryOnError<T>(fn: (ctx: {
56
58
  * @param options.debugId
57
59
  * @param options.disableRetries
58
60
  * @param options.onRetry
59
- * @param __retry - internal use only
60
- * @param __originalMaxRetries - internal use only
61
- * @returns Promise resolving to the function result or rejecting with the final error
61
+ * @param __retry - Internal use only
62
+ * @param __originalMaxRetries - Internal use only
63
+ * @returns Promise resolving to the function result or rejecting with the final
64
+ * error
62
65
  */
63
66
  declare function retryResultOnError<T, E extends ResultValidErrors>(fn: (ctx: {
64
67
  /** Current retry count, (0 for first attempt) */
@@ -13,6 +13,14 @@ type RunCmdOptions = {
13
13
  noCiColorForce?: boolean;
14
14
  };
15
15
  /**
16
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
17
+ * update your imports:
18
+ *
19
+ * // Old (deprecated)
20
+ * import { runCmd } from '@ls-stack/utils/runShellCmd';
21
+ *
22
+ * // New (preferred)
23
+ * import { runCmd } from '@ls-stack/node-utils/runShellCmd';
16
24
  * @param label
17
25
  * @param command
18
26
  * @param root0
@@ -21,69 +29,61 @@ type RunCmdOptions = {
21
29
  * @param root0.throwOnError
22
30
  * @param root0.cwd
23
31
  * @param root0.noCiColorForce
24
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
25
- * ```
26
- * // Old (deprecated)
27
- * import { runCmd } from '@ls-stack/utils/runShellCmd';
28
- *
29
- * // New (preferred)
30
- * import { runCmd } from '@ls-stack/node-utils/runShellCmd';
31
- * ```
32
32
  */
33
33
  declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
34
34
  /**
35
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
36
+ * update your imports:
37
+ *
38
+ * // Old (deprecated)
39
+ * import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
40
+ *
41
+ * // New (preferred)
42
+ * import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
35
43
  * @param label
36
44
  * @param cmd
37
45
  * @param onResult
38
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
39
- * ```
40
- * // Old (deprecated)
41
- * import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
42
- *
43
- * // New (preferred)
44
- * import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
45
- * ```
46
46
  */
47
47
  declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
48
48
  /**
49
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
50
+ * update your imports:
51
+ *
52
+ * // Old (deprecated)
53
+ * import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
54
+ *
55
+ * // New (preferred)
56
+ * import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
49
57
  * @param label
50
58
  * @param command
51
59
  * @param root0
52
60
  * @param root0.silent
53
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
54
- * ```
55
- * // Old (deprecated)
56
- * import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
57
- *
58
- * // New (preferred)
59
- * import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
60
- * ```
61
61
  */
62
62
  declare function runCmdUnwrap(label: string | null, command: string | string[], { silent, }?: {
63
63
  silent?: boolean | 'timeOnly';
64
64
  }): Promise<string>;
65
65
  /**
66
- * @param command
67
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
68
- * ```
69
- * // Old (deprecated)
70
- * import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
66
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
67
+ * update your imports:
71
68
  *
72
- * // New (preferred)
73
- * import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
74
- * ```
69
+ * // Old (deprecated)
70
+ * import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
71
+ *
72
+ * // New (preferred)
73
+ * import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
74
+ * @param command
75
75
  */
76
76
  declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
77
77
  /**
78
- * @param command
79
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
80
- * ```
81
- * // Old (deprecated)
82
- * import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
78
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
79
+ * update your imports:
80
+ *
81
+ * // Old (deprecated)
82
+ * import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
83
83
  *
84
- * // New (preferred)
85
- * import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
86
- * ```
84
+ * // New (preferred)
85
+ * import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
86
+ * @param command
87
87
  */
88
88
  declare function runCmdSilentUnwrap(command: string | string[]): Promise<string>;
89
89
 
@@ -13,6 +13,14 @@ type RunCmdOptions = {
13
13
  noCiColorForce?: boolean;
14
14
  };
15
15
  /**
16
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
17
+ * update your imports:
18
+ *
19
+ * // Old (deprecated)
20
+ * import { runCmd } from '@ls-stack/utils/runShellCmd';
21
+ *
22
+ * // New (preferred)
23
+ * import { runCmd } from '@ls-stack/node-utils/runShellCmd';
16
24
  * @param label
17
25
  * @param command
18
26
  * @param root0
@@ -21,69 +29,61 @@ type RunCmdOptions = {
21
29
  * @param root0.throwOnError
22
30
  * @param root0.cwd
23
31
  * @param root0.noCiColorForce
24
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
25
- * ```
26
- * // Old (deprecated)
27
- * import { runCmd } from '@ls-stack/utils/runShellCmd';
28
- *
29
- * // New (preferred)
30
- * import { runCmd } from '@ls-stack/node-utils/runShellCmd';
31
- * ```
32
32
  */
33
33
  declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
34
34
  /**
35
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
36
+ * update your imports:
37
+ *
38
+ * // Old (deprecated)
39
+ * import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
40
+ *
41
+ * // New (preferred)
42
+ * import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
35
43
  * @param label
36
44
  * @param cmd
37
45
  * @param onResult
38
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
39
- * ```
40
- * // Old (deprecated)
41
- * import { concurrentCmd } from '@ls-stack/utils/runShellCmd';
42
- *
43
- * // New (preferred)
44
- * import { concurrentCmd } from '@ls-stack/node-utils/runShellCmd';
45
- * ```
46
46
  */
47
47
  declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
48
48
  /**
49
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
50
+ * update your imports:
51
+ *
52
+ * // Old (deprecated)
53
+ * import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
54
+ *
55
+ * // New (preferred)
56
+ * import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
49
57
  * @param label
50
58
  * @param command
51
59
  * @param root0
52
60
  * @param root0.silent
53
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
54
- * ```
55
- * // Old (deprecated)
56
- * import { runCmdUnwrap } from '@ls-stack/utils/runShellCmd';
57
- *
58
- * // New (preferred)
59
- * import { runCmdUnwrap } from '@ls-stack/node-utils/runShellCmd';
60
- * ```
61
61
  */
62
62
  declare function runCmdUnwrap(label: string | null, command: string | string[], { silent, }?: {
63
63
  silent?: boolean | 'timeOnly';
64
64
  }): Promise<string>;
65
65
  /**
66
- * @param command
67
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
68
- * ```
69
- * // Old (deprecated)
70
- * import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
66
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
67
+ * update your imports:
71
68
  *
72
- * // New (preferred)
73
- * import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
74
- * ```
69
+ * // Old (deprecated)
70
+ * import { runCmdSilent } from '@ls-stack/utils/runShellCmd';
71
+ *
72
+ * // New (preferred)
73
+ * import { runCmdSilent } from '@ls-stack/node-utils/runShellCmd';
74
+ * @param command
75
75
  */
76
76
  declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
77
77
  /**
78
- * @param command
79
- * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
80
- * ```
81
- * // Old (deprecated)
82
- * import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
78
+ * @deprecated This utility has been moved to @ls-stack/node-utils. Please
79
+ * update your imports:
80
+ *
81
+ * // Old (deprecated)
82
+ * import { runCmdSilentUnwrap } from '@ls-stack/utils/runShellCmd';
83
83
  *
84
- * // New (preferred)
85
- * import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
86
- * ```
84
+ * // New (preferred)
85
+ * import { runCmdSilentUnwrap } from '@ls-stack/node-utils/runShellCmd';
86
+ * @param command
87
87
  */
88
88
  declare function runCmdSilentUnwrap(command: string | string[]): Promise<string>;
89
89
 
@@ -1,10 +1,14 @@
1
1
  /**
2
- * JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
2
+ * JSON.stringify can throw if the value is circular or contains functions, this
3
+ * function catches those errors and returns undefined
4
+ *
3
5
  * @param value
4
6
  */
5
7
  declare function safeJsonStringify(value: unknown): string | undefined;
6
8
  /**
7
- * JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
9
+ * JSON.parse can throw if the value is not valid JSON, this function catches
10
+ * those errors and returns undefined
11
+ *
8
12
  * @param value
9
13
  */
10
14
  declare function safeJsonParse(value: string): unknown;
@@ -1,10 +1,14 @@
1
1
  /**
2
- * JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
2
+ * JSON.stringify can throw if the value is circular or contains functions, this
3
+ * function catches those errors and returns undefined
4
+ *
3
5
  * @param value
4
6
  */
5
7
  declare function safeJsonStringify(value: unknown): string | undefined;
6
8
  /**
7
- * JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
9
+ * JSON.parse can throw if the value is not valid JSON, this function catches
10
+ * those errors and returns undefined
11
+ *
8
12
  * @param value
9
13
  */
10
14
  declare function safeJsonParse(value: string): unknown;
@@ -1,39 +1,46 @@
1
- /** Use this only when you have 100% of certainty that this will not break the types */
2
- type __LEGIT_ANY__ = any;
3
- type __LEGIT_ANY_FUNCTION__ = (...params: any) => __LEGIT_ANY__;
4
1
  /**
5
- * An empty object type, equivalent to `{}` but with safer typing
2
+ * Use this only when you have 100% of certainty that this will not break the
3
+ * types
6
4
  */
5
+ type __LEGIT_ANY__ = any;
6
+ type __LEGIT_ANY_FUNCTION__ = (...params: any) => __LEGIT_ANY__;
7
+ /** An empty object type, equivalent to `{}` but with safer typing */
7
8
  type EmptyObject = Record<string, never>;
8
9
  /**
9
- * Cast a value to `any` type. Use this when you have legit usage of `any` casting.
10
+ * Cast a value to `any` type. Use this when you have legit usage of `any`
11
+ * casting.
10
12
  *
13
+ * @template V (optional) - When used enforces that the casted value is
14
+ * assignable to the type V, use it for safer casts
11
15
  * @param value
12
- * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
13
16
  */
14
17
  declare function __LEGIT_ANY_CAST__<V = unknown>(value: V): __LEGIT_ANY__;
15
18
  /**
16
- * Cast a value to a specific type T. Use this when you have legit usage of type assertion.
19
+ * Cast a value to a specific type T. Use this when you have legit usage of type
20
+ * assertion.
17
21
  *
18
- * @param value
19
22
  * @template T - The type to cast to
20
- * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
23
+ * @template V (optional) - When used enforces that the casted value is
24
+ * assignable to the type V, use it for safer casts
25
+ * @param value
21
26
  */
22
27
  declare function __LEGIT_CAST__<T, V = unknown>(value: V): T;
23
28
  /**
24
- * Refine a value to a specific type T. Use this when you have legit usage of type assertion.
29
+ * Refine a value to a specific type T. Use this when you have legit usage of
30
+ * type assertion.
25
31
  *
26
- * @param value
27
32
  * @template T - The type to cast to
28
- * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
33
+ * @template V (optional) - When used enforces that the casted value is
34
+ * assignable to the type V, use it for safer casts
35
+ * @param value
29
36
  */
30
37
  declare function __REFINE_CAST__<T>(value: T): <R extends T>() => R;
31
38
  declare function __FIX_THIS_CASTING__<T>(value: unknown): T;
32
39
  type __FIX_THIS_TYPING__ = any;
33
40
  declare function __FIX_THIS_TYPING__(value: unknown): __LEGIT_ANY__;
34
41
  /**
35
- * Any type that is not a primitive (number, string, boolean, null, undefined, symbol, bigint, ...)
36
- * Equivalent to `object` type
42
+ * Any type that is not a primitive (number, string, boolean, null, undefined,
43
+ * symbol, bigint, ...) Equivalent to `object` type
37
44
  */
38
45
  type AnyNonPrimitiveValue = object;
39
46
 
@@ -1,39 +1,46 @@
1
- /** Use this only when you have 100% of certainty that this will not break the types */
2
- type __LEGIT_ANY__ = any;
3
- type __LEGIT_ANY_FUNCTION__ = (...params: any) => __LEGIT_ANY__;
4
1
  /**
5
- * An empty object type, equivalent to `{}` but with safer typing
2
+ * Use this only when you have 100% of certainty that this will not break the
3
+ * types
6
4
  */
5
+ type __LEGIT_ANY__ = any;
6
+ type __LEGIT_ANY_FUNCTION__ = (...params: any) => __LEGIT_ANY__;
7
+ /** An empty object type, equivalent to `{}` but with safer typing */
7
8
  type EmptyObject = Record<string, never>;
8
9
  /**
9
- * Cast a value to `any` type. Use this when you have legit usage of `any` casting.
10
+ * Cast a value to `any` type. Use this when you have legit usage of `any`
11
+ * casting.
10
12
  *
13
+ * @template V (optional) - When used enforces that the casted value is
14
+ * assignable to the type V, use it for safer casts
11
15
  * @param value
12
- * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
13
16
  */
14
17
  declare function __LEGIT_ANY_CAST__<V = unknown>(value: V): __LEGIT_ANY__;
15
18
  /**
16
- * Cast a value to a specific type T. Use this when you have legit usage of type assertion.
19
+ * Cast a value to a specific type T. Use this when you have legit usage of type
20
+ * assertion.
17
21
  *
18
- * @param value
19
22
  * @template T - The type to cast to
20
- * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
23
+ * @template V (optional) - When used enforces that the casted value is
24
+ * assignable to the type V, use it for safer casts
25
+ * @param value
21
26
  */
22
27
  declare function __LEGIT_CAST__<T, V = unknown>(value: V): T;
23
28
  /**
24
- * Refine a value to a specific type T. Use this when you have legit usage of type assertion.
29
+ * Refine a value to a specific type T. Use this when you have legit usage of
30
+ * type assertion.
25
31
  *
26
- * @param value
27
32
  * @template T - The type to cast to
28
- * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
33
+ * @template V (optional) - When used enforces that the casted value is
34
+ * assignable to the type V, use it for safer casts
35
+ * @param value
29
36
  */
30
37
  declare function __REFINE_CAST__<T>(value: T): <R extends T>() => R;
31
38
  declare function __FIX_THIS_CASTING__<T>(value: unknown): T;
32
39
  type __FIX_THIS_TYPING__ = any;
33
40
  declare function __FIX_THIS_TYPING__(value: unknown): __LEGIT_ANY__;
34
41
  /**
35
- * Any type that is not a primitive (number, string, boolean, null, undefined, symbol, bigint, ...)
36
- * Equivalent to `object` type
42
+ * Any type that is not a primitive (number, string, boolean, null, undefined,
43
+ * symbol, bigint, ...) Equivalent to `object` type
37
44
  */
38
45
  type AnyNonPrimitiveValue = object;
39
46
 
@@ -1,4 +1,4 @@
1
- /** shallow equal version of https://github.com/lukeed/dequal */
1
+ /** Shallow equal version of https://github.com/lukeed/dequal */
2
2
  declare function shallowEqual(foo: any, bar: any): boolean;
3
3
 
4
4
  export { shallowEqual };
@@ -1,4 +1,4 @@
1
- /** shallow equal version of https://github.com/lukeed/dequal */
1
+ /** Shallow equal version of https://github.com/lukeed/dequal */
2
2
  declare function shallowEqual(foo: any, bar: any): boolean;
3
3
 
4
4
  export { shallowEqual };
@@ -67,10 +67,10 @@ function convertToCamelCase(str) {
67
67
  return pascalCase.charAt(0).toLowerCase() + pascalCase.slice(1);
68
68
  }
69
69
  function convertToSentenceCase(str) {
70
- return str.split(/[\s_-]+/).map((word) => word.toLowerCase()).join(" ").replace(/^\w/, (char) => char.toUpperCase());
70
+ 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());
71
71
  }
72
72
  function convertToTitleCase(str) {
73
- return str.split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
73
+ 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(" ");
74
74
  }
75
75
  function truncateString(str, length, ellipsis = "\u2026") {
76
76
  if (str.length <= length) return str;
@@ -2,16 +2,15 @@ type Arg = string | false | undefined | null;
2
2
  /**
3
3
  * A util to create more legible conditional concatenated strings
4
4
  *
5
- * @param args
6
5
  * @example
7
- * joinStrings('a', 'b', 'c') // 'abc'
8
- * joinStrings('a', false, 'c') // 'ac'
9
- * joinStrings('a', addBString ? 'b' : null, 'c') // 'ac' if addBString is false, 'abc' if addBString is true
6
+ * joinStrings('a', 'b', 'c'); // 'abc'
7
+ * joinStrings('a', false, 'c'); // 'ac'
8
+ * joinStrings('a', addBString ? 'b' : null, 'c'); // 'ac' if addBString is false, 'abc' if addBString is true
9
+ *
10
+ * @param args
10
11
  */
11
12
  declare function concatStrings(...args: (Arg | Arg[])[]): string;
12
- /**
13
- * @deprecated Use {@link concatStrings} instead
14
- */
13
+ /** @deprecated Use {@link concatStrings} instead */
15
14
  declare const joinStrings: typeof concatStrings;
16
15
  declare function formatNum(num: number, maxDecimalsOrOptions?: number | Intl.NumberFormatOptions): string;
17
16
  declare function isSnakeCase(str: string): boolean;
@@ -2,16 +2,15 @@ type Arg = string | false | undefined | null;
2
2
  /**
3
3
  * A util to create more legible conditional concatenated strings
4
4
  *
5
- * @param args
6
5
  * @example
7
- * joinStrings('a', 'b', 'c') // 'abc'
8
- * joinStrings('a', false, 'c') // 'ac'
9
- * joinStrings('a', addBString ? 'b' : null, 'c') // 'ac' if addBString is false, 'abc' if addBString is true
6
+ * joinStrings('a', 'b', 'c'); // 'abc'
7
+ * joinStrings('a', false, 'c'); // 'ac'
8
+ * joinStrings('a', addBString ? 'b' : null, 'c'); // 'ac' if addBString is false, 'abc' if addBString is true
9
+ *
10
+ * @param args
10
11
  */
11
12
  declare function concatStrings(...args: (Arg | Arg[])[]): string;
12
- /**
13
- * @deprecated Use {@link concatStrings} instead
14
- */
13
+ /** @deprecated Use {@link concatStrings} instead */
15
14
  declare const joinStrings: typeof concatStrings;
16
15
  declare function formatNum(num: number, maxDecimalsOrOptions?: number | Intl.NumberFormatOptions): string;
17
16
  declare function isSnakeCase(str: string): boolean;
@@ -10,7 +10,7 @@ import {
10
10
  joinStrings,
11
11
  removeANSIColors,
12
12
  truncateString
13
- } from "./chunk-KW55OTUG.js";
13
+ } from "./chunk-B3KFV2MH.js";
14
14
  export {
15
15
  concatStrings,
16
16
  convertToCamelCase,
@@ -788,14 +788,12 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
788
788
  const entries = Object.entries(value).filter(
789
789
  ([, val]) => val !== void 0 || showUndefined
790
790
  );
791
- const isSimpleObject = entries.every(
792
- ([, val]) => {
793
- if (typeof val === "string") {
794
- return !val.includes("'") && !val.includes('"') && !val.includes("\\");
795
- }
796
- return typeof val === "number" || typeof val === "boolean" || val === null || val === void 0;
791
+ const isSimpleObject = entries.every(([, val]) => {
792
+ if (typeof val === "string") {
793
+ return !val.includes("'") && !val.includes('"') && !val.includes("\\");
797
794
  }
798
- );
795
+ return typeof val === "number" || typeof val === "boolean" || val === null || val === void 0;
796
+ });
799
797
  const shouldCollapse = isArrayItem ? entries.length > 1 : entries.length > 0;
800
798
  if (isSimpleObject && shouldCollapse) {
801
799
  let line = "{ ";
@@ -848,7 +846,9 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
848
846
  false
849
847
  );
850
848
  const willBeCollapsed = isObject(objVal) && (Object.keys(objVal).length === 0 || collapseObjects && depth + 1 > 0 && (() => {
851
- const filteredEntries = Object.entries(objVal).filter(([, val]) => val !== void 0 || showUndefined);
849
+ const filteredEntries = Object.entries(objVal).filter(
850
+ ([, val]) => val !== void 0 || showUndefined
851
+ );
852
852
  const shouldCollapseThis = isArrayItem ? filteredEntries.length > 1 : filteredEntries.length > 0;
853
853
  return shouldCollapseThis && filteredEntries.every(([, val]) => {
854
854
  if (typeof val === "string") {
@@ -858,7 +858,9 @@ function stringifyValue(value, indent, maxLineLength, showUndefined, maxDepth, d
858
858
  });
859
859
  })());
860
860
  const prevWasCollapsed = prevValue && isObject(prevValue) && (Object.keys(prevValue).length === 0 || collapseObjects && depth + 1 > 0 && (() => {
861
- const filteredEntries = Object.entries(prevValue).filter(([, val]) => val !== void 0 || showUndefined);
861
+ const filteredEntries = Object.entries(prevValue).filter(
862
+ ([, val]) => val !== void 0 || showUndefined
863
+ );
862
864
  const shouldCollapseThis = isArrayItem ? filteredEntries.length > 1 : filteredEntries.length > 0;
863
865
  return shouldCollapseThis && filteredEntries.every(([, val]) => {
864
866
  if (typeof val === "string") {