qmwts 1.1.48 → 1.1.49

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.
@@ -6,6 +6,6 @@ declare const _default: {
6
6
  * @param parentKey 关联上级字段
7
7
  * @param childrenKey 下级字段
8
8
  */
9
- arrayToTree<T>(array?: any[], idKey?: string, parentKey?: string, childrenKey?: string): T[];
9
+ treeify<T>(array?: any[], idKey?: string, parentKey?: string, childrenKey?: string): T[];
10
10
  };
11
11
  export default _default;
@@ -19,7 +19,7 @@ exports.default = {
19
19
  * @param parentKey 关联上级字段
20
20
  * @param childrenKey 下级字段
21
21
  */
22
- arrayToTree: function (array, idKey, parentKey, childrenKey) {
22
+ treeify: function (array, idKey, parentKey, childrenKey) {
23
23
  if (array === void 0) { array = []; }
24
24
  if (idKey === void 0) { idKey = 'id'; }
25
25
  if (parentKey === void 0) { parentKey = 'parentId'; }
@@ -3,7 +3,7 @@ declare const _default: {
3
3
  isArray(o: any): boolean;
4
4
  parseObject<T>(o: any): T;
5
5
  parseArray<T>(o: any): T[];
6
- optionalChaining(o: any, chain: string, substitute?: any): any;
6
+ optionalChaining(o: any | undefined, chain: string, substitute?: any): any;
7
7
  setNull(o?: any, exclusions?: any): void;
8
8
  };
9
9
  export default _default;
@@ -10,10 +10,12 @@ exports.default = {
10
10
  for (var _i = 0; _i < arguments.length; _i++) {
11
11
  number[_i] = arguments[_i];
12
12
  }
13
- return number.every(function (e) {
14
- e = String(e).trim();
15
- return e !== '' && isFinite(e) && !isNaN(e);
16
- });
13
+ for (var i = number.length - 1; i >= 0; i--) {
14
+ var e = String(number[i]).trim();
15
+ if (e === '' || !isFinite(+e) || isNaN(+e))
16
+ return false;
17
+ }
18
+ return true;
17
19
  },
18
20
  // 增加千分位分隔符
19
21
  thousandths: function (number, fixed) {
@@ -29,8 +31,13 @@ exports.default = {
29
31
  return number;
30
32
  },
31
33
  summation: function (array) {
32
- var _this = this;
33
34
  if (array === void 0) { array = []; }
34
- return array.reduce(function (prev, curr) { return prev + _this.ifNaN(curr, 0); }, 0);
35
+ var sum = 0;
36
+ for (var i = array.length - 1; i >= 0; i--) {
37
+ var e = +array[i];
38
+ if (this.isNumber(e))
39
+ sum += e;
40
+ }
41
+ return sum;
35
42
  },
36
43
  };
@@ -1,4 +1,4 @@
1
1
  declare const _default: {
2
- generate(data: any, params: FormData | URLSearchParams): FormData | URLSearchParams;
2
+ generate(data: any | undefined, params: FormData | URLSearchParams): FormData | URLSearchParams;
3
3
  };
4
4
  export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qmwts",
3
- "version": "1.1.48",
3
+ "version": "1.1.49",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "devDependencies": {
14
14
  "jest": "^29.7.0",
15
15
  "ts-jest": "^29.2.5",
16
- "typescript": "^5.6.3"
16
+ "typescript": "^5.8.2"
17
17
  },
18
18
  "files": [
19
19
  "dist"