util-helpers 4.12.5 → 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.
@@ -4,8 +4,6 @@ import _setPrototypeOf from "@babel/runtime/helpers/setPrototypeOf";
4
4
 
5
5
  function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
6
6
 
7
- import isIdCard from './isIdCard';
8
-
9
7
  var regIdCard = /*#__PURE__*/_wrapRegExp(/^([0-9]{2})([0-9]{2})([0-9]{2})((?:[0-9]{2})?[0-9]{2})([0-9]{2})([0-9]{2})[0-9]{2}([0-9])(?:[0-9]|X)?$/i, {
10
8
  province: 1,
11
9
  city: 2,
@@ -93,24 +91,17 @@ var Provinces = [// 华北地区:北京市|110000,天津市|120000,河北
93
91
  */
94
92
 
95
93
  function parseIdCard(id) {
96
- if (!isIdCard(id, {
97
- loose: true
98
- })) {
94
+ if (!regIdCard.test(id)) {
99
95
  return null;
100
96
  }
97
+ /** @type {RegExpExecArray} */
98
+ // @ts-ignore
101
99
 
102
- var info = regIdCard.exec(id);
103
100
 
104
- if (!info) {
105
- return null;
106
- }
107
- /**
108
- * @type {{ province: string, city: string, area: string, year: string, month: string, day: string, gender: string }}
109
- *
110
- */
101
+ var info = regIdCard.exec(id);
102
+ /** @type {{ province: string, city: string, area: string, year: string, month: string, day: string, gender: string }} */
111
103
  // @ts-ignore
112
104
 
113
-
114
105
  var origin = (info === null || info === void 0 ? void 0 : info.groups) || {
115
106
  province: info[1],
116
107
  city: info[2],
@@ -1,4 +1,4 @@
1
- var version = "4.12.5";
1
+ var version = "4.12.6";
2
2
  var config = {
3
3
  // 禁用warning提示
4
4
  disableWarning: true
@@ -7,10 +7,6 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- var _isIdCard = _interopRequireDefault(require("./isIdCard"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
10
  function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
15
11
 
16
12
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
@@ -104,24 +100,17 @@ var Provinces = [// 华北地区:北京市|110000,天津市|120000,河北
104
100
  */
105
101
 
106
102
  function parseIdCard(id) {
107
- if (!(0, _isIdCard["default"])(id, {
108
- loose: true
109
- })) {
103
+ if (!regIdCard.test(id)) {
110
104
  return null;
111
105
  }
106
+ /** @type {RegExpExecArray} */
107
+ // @ts-ignore
112
108
 
113
- var info = regIdCard.exec(id);
114
109
 
115
- if (!info) {
116
- return null;
117
- }
118
- /**
119
- * @type {{ province: string, city: string, area: string, year: string, month: string, day: string, gender: string }}
120
- *
121
- */
110
+ var info = regIdCard.exec(id);
111
+ /** @type {{ province: string, city: string, area: string, year: string, month: string, day: string, gender: string }} */
122
112
  // @ts-ignore
123
113
 
124
-
125
114
  var origin = (info === null || info === void 0 ? void 0 : info.groups) || {
126
115
  province: info[1],
127
116
  city: info[2],
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.setDisableWarning = setDisableWarning;
7
7
  exports.version = exports.config = void 0;
8
- var version = "4.12.5";
8
+ var version = "4.12.6";
9
9
  exports.version = version;
10
10
  var config = {
11
11
  // 禁用warning提示
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "util-helpers",
3
- "version": "4.12.5",
3
+ "version": "4.12.6",
4
4
  "description": "一个基于业务场景的工具方法库",
5
5
  "main": "lib/index.js",
6
6
  "module": "esm/index.js",