@creejs/commons-lang 2.1.24 → 2.1.26
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.
- package/dist/cjs/index-dev.cjs +47 -20
- package/dist/cjs/index-dev.cjs.map +1 -1
- package/dist/cjs/index-min.cjs +1 -1
- package/dist/cjs/index-min.cjs.map +1 -1
- package/dist/esm/index-dev.js +47 -20
- package/dist/esm/index-dev.js.map +1 -1
- package/dist/esm/index-min.js +1 -1
- package/dist/esm/index-min.js.map +1 -1
- package/dist/umd/index.dev.js +47 -20
- package/dist/umd/index.dev.js.map +1 -1
- package/dist/umd/index.min.js +1 -1
- package/dist/umd/index.min.js.map +1 -1
- package/package.json +1 -1
- package/types/lang-utils.d.ts +9 -9
- package/types/promise-utils.d.ts +3 -0
- package/types/string-utils.d.ts +5 -2
- package/types/time-utils.d.ts +11 -2
package/package.json
CHANGED
package/types/lang-utils.d.ts
CHANGED
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
export function constructorName(value: any): string | undefined;
|
|
7
7
|
/**
|
|
8
8
|
* Assigns default values from source objects to target object for undefined properties.
|
|
9
|
-
*
|
|
10
|
-
* @param {
|
|
11
|
-
* @
|
|
12
|
-
* @
|
|
9
|
+
* 1. No Deep-Copy, only first level properties are assigned.
|
|
10
|
+
* @param {{[key:string]:any}} target - The target object to assign defaults to
|
|
11
|
+
* @param {...{[key:string]:any}|undefined} sources - Source objects containing default values
|
|
12
|
+
* @returns {{[key:string]:any}} The modified target object with defaults applied
|
|
13
13
|
*/
|
|
14
14
|
export function defaults(target: {
|
|
15
|
-
[
|
|
16
|
-
}, ...sources: {
|
|
17
|
-
[
|
|
18
|
-
}[]): {
|
|
19
|
-
[
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}, ...sources: ({
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
} | undefined)[]): {
|
|
19
|
+
[key: string]: any;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Extends a target object with properties from one or more source objects.
|
package/types/promise-utils.d.ts
CHANGED
|
@@ -120,6 +120,9 @@ export function parallelAllSettled(tasks: Function[], maxParallel?: number): Pro
|
|
|
120
120
|
* 2. Maybe multiple tasks are executed as a bulk block, and all of them resolved.
|
|
121
121
|
* * only the first fulfilled value is returned
|
|
122
122
|
* * other results are dropped
|
|
123
|
+
* 3. Notice:
|
|
124
|
+
* * In Beginning, we start bulk(maxParallel) of tasks
|
|
125
|
+
* * One task failed, it will start next task immediately, Not Wait for the bulk(maxParallel) to complete
|
|
123
126
|
* @param {Array<Function|Promise<any>>} tasks - Array of async functions to execute
|
|
124
127
|
* @param {number} [maxParallel=5] - Maximum number of tasks to run in parallel
|
|
125
128
|
* @returns {Promise<any>} Resolves with the result of the first successfully completed task
|
package/types/string-utils.d.ts
CHANGED
|
@@ -8,9 +8,11 @@ export function isEmpty(str: string): boolean;
|
|
|
8
8
|
/**
|
|
9
9
|
* Asserts that the given string is not empty.
|
|
10
10
|
* @param {string} str - The string to check.
|
|
11
|
+
* @param {string} [paramName]
|
|
12
|
+
*
|
|
11
13
|
* @throws {Error} Throws an error if the string is empty.
|
|
12
14
|
*/
|
|
13
|
-
export function assertNotEmpty(str: string): void;
|
|
15
|
+
export function assertNotEmpty(str: string, paramName?: string): void;
|
|
14
16
|
/**
|
|
15
17
|
* Checks if a string is null, undefined, or consists only of whitespace.
|
|
16
18
|
* @param {string} str - The string to check.
|
|
@@ -21,9 +23,10 @@ export function isBlank(str: string): boolean;
|
|
|
21
23
|
/**
|
|
22
24
|
* Asserts that the given string is not blank.
|
|
23
25
|
* @param {string} str - The string to check.
|
|
26
|
+
* @param {string} [paramName]
|
|
24
27
|
* @throws {Error} Throws an error if the string is blank.
|
|
25
28
|
*/
|
|
26
|
-
export function assertNotBlank(str: string): void;
|
|
29
|
+
export function assertNotBlank(str: string, paramName?: string): void;
|
|
27
30
|
/**
|
|
28
31
|
* Capitalizes the first character of a string.
|
|
29
32
|
* @param {string} str - The string to capitalize.
|
package/types/time-utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
declare namespace _default {
|
|
2
2
|
export { s2ns };
|
|
3
3
|
export { ms2ns };
|
|
4
|
+
export { timestamp };
|
|
4
5
|
export { timestamp64 };
|
|
5
6
|
export { lapseNano };
|
|
6
7
|
export { lapseMillis };
|
|
@@ -11,8 +12,16 @@ export default _default;
|
|
|
11
12
|
export const s2ns: 1000000000;
|
|
12
13
|
export const ms2ns: 1000000;
|
|
13
14
|
/**
|
|
14
|
-
* Gets the current timestamp in
|
|
15
|
-
*
|
|
15
|
+
* Gets the current timestamp in milliseconds
|
|
16
|
+
* * If "performance" API is available, uses performance timeOrigin + now(), then convert to milliseconds
|
|
17
|
+
* * Else fall back to `Date.now()`
|
|
18
|
+
* @returns {number} Current timestamp in milliseconds
|
|
19
|
+
*/
|
|
20
|
+
export function timestamp(): number;
|
|
21
|
+
/**
|
|
22
|
+
* Gets the current timestamp in nanoseconds
|
|
23
|
+
* * If "performance" API is available, uses performance timeOrigin + now()
|
|
24
|
+
* * Else fall back to `Date.now()` to get milliseconds and convert to nanoseconds
|
|
16
25
|
* @returns {bigint} Current timestamp as a BigInt
|
|
17
26
|
*/
|
|
18
27
|
export function timestamp64(): bigint;
|