@ls-stack/utils 3.24.1 → 3.25.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 (56) hide show
  1. package/docs/_media/modules.md +1 -0
  2. package/docs/arrayUtils/-internal-.md +1 -1
  3. package/docs/arrayUtils/README.md +12 -12
  4. package/docs/consoleFmt.md +2 -2
  5. package/docs/exhaustiveMatch/-internal-.md +1 -1
  6. package/docs/exhaustiveMatch/README.md +1 -1
  7. package/docs/filterObjectOrArrayKeys.md +80 -0
  8. package/docs/modules.md +1 -0
  9. package/docs/objUtils.md +7 -7
  10. package/docs/parallelAsyncCalls/-internal-.md +3 -3
  11. package/docs/parallelAsyncCalls/README.md +1 -1
  12. package/docs/retryOnError/README.md +1 -1
  13. package/docs/runShellCmd/README.md +9 -9
  14. package/docs/safeJson.md +2 -2
  15. package/docs/saferTyping.md +7 -7
  16. package/docs/stringUtils/README.md +6 -6
  17. package/docs/testUtils.md +40 -6
  18. package/docs/time.md +1 -1
  19. package/docs/tsResult/README.md +17 -11
  20. package/docs/typingFnUtils/-internal-.md +1 -1
  21. package/docs/typingFnUtils/README.md +8 -10
  22. package/lib/arrayUtils.d.cts +6 -1
  23. package/lib/arrayUtils.d.ts +6 -1
  24. package/lib/{chunk-JAPKLFIK.js → chunk-QLD7KG5I.js} +34 -20
  25. package/lib/chunk-XXYTMSFH.js +240 -0
  26. package/lib/filterObjectOrArrayKeys.cjs +275 -0
  27. package/lib/filterObjectOrArrayKeys.d.cts +42 -0
  28. package/lib/filterObjectOrArrayKeys.d.ts +42 -0
  29. package/lib/filterObjectOrArrayKeys.js +7 -0
  30. package/lib/objUtils.d.cts +4 -1
  31. package/lib/objUtils.d.ts +4 -1
  32. package/lib/parallelAsyncCalls.cjs +4 -1
  33. package/lib/parallelAsyncCalls.d.cts +4 -1
  34. package/lib/parallelAsyncCalls.d.ts +4 -1
  35. package/lib/parallelAsyncCalls.js +4 -1
  36. package/lib/retryOnError.d.cts +2 -0
  37. package/lib/retryOnError.d.ts +2 -0
  38. package/lib/runShellCmd.d.cts +17 -0
  39. package/lib/runShellCmd.d.ts +17 -0
  40. package/lib/safeJson.d.cts +8 -2
  41. package/lib/safeJson.d.ts +8 -2
  42. package/lib/saferTyping.d.cts +3 -0
  43. package/lib/saferTyping.d.ts +3 -0
  44. package/lib/stringUtils.d.cts +1 -0
  45. package/lib/stringUtils.d.ts +1 -0
  46. package/lib/testUtils.cjs +273 -144
  47. package/lib/testUtils.d.cts +40 -12
  48. package/lib/testUtils.d.ts +40 -12
  49. package/lib/testUtils.js +10 -125
  50. package/lib/tsResult.d.cts +31 -7
  51. package/lib/tsResult.d.ts +31 -7
  52. package/lib/typingFnUtils.d.cts +20 -6
  53. package/lib/typingFnUtils.d.ts +20 -6
  54. package/lib/yamlStringify.cjs +34 -20
  55. package/lib/yamlStringify.js +1 -1
  56. package/package.json +5 -1
@@ -18,6 +18,8 @@ type RetryOptions = {
18
18
  * @param fn - Function to retry that receives context with retry count
19
19
  * @param maxRetries - Maximum number of retries
20
20
  * @param options - Configuration options
21
+ * @param retry
22
+ * @param originalMaxRetries
21
23
  * @returns Promise resolving to the function result or rejecting with the final error
22
24
  *
23
25
  * @example
@@ -13,6 +13,14 @@ type RunCmdOptions = {
13
13
  noCiColorForce?: boolean;
14
14
  };
15
15
  /**
16
+ * @param label
17
+ * @param command
18
+ * @param root0
19
+ * @param root0.mock
20
+ * @param root0.silent
21
+ * @param root0.throwOnError
22
+ * @param root0.cwd
23
+ * @param root0.noCiColorForce
16
24
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
17
25
  * ```
18
26
  * // Old (deprecated)
@@ -24,6 +32,9 @@ type RunCmdOptions = {
24
32
  */
25
33
  declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
26
34
  /**
35
+ * @param label
36
+ * @param cmd
37
+ * @param onResult
27
38
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
28
39
  * ```
29
40
  * // Old (deprecated)
@@ -35,6 +46,10 @@ declare function runCmd(label: string | null, command: string | string[], { mock
35
46
  */
36
47
  declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
37
48
  /**
49
+ * @param label
50
+ * @param command
51
+ * @param root0
52
+ * @param root0.silent
38
53
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
39
54
  * ```
40
55
  * // Old (deprecated)
@@ -48,6 +63,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
48
63
  silent?: boolean | 'timeOnly';
49
64
  }): Promise<string>;
50
65
  /**
66
+ * @param command
51
67
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
52
68
  * ```
53
69
  * // Old (deprecated)
@@ -59,6 +75,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
59
75
  */
60
76
  declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
61
77
  /**
78
+ * @param command
62
79
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
63
80
  * ```
64
81
  * // Old (deprecated)
@@ -13,6 +13,14 @@ type RunCmdOptions = {
13
13
  noCiColorForce?: boolean;
14
14
  };
15
15
  /**
16
+ * @param label
17
+ * @param command
18
+ * @param root0
19
+ * @param root0.mock
20
+ * @param root0.silent
21
+ * @param root0.throwOnError
22
+ * @param root0.cwd
23
+ * @param root0.noCiColorForce
16
24
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
17
25
  * ```
18
26
  * // Old (deprecated)
@@ -24,6 +32,9 @@ type RunCmdOptions = {
24
32
  */
25
33
  declare function runCmd(label: string | null, command: string | string[], { mock, silent, throwOnError, cwd, noCiColorForce, }?: RunCmdOptions): Promise<CmdResult>;
26
34
  /**
35
+ * @param label
36
+ * @param cmd
37
+ * @param onResult
27
38
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
28
39
  * ```
29
40
  * // Old (deprecated)
@@ -35,6 +46,10 @@ declare function runCmd(label: string | null, command: string | string[], { mock
35
46
  */
36
47
  declare function concurrentCmd(label: string, cmd: string | string[], onResult: (result: CmdResult) => void): Promise<() => void>;
37
48
  /**
49
+ * @param label
50
+ * @param command
51
+ * @param root0
52
+ * @param root0.silent
38
53
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
39
54
  * ```
40
55
  * // Old (deprecated)
@@ -48,6 +63,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
48
63
  silent?: boolean | 'timeOnly';
49
64
  }): Promise<string>;
50
65
  /**
66
+ * @param command
51
67
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
52
68
  * ```
53
69
  * // Old (deprecated)
@@ -59,6 +75,7 @@ declare function runCmdUnwrap(label: string | null, command: string | string[],
59
75
  */
60
76
  declare function runCmdSilent(command: string | string[]): Promise<CmdResult>;
61
77
  /**
78
+ * @param command
62
79
  * @deprecated This utility has been moved to @ls-stack/node-utils. Please update your imports:
63
80
  * ```
64
81
  * // Old (deprecated)
@@ -1,6 +1,12 @@
1
- /** JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined */
1
+ /**
2
+ * JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
3
+ * @param value
4
+ */
2
5
  declare function safeJsonStringify(value: unknown): string | undefined;
3
- /** JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined */
6
+ /**
7
+ * JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
8
+ * @param value
9
+ */
4
10
  declare function safeJsonParse(value: string): unknown;
5
11
 
6
12
  export { safeJsonParse, safeJsonStringify };
package/lib/safeJson.d.ts CHANGED
@@ -1,6 +1,12 @@
1
- /** JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined */
1
+ /**
2
+ * JSON.stringify can throw if the value is circular or contains functions, this function catches those errors and returns undefined
3
+ * @param value
4
+ */
2
5
  declare function safeJsonStringify(value: unknown): string | undefined;
3
- /** JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined */
6
+ /**
7
+ * JSON.parse can throw if the value is not valid JSON, this function catches those errors and returns undefined
8
+ * @param value
9
+ */
4
10
  declare function safeJsonParse(value: string): unknown;
5
11
 
6
12
  export { safeJsonParse, safeJsonStringify };
@@ -8,12 +8,14 @@ type EmptyObject = Record<string, never>;
8
8
  /**
9
9
  * Cast a value to `any` type. Use this when you have legit usage of `any` casting.
10
10
  *
11
+ * @param value
11
12
  * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
12
13
  */
13
14
  declare function __LEGIT_ANY_CAST__<V = unknown>(value: V): __LEGIT_ANY__;
14
15
  /**
15
16
  * Cast a value to a specific type T. Use this when you have legit usage of type assertion.
16
17
  *
18
+ * @param value
17
19
  * @template T - The type to cast to
18
20
  * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
19
21
  */
@@ -21,6 +23,7 @@ declare function __LEGIT_CAST__<T, V = unknown>(value: V): T;
21
23
  /**
22
24
  * Refine a value to a specific type T. Use this when you have legit usage of type assertion.
23
25
  *
26
+ * @param value
24
27
  * @template T - The type to cast to
25
28
  * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
26
29
  */
@@ -8,12 +8,14 @@ type EmptyObject = Record<string, never>;
8
8
  /**
9
9
  * Cast a value to `any` type. Use this when you have legit usage of `any` casting.
10
10
  *
11
+ * @param value
11
12
  * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
12
13
  */
13
14
  declare function __LEGIT_ANY_CAST__<V = unknown>(value: V): __LEGIT_ANY__;
14
15
  /**
15
16
  * Cast a value to a specific type T. Use this when you have legit usage of type assertion.
16
17
  *
18
+ * @param value
17
19
  * @template T - The type to cast to
18
20
  * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
19
21
  */
@@ -21,6 +23,7 @@ declare function __LEGIT_CAST__<T, V = unknown>(value: V): T;
21
23
  /**
22
24
  * Refine a value to a specific type T. Use this when you have legit usage of type assertion.
23
25
  *
26
+ * @param value
24
27
  * @template T - The type to cast to
25
28
  * @template V (optional) - When used enforces that the casted value is assignable to the type V, use it for safer casts
26
29
  */
@@ -2,6 +2,7 @@ type Arg = string | false | undefined | null;
2
2
  /**
3
3
  * A util to create more legible conditional concatenated strings
4
4
  *
5
+ * @param args
5
6
  * @example
6
7
  * joinStrings('a', 'b', 'c') // 'abc'
7
8
  * joinStrings('a', false, 'c') // 'ac'
@@ -2,6 +2,7 @@ type Arg = string | false | undefined | null;
2
2
  /**
3
3
  * A util to create more legible conditional concatenated strings
4
4
  *
5
+ * @param args
5
6
  * @example
6
7
  * joinStrings('a', 'b', 'c') // 'abc'
7
8
  * joinStrings('a', false, 'c') // 'ac'