util-helpers 5.4.0 → 5.4.2

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/esm/AsyncMemo.js CHANGED
@@ -35,6 +35,5 @@ var AsyncMemo = (function () {
35
35
  };
36
36
  return AsyncMemo;
37
37
  }());
38
- var AsyncMemo$1 = AsyncMemo;
39
38
 
40
- export { AsyncMemo$1 as default };
39
+ export { AsyncMemo as default };
package/esm/VERSION.js CHANGED
@@ -1,4 +1,3 @@
1
- var VERSION = "5.4.0";
2
- var VERSION$1 = VERSION;
1
+ var VERSION = "5.4.2";
3
2
 
4
- export { VERSION$1 as default };
3
+ export { VERSION as default };
@@ -67,6 +67,5 @@ var compressImage = function (img, options) {
67
67
  .catch(reject);
68
68
  });
69
69
  };
70
- var compressImage$1 = compressImage;
71
70
 
72
- export { compressImage$1 as default };
71
+ export { compressImage as default };
package/esm/fileReader.js CHANGED
@@ -17,6 +17,5 @@ var fileReader = function (blob, type) {
17
17
  reader.onerror = function (error) { return reject(error); };
18
18
  });
19
19
  };
20
- var fileReader$1 = fileReader;
21
20
 
22
- export { fileReader$1 as default };
21
+ export { fileReader as default };
@@ -62,6 +62,5 @@ var formatMoney = function (num, options) {
62
62
  var _e = __read(strNum.split('.'), 2), intStr = _e[0], decStr = _e[1];
63
63
  return symbol + formatInt(intStr, thousand) + formatDec(decStr, precision, decimal);
64
64
  };
65
- var formatMoney$1 = formatMoney;
66
65
 
67
- export { formatMoney$1 as default };
66
+ export { formatMoney as default };
@@ -36,7 +36,7 @@ var mimeTypes = [
36
36
  ];
37
37
  function getMimeType(fileName) {
38
38
  var _a;
39
- var ext = getExtname(fileName).slice(1);
39
+ var ext = getExtname(fileName).slice(1).toLowerCase();
40
40
  return ext ? (_a = mimeTypes.find(function (item) { return item[1].includes(ext); })) === null || _a === void 0 ? void 0 : _a[0] : nativeUndefined;
41
41
  }
42
42
 
@@ -93,8 +93,8 @@ function numberToChinese(num, options) {
93
93
  unitChar = chnUnitChar.slice();
94
94
  decimal = decimal || '点';
95
95
  }
96
- var unitWan = (unitConfig === null || unitConfig === void 0 ? void 0 : unitConfig.w) || '万';
97
- var unitYi = (unitConfig === null || unitConfig === void 0 ? void 0 : unitConfig.y) || '亿';
96
+ var unitWan = unitConfig.w || '万';
97
+ var unitYi = unitConfig.y || '亿';
98
98
  var unitWanYi = unitWan + unitYi;
99
99
  unitSection = ['', unitWan, unitYi, unitWanYi];
100
100
  if (zero) {
@@ -29,6 +29,5 @@ var randomString = function (len, pool) {
29
29
  }
30
30
  return internalRandomString(toNumber(len), _pool);
31
31
  };
32
- var randomString$1 = randomString;
33
32
 
34
- export { randomString$1 as default };
33
+ export { randomString as default };
package/esm/safeDate.js CHANGED
@@ -11,6 +11,5 @@ var safeDate = function (value) {
11
11
  }
12
12
  return typeof safeValue === 'undefined' ? new Date() : new Date(safeValue);
13
13
  };
14
- var safeDate$1 = safeDate;
15
14
 
16
- export { safeDate$1 as default };
15
+ export { safeDate as default };
@@ -20,6 +20,5 @@ var transformObjectValue = function (data, fn, deep) {
20
20
  }
21
21
  return data;
22
22
  };
23
- var transformObjectValue$1 = transformObjectValue;
24
23
 
25
- export { transformObjectValue$1 as default };
24
+ export { transformObjectValue as default };
package/lib/AsyncMemo.js CHANGED
@@ -37,6 +37,5 @@ var AsyncMemo = (function () {
37
37
  };
38
38
  return AsyncMemo;
39
39
  }());
40
- var AsyncMemo$1 = AsyncMemo;
41
40
 
42
- module.exports = AsyncMemo$1;
41
+ module.exports = AsyncMemo;
package/lib/VERSION.js CHANGED
@@ -1,6 +1,5 @@
1
1
  'use strict';
2
2
 
3
- var VERSION = "5.4.0";
4
- var VERSION$1 = VERSION;
3
+ var VERSION = "5.4.2";
5
4
 
6
- module.exports = VERSION$1;
5
+ module.exports = VERSION;
@@ -69,6 +69,5 @@ var compressImage = function (img, options) {
69
69
  .catch(reject);
70
70
  });
71
71
  };
72
- var compressImage$1 = compressImage;
73
72
 
74
- module.exports = compressImage$1;
73
+ module.exports = compressImage;
package/lib/fileReader.js CHANGED
@@ -19,6 +19,5 @@ var fileReader = function (blob, type) {
19
19
  reader.onerror = function (error) { return reject(error); };
20
20
  });
21
21
  };
22
- var fileReader$1 = fileReader;
23
22
 
24
- module.exports = fileReader$1;
23
+ module.exports = fileReader;
@@ -64,6 +64,5 @@ var formatMoney = function (num, options) {
64
64
  var _e = tslib.__read(strNum.split('.'), 2), intStr = _e[0], decStr = _e[1];
65
65
  return symbol + formatInt(intStr, thousand) + formatDec(decStr, precision, decimal);
66
66
  };
67
- var formatMoney$1 = formatMoney;
68
67
 
69
- module.exports = formatMoney$1;
68
+ module.exports = formatMoney;
@@ -38,7 +38,7 @@ var mimeTypes = [
38
38
  ];
39
39
  function getMimeType(fileName) {
40
40
  var _a;
41
- var ext = getExtname(fileName).slice(1);
41
+ var ext = getExtname(fileName).slice(1).toLowerCase();
42
42
  return ext ? (_a = mimeTypes.find(function (item) { return item[1].includes(ext); })) === null || _a === void 0 ? void 0 : _a[0] : native.nativeUndefined;
43
43
  }
44
44
 
@@ -95,8 +95,8 @@ function numberToChinese(num, options) {
95
95
  unitChar = chnUnitChar.slice();
96
96
  decimal = decimal || '点';
97
97
  }
98
- var unitWan = (unitConfig === null || unitConfig === void 0 ? void 0 : unitConfig.w) || '万';
99
- var unitYi = (unitConfig === null || unitConfig === void 0 ? void 0 : unitConfig.y) || '亿';
98
+ var unitWan = unitConfig.w || '万';
99
+ var unitYi = unitConfig.y || '亿';
100
100
  var unitWanYi = unitWan + unitYi;
101
101
  unitSection = ['', unitWan, unitYi, unitWanYi];
102
102
  if (zero) {
@@ -31,6 +31,5 @@ var randomString = function (len, pool) {
31
31
  }
32
32
  return internalRandomString(ut2.toNumber(len), _pool);
33
33
  };
34
- var randomString$1 = randomString;
35
34
 
36
- module.exports = randomString$1;
35
+ module.exports = randomString;
package/lib/safeDate.js CHANGED
@@ -13,6 +13,5 @@ var safeDate = function (value) {
13
13
  }
14
14
  return typeof safeValue === 'undefined' ? new Date() : new Date(safeValue);
15
15
  };
16
- var safeDate$1 = safeDate;
17
16
 
18
- module.exports = safeDate$1;
17
+ module.exports = safeDate;
@@ -22,6 +22,5 @@ var transformObjectValue = function (data, fn, deep) {
22
22
  }
23
23
  return data;
24
24
  };
25
- var transformObjectValue$1 = transformObjectValue;
26
25
 
27
- module.exports = transformObjectValue$1;
26
+ module.exports = transformObjectValue;
@@ -1,10 +1,11 @@
1
1
  'use strict';
2
2
 
3
- exports.config = {
3
+ var config = {
4
4
  disableWarning: true
5
5
  };
6
6
  function setDisableWarning(bool) {
7
- exports.config.disableWarning = !!bool;
7
+ config.disableWarning = !!bool;
8
8
  }
9
9
 
10
+ exports.config = config;
10
11
  exports.setDisableWarning = setDisableWarning;
@@ -3,8 +3,14 @@
3
3
  var ut2 = require('ut2');
4
4
  var setup = require('./setup.js');
5
5
 
6
- exports.nativeUndefined = void 0;
7
- exports.objectKeys = Object.keys;
8
- exports.objectValues = Object.values;
9
- exports.createObjectURL = setup.URLExisted ? URL.createObjectURL : ut2.constant('');
10
- exports.revokeObjectURL = setup.URLExisted ? URL.revokeObjectURL : ut2.noop;
6
+ var nativeUndefined = void 0;
7
+ var objectKeys = Object.keys;
8
+ var objectValues = Object.values;
9
+ var createObjectURL = setup.URLExisted ? URL.createObjectURL : ut2.constant('');
10
+ var revokeObjectURL = setup.URLExisted ? URL.revokeObjectURL : ut2.noop;
11
+
12
+ exports.createObjectURL = createObjectURL;
13
+ exports.nativeUndefined = nativeUndefined;
14
+ exports.objectKeys = objectKeys;
15
+ exports.objectValues = objectValues;
16
+ exports.revokeObjectURL = revokeObjectURL;
@@ -1,3 +1,5 @@
1
1
  'use strict';
2
2
 
3
- exports.URLExisted = typeof URL !== 'undefined';
3
+ var URLExisted = typeof URL !== 'undefined';
4
+
5
+ exports.URLExisted = URLExisted;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "util-helpers",
3
- "version": "5.4.0",
3
+ "version": "5.4.2",
4
4
  "description": "一个基于业务场景的工具方法库",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",
@@ -11,9 +11,7 @@
11
11
  "test": "jest --verbose",
12
12
  "test:coverage": "jest --coverage",
13
13
  "test:coverage:local": "cross-env COVERAGE_LOCAL=1 jest --coverage && open ./coverage/lcov-report/index.html",
14
- "build": "npm run build:module && npm run build:dist && npm run build:types",
15
- "build:module": "rm -rf esm && rm -rf lib && rollup -c rollup.module.config.mjs",
16
- "build:dist": "rm -rf dist && rollup -c rollup.umd.config.mjs",
14
+ "build": "rm -rf esm lib dist && rollup -c && npm run build:types",
17
15
  "build:types": "rm -rf types && tsc -p tsconfig.build.json -d --outDir types --emitDeclarationOnly",
18
16
  "build:doc": "npm run doc",
19
17
  "doc": "rm -rf docs && rm -rf docs-src && tsc -p tsconfig.build.json -t esnext --outDir docs-src && jsdoc -c conf.json && rm -rf docs-src",
@@ -51,22 +49,17 @@
51
49
  },
52
50
  "homepage": "https://doly-dev.github.io/util-helpers/index.html",
53
51
  "devDependencies": {
54
- "@babel/core": "^7.26.0",
55
- "@babel/preset-env": "^7.26.0",
56
- "@babel/preset-typescript": "^7.26.0",
57
52
  "@commitlint/cli": "^17.8.1",
58
53
  "@commitlint/config-conventional": "^17.8.1",
59
54
  "@commitlint/cz-commitlint": "^17.8.1",
60
55
  "@rollup/plugin-commonjs": "^25.0.8",
61
- "@rollup/plugin-node-resolve": "^15.3.0",
56
+ "@rollup/plugin-node-resolve": "^15.3.1",
62
57
  "@rollup/plugin-replace": "^5.0.7",
63
58
  "@rollup/plugin-terser": "^0.4.4",
64
59
  "@rollup/plugin-typescript": "^11.1.6",
65
60
  "@types/jest": "^29.5.14",
66
61
  "@typescript-eslint/eslint-plugin": "^7.18.0",
67
62
  "@typescript-eslint/parser": "^7.18.0",
68
- "babel-jest": "^29.7.0",
69
- "babel-plugin-minify-replace": "^0.5.0",
70
63
  "commitizen": "^4.3.1",
71
64
  "cross-env": "^7.0.3",
72
65
  "docdash": "^2.0.2",
@@ -79,7 +72,8 @@
79
72
  "jsdoc": "^4.0.4",
80
73
  "lint-staged": "^13.3.0",
81
74
  "prettier": "^3.4.2",
82
- "rollup": "^4.28.0",
75
+ "rollup": "^4.28.1",
76
+ "ts-jest": "^29.2.5",
83
77
  "typescript": "^5.7.2"
84
78
  },
85
79
  "lint-staged": {