util-helpers 5.7.7 → 5.7.8

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.
@@ -423,7 +423,7 @@
423
423
  return reg$9.test(valueStr);
424
424
  }
425
425
 
426
- var regIdCard$1 = /^[1-9]\d{5}(19|20)\d{2}((0[1-9])|(1[012]))(([0-2][1-9])|10|20|30|31)\d{3}(\d|X)$/i;
426
+ var regIdCard$1 = /^[1-9]\d{5}(19|20)?\d{2}((0[1-9])|(1[012]))(([0-2][1-9])|10|20|30|31)\d{3}(\d|X)?$/i;
427
427
  function check(id) {
428
428
  var index, sum;
429
429
  for (sum = index = 0; index < 17; index++) {
@@ -439,10 +439,16 @@
439
439
  }
440
440
  function isIdCard(value, options) {
441
441
  if (options === void 0) { options = {}; }
442
- var _a = options.checkCode, checkCode = _a === void 0 ? true : _a;
442
+ var _a = options.loose, loose = _a === void 0 ? false : _a, _b = options.checkCode, checkCode = _b === void 0 ? true : _b;
443
443
  var valueStr = toString(value);
444
+ if (valueStr.length === 15 && loose) {
445
+ return regIdCard$1.test(valueStr);
446
+ }
444
447
  if (valueStr.length === 18 && regIdCard$1.test(valueStr)) {
445
- return checkCode ? check(valueStr) : true;
448
+ if (checkCode) {
449
+ return check(valueStr);
450
+ }
451
+ return true;
446
452
  }
447
453
  return false;
448
454
  }
@@ -2196,7 +2202,7 @@
2196
2202
  return internalFindTreeSelect(tree, predicate, childrenField);
2197
2203
  }
2198
2204
 
2199
- var VERSION = "5.7.7";
2205
+ var VERSION = "5.7.8";
2200
2206
 
2201
2207
  /**
2202
2208
  * 事件触发器,支持浏览器端和 node 端。