util-helpers 4.12.3 → 4.12.6
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/README.md +1 -1
- package/dist/util-helpers.js +10 -22
- package/dist/util-helpers.js.map +1 -1
- package/dist/util-helpers.min.js +1 -1
- package/dist/util-helpers.min.js.map +1 -1
- package/esm/parseIdCard.js +5 -14
- package/esm/utils/config.js +1 -1
- package/esm/utils/math.util.js +4 -41
- package/lib/parseIdCard.js +5 -16
- package/lib/utils/config.js +1 -1
- package/lib/utils/math.util.js +4 -43
- package/package.json +1 -1
- package/types/src/utils/math.util.d.ts +0 -8
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# util-helpers
|
|
2
2
|
|
|
3
|
-
[![npm][npm]][npm-url] 
|
|
3
|
+
[![npm][npm]][npm-url] [](https://github.com/doly-dev/util-helpers/actions/workflows/ci.yml) [](https://codecov.io/gh/doly-dev/util-helpers)  
|
|
4
4
|
|
|
5
5
|
[util-helpers](https://doly-dev.github.io/util-helpers/index.html) 是一个基于业务场景的工具方法库。
|
|
6
6
|
|
package/dist/util-helpers.js
CHANGED
|
@@ -562,7 +562,7 @@
|
|
|
562
562
|
return lastCode === checkCode;
|
|
563
563
|
}
|
|
564
564
|
|
|
565
|
-
const version = "4.12.
|
|
565
|
+
const version = "4.12.6";
|
|
566
566
|
|
|
567
567
|
var config = {
|
|
568
568
|
// 禁用warning提示
|
|
@@ -1676,18 +1676,13 @@
|
|
|
1676
1676
|
ret = Number.NaN;
|
|
1677
1677
|
}
|
|
1678
1678
|
} else if (isSymbol(value)) {
|
|
1679
|
-
ret = Number.NaN;
|
|
1680
|
-
} else if (!isNumber(value)) {
|
|
1681
|
-
// 其余非数字类型通过 Number 转换
|
|
1682
1679
|
// 例如 Symbol 包装器对象将会报错
|
|
1683
1680
|
// symObj = Object(Symbol());
|
|
1684
1681
|
// Number(symObj); // TypeError: Cannot convert a Symbol value to a number
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
console.error(err);
|
|
1690
|
-
}
|
|
1682
|
+
ret = Number.NaN;
|
|
1683
|
+
} else if (!isNumber(value)) {
|
|
1684
|
+
// 其余非数字类型通过 Number 转换
|
|
1685
|
+
ret = Number(value);
|
|
1691
1686
|
} else {
|
|
1692
1687
|
ret = value;
|
|
1693
1688
|
}
|
|
@@ -2505,24 +2500,17 @@
|
|
|
2505
2500
|
*/
|
|
2506
2501
|
|
|
2507
2502
|
function parseIdCard(id) {
|
|
2508
|
-
if (!
|
|
2509
|
-
loose: true
|
|
2510
|
-
})) {
|
|
2503
|
+
if (!regIdCard.test(id)) {
|
|
2511
2504
|
return null;
|
|
2512
2505
|
}
|
|
2506
|
+
/** @type {RegExpExecArray} */
|
|
2507
|
+
// @ts-ignore
|
|
2513
2508
|
|
|
2514
|
-
var info = regIdCard.exec(id);
|
|
2515
2509
|
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
}
|
|
2519
|
-
/**
|
|
2520
|
-
* @type {{ province: string, city: string, area: string, year: string, month: string, day: string, gender: string }}
|
|
2521
|
-
*
|
|
2522
|
-
*/
|
|
2510
|
+
var info = regIdCard.exec(id);
|
|
2511
|
+
/** @type {{ province: string, city: string, area: string, year: string, month: string, day: string, gender: string }} */
|
|
2523
2512
|
// @ts-ignore
|
|
2524
2513
|
|
|
2525
|
-
|
|
2526
2514
|
var origin = (info === null || info === void 0 ? void 0 : info.groups) || {
|
|
2527
2515
|
province: info[1],
|
|
2528
2516
|
city: info[2],
|