@creejs/commons-lang 2.0.4 → 2.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@creejs/commons-lang",
3
- "version": "2.0.4",
3
+ "version": "2.1.1",
4
4
  "description": "Commons Utils About Language, used inside creejs",
5
5
  "keywords": [
6
6
  "commons",
@@ -50,11 +50,10 @@
50
50
  "url": "git+https://github.com/frameworkee/commons.git"
51
51
  },
52
52
  "scripts": {
53
- "dts": "tsc",
53
+ "dts": "npx tsc",
54
54
  "generate-docs": "../../node_modules/.bin/jsdoc -c ./jsdoc.json",
55
55
  "clean": "rm -rf dist && rm -rf types",
56
56
  "build": "npm run clean && npm run dts && rollup -c",
57
- "prepublishOnly": "npm run build",
58
57
  "publish": "npm publish"
59
58
  },
60
59
  "author": "rodney.vin@gmail.com",
@@ -6,7 +6,7 @@
6
6
  * @param {boolean} [sealed=true] - Whether to seal the instance
7
7
  * @returns {Function} A proxied classA proxied instance of the class
8
8
  */
9
- export function proxy<T extends object>(cls: Function, propertyHandler?: ProxyHandler<T> | undefined, sealed?: boolean | undefined): Function;
9
+ export function proxy<T extends object>(cls: Function, propertyHandler?: ProxyHandler<T>, sealed?: boolean): Function;
10
10
  /**
11
11
  * Creates a proxied instance of a class with custom property handling.
12
12
  * @template {object} T
@@ -16,7 +16,7 @@ export function proxy<T extends object>(cls: Function, propertyHandler?: ProxyHa
16
16
  * @param {boolean} [sealed=true] - Whether the proxy should be sealed
17
17
  * @returns {T} Proxied class instance
18
18
  */
19
- export function newProxyInstance<T extends object>(cls: Function, args: any[], propertyHandler: ProxyHandler<T>, sealed?: boolean | undefined): T;
19
+ export function newProxyInstance<T extends object>(cls: Function, args: any[], propertyHandler: ProxyHandler<T>, sealed?: boolean): T;
20
20
  declare namespace _default {
21
21
  export { proxy };
22
22
  export { newProxyInstance };
package/types/index.d.ts CHANGED
@@ -12,12 +12,12 @@ declare namespace _default {
12
12
  export { InstanceProxyUtils };
13
13
  }
14
14
  export default _default;
15
- import LangUtils from "./lang-utils.js";
16
- import StringUtils from "./string-utils.js";
17
- import TypeUtils from "./type-utils.js";
18
- import TypeAssert from "./type-assert.js";
19
- import ExecUtils from "./exec-utils.js";
20
- import PromiseUtils from "./promise-utils.js";
21
- import ClassProxyUtils from "./class-proxy-utils.js";
22
- import InstanceProxyUtils from "./instance-proxy-utils.js";
15
+ import LangUtils from './lang-utils.js';
16
+ import StringUtils from './string-utils.js';
17
+ import TypeUtils from './type-utils.js';
18
+ import TypeAssert from './type-assert.js';
19
+ import ExecUtils from './exec-utils.js';
20
+ import PromiseUtils from './promise-utils.js';
21
+ import ClassProxyUtils from './class-proxy-utils.js';
22
+ import InstanceProxyUtils from './instance-proxy-utils.js';
23
23
  export { LangUtils, StringUtils, TypeUtils, TypeAssert, ExecUtils, PromiseUtils, LangUtils as Lang, TypeUtils as Type, ExecUtils as Exec, ClassProxyUtils, InstanceProxyUtils };
@@ -10,7 +10,7 @@
10
10
  * @returns {T} The proxied object instance
11
11
  * @throws {TypeError} If instance is not an object
12
12
  */
13
- export function proxy<T extends object>(instance: T, propertyHandler?: ProxyHandler<T> | undefined, sealed?: boolean | undefined): T;
13
+ export function proxy<T extends object>(instance: T, propertyHandler?: ProxyHandler<T>, sealed?: boolean): T;
14
14
  declare namespace _default {
15
15
  export { proxy };
16
16
  }
@@ -5,7 +5,7 @@
5
5
  * @param {string} [timeoutMessage]
6
6
  * @returns {{promise: Promise<*>, reject: function, resolve: function}}
7
7
  */
8
- export function defer(timeout?: number | undefined, timeoutMessage?: string | undefined): {
8
+ export function defer(timeout?: number, timeoutMessage?: string): {
9
9
  promise: Promise<any>;
10
10
  reject: Function;
11
11
  resolve: Function;
@@ -18,7 +18,7 @@ export function defer(timeout?: number | undefined, timeoutMessage?: string | un
18
18
  * @returns {Promise<*>} A new promise that either resolves with the original promise's value, rejects with original promise's error or timeout error
19
19
  * @throws {TypeError} If input is not a promise or timeout is not a number
20
20
  */
21
- export function timeout(promise: Promise<any>, time?: number | undefined, message?: string | undefined): Promise<any>;
21
+ export function timeout(promise: Promise<any>, time?: number, message?: string): Promise<any>;
22
22
  /**
23
23
  * Excutes All promises in parallel and returns an array of results.
24
24
  *
@@ -84,7 +84,7 @@ export function seriesAllSettled(tasks: Function[]): Promise<Array<{
84
84
  * @returns {Promise<Array>} Array of resolved values from all promises
85
85
  * @throws {TypeError} If input is not an array of export function or maxParallel is not a number
86
86
  */
87
- export function parallel(tasks: Function[], maxParallel?: number | undefined): Promise<any[]>;
87
+ export function parallel(tasks: Function[], maxParallel?: number): Promise<any[]>;
88
88
  /**
89
89
  * AllSettled Mode to execute tasks in parallel with a maximum concurrency limit
90
90
  * 1. tasks are executed in parallel with a maximum concurrency limit
@@ -94,7 +94,7 @@ export function parallel(tasks: Function[], maxParallel?: number | undefined): P
94
94
  * @returns {Promise<Array>} Array of resolved values from all promises
95
95
  * @throws {TypeError} If input is not an array of export function or maxParallel is not a number
96
96
  */
97
- export function parallelAllSettled(tasks: Function[], maxParallel?: number | undefined): Promise<any[]>;
97
+ export function parallelAllSettled(tasks: Function[], maxParallel?: number): Promise<any[]>;
98
98
  declare namespace _default {
99
99
  export { defer };
100
100
  export { delay };
@@ -48,7 +48,7 @@ export function decapitalize(str: string): string;
48
48
  * @returns {string[]} An array of string chunks with fixed length.
49
49
  * @throws {Error} If `str` is not a string or `length` is not a number.
50
50
  */
51
- export function splitWithFixedLength(str: string, length: number, padding?: string | undefined): string[];
51
+ export function splitWithFixedLength(str: string, length: number, padding?: string): string[];
52
52
  /**
53
53
  * Splits a string into chunks using the specified markers.
54
54
  * 1. If no markers are provided, defaults to comma (',').
@@ -5,7 +5,7 @@
5
5
  * @returns {void}
6
6
  * @throws {Error}
7
7
  */
8
- export function assertArray(value: any, paramName?: string | undefined): void;
8
+ export function assertArray(value: any, paramName?: string): void;
9
9
  /**
10
10
  * if value is not a string, throw error
11
11
  * @param {*} value
@@ -13,7 +13,7 @@ export function assertArray(value: any, paramName?: string | undefined): void;
13
13
  * @returns {void}
14
14
  * @throws {Error}
15
15
  */
16
- export function assertString(value: any, paramName?: string | undefined): void;
16
+ export function assertString(value: any, paramName?: string): void;
17
17
  /**
18
18
  * if value is not a Number, throw error
19
19
  * @param {*} value
@@ -21,21 +21,21 @@ export function assertString(value: any, paramName?: string | undefined): void;
21
21
  * @returns {void}
22
22
  * @throws {Error}
23
23
  */
24
- export function assertNumber(value: any, paramName?: string | undefined): void;
24
+ export function assertNumber(value: any, paramName?: string): void;
25
25
  /**
26
26
  * Asserts that a value is a positive number.
27
27
  * @param {number} value - The value to check.
28
28
  * @param {string} [paramName] - Optional name of the parameter for error message.
29
29
  * @throws {Error} If the value is not a number or is less than or equal to zero.
30
30
  */
31
- export function assertPositive(value: number, paramName?: string | undefined): void;
31
+ export function assertPositive(value: number, paramName?: string): void;
32
32
  /**
33
33
  * Asserts that a value is a Negative number.
34
34
  * @param {number} value - The value to check.
35
35
  * @param {string} [paramName] - Optional name of the parameter for error message.
36
36
  * @throws {Error} If the value is not a number or is less than or equal to zero.
37
37
  */
38
- export function assertNegative(value: number, paramName?: string | undefined): void;
38
+ export function assertNegative(value: number, paramName?: string): void;
39
39
  /**
40
40
  * if value is not a string, throw error
41
41
  * @param {*} value
@@ -43,7 +43,7 @@ export function assertNegative(value: number, paramName?: string | undefined): v
43
43
  * @returns {void}
44
44
  * @throws {Error}
45
45
  */
46
- export function assertBoolean(value: any, paramName?: string | undefined): void;
46
+ export function assertBoolean(value: any, paramName?: string): void;
47
47
  /**
48
48
  * if value is not a Object, throw error
49
49
  * @param {*} value
@@ -51,7 +51,7 @@ export function assertBoolean(value: any, paramName?: string | undefined): void;
51
51
  * @returns {void}
52
52
  * @throws {Error}
53
53
  */
54
- export function assertObject(value: any, paramName?: string | undefined): void;
54
+ export function assertObject(value: any, paramName?: string): void;
55
55
  /**
56
56
  * if value is not a PlainObject, throw error
57
57
  * @param {*} value
@@ -59,7 +59,7 @@ export function assertObject(value: any, paramName?: string | undefined): void;
59
59
  * @returns {void}
60
60
  * @throws {Error}
61
61
  */
62
- export function assertPlainObject(value: any, paramName?: string | undefined): void;
62
+ export function assertPlainObject(value: any, paramName?: string): void;
63
63
  /**
64
64
  * if value is not a Symbol, throw error
65
65
  * @param {*} value
@@ -67,7 +67,7 @@ export function assertPlainObject(value: any, paramName?: string | undefined): v
67
67
  * @returns {void}
68
68
  * @throws {Error}
69
69
  */
70
- export function assertSymbol(value: any, paramName?: string | undefined): void;
70
+ export function assertSymbol(value: any, paramName?: string): void;
71
71
  /**
72
72
  * if value is not a Function, throw error
73
73
  * @param {*} value
@@ -75,7 +75,7 @@ export function assertSymbol(value: any, paramName?: string | undefined): void;
75
75
  * @returns {void}
76
76
  * @throws {Error}
77
77
  */
78
- export function assertFunction(value: any, paramName?: string | undefined): void;
78
+ export function assertFunction(value: any, paramName?: string): void;
79
79
  /**
80
80
  * if value is not a Class instance, throw error
81
81
  * @param {*} value
@@ -83,7 +83,7 @@ export function assertFunction(value: any, paramName?: string | undefined): void
83
83
  * @returns {void}
84
84
  * @throws {Error}
85
85
  */
86
- export function assertInstance(value: any, paramName?: string | undefined): void;
86
+ export function assertInstance(value: any, paramName?: string): void;
87
87
  /**
88
88
  * if value is not a string, throw error
89
89
  * @param {*} value
@@ -91,7 +91,7 @@ export function assertInstance(value: any, paramName?: string | undefined): void
91
91
  * @returns {void}
92
92
  * @throws {Error}
93
93
  */
94
- export function assertPromise(value: any, paramName?: string | undefined): void;
94
+ export function assertPromise(value: any, paramName?: string): void;
95
95
  /**
96
96
  * if value is not a Null or Undefined, throw error
97
97
  * @param {*} value
@@ -99,14 +99,14 @@ export function assertPromise(value: any, paramName?: string | undefined): void;
99
99
  * @returns {void}
100
100
  * @throws {Error}
101
101
  */
102
- export function assertNil(value: any, paramName?: string | undefined): void;
102
+ export function assertNil(value: any, paramName?: string): void;
103
103
  /**
104
104
  * Asserts that the given value is not nil.
105
105
  * @param {*} value - The value to check
106
106
  * @param {string} [paramName] - The name of the parameter to check
107
107
  * @throws {Error} Throws an error if the value is nil
108
108
  */
109
- export function assertNotNil(value: any, paramName?: string | undefined): void;
109
+ export function assertNotNil(value: any, paramName?: string): void;
110
110
  /**
111
111
  * if value is not a Null, throw error
112
112
  * @param {*} value
@@ -114,14 +114,14 @@ export function assertNotNil(value: any, paramName?: string | undefined): void;
114
114
  * @returns {void}
115
115
  * @throws {Error}
116
116
  */
117
- export function assertNull(value: any, paramName?: string | undefined): void;
117
+ export function assertNull(value: any, paramName?: string): void;
118
118
  /**
119
119
  * Asserts that the given value is not null.
120
120
  * @param {*} value - The value to check
121
121
  * @param {string} [paramName] - The name of the parameter to check
122
122
  * @throws {Error} Throws an error if the value is null
123
123
  */
124
- export function assertNotNull(value: any, paramName?: string | undefined): void;
124
+ export function assertNotNull(value: any, paramName?: string): void;
125
125
  /**
126
126
  * if value is not a Undefined, throw error
127
127
  * @param {*} value
@@ -129,14 +129,14 @@ export function assertNotNull(value: any, paramName?: string | undefined): void;
129
129
  * @returns {void}
130
130
  * @throws {Error}
131
131
  */
132
- export function assertUndefined(value: any, paramName?: string | undefined): void;
132
+ export function assertUndefined(value: any, paramName?: string): void;
133
133
  /**
134
134
  * Asserts that the given value is either a string or a symbol.
135
135
  * @param {*} value - The value to check.
136
136
  * @param {string} [paramName] - Optional parameter name for error message.
137
137
  * @throws {Error} Throws an error if the value is not a string or symbol.
138
138
  */
139
- export function assertStringOrSymbol(value: any, paramName?: string | undefined): void;
139
+ export function assertStringOrSymbol(value: any, paramName?: string): void;
140
140
  declare namespace _default {
141
141
  export { assertNumber };
142
142
  export { assertPositive };