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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # util-helpers
2
2
 
3
- [![npm][npm]][npm-url] ![GitHub](https://img.shields.io/github/license/doly-dev/util-helpers.svg)
3
+ [![npm][npm]][npm-url] [![Build and Deploy Docs](https://github.com/doly-dev/util-helpers/actions/workflows/ci.yml/badge.svg)](https://github.com/doly-dev/util-helpers/actions/workflows/ci.yml) [![codecov](https://codecov.io/gh/doly-dev/util-helpers/branch/master/graph/badge.svg?token=nhm6Zrmmyq)](https://codecov.io/gh/doly-dev/util-helpers) ![npm](https://img.shields.io/npm/dt/util-helpers) ![GitHub](https://img.shields.io/github/license/doly-dev/util-helpers.svg)
4
4
 
5
5
  [util-helpers](https://doly-dev.github.io/util-helpers/index.html) 是一个基于业务场景的工具方法库。
6
6
 
@@ -562,7 +562,7 @@
562
562
  return lastCode === checkCode;
563
563
  }
564
564
 
565
- const version = "4.12.3";
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
- try {
1686
- ret = Number(value);
1687
- } catch (err) {
1688
- ret = Number.NaN;
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 (!isIdCard(id, {
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
- if (!info) {
2517
- return null;
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],