util-helpers 5.5.0 → 5.6.0
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 -2
- package/dist/util-helpers.js +31 -25
- 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/VERSION.js +1 -1
- package/esm/index.js +2 -1
- package/esm/isBankCard.js +1 -0
- package/esm/isBusinessLicense.js +1 -0
- package/esm/isSocialCreditCode.js +2 -29
- package/esm/isUnifiedIdentifier.js +33 -0
- package/lib/VERSION.js +1 -1
- package/lib/index.js +4 -2
- package/lib/isBankCard.js +1 -0
- package/lib/isBusinessLicense.js +1 -0
- package/lib/isSocialCreditCode.js +2 -29
- package/lib/isUnifiedIdentifier.js +35 -0
- package/package.json +1 -1
- package/types/index.d.ts +2 -1
- package/types/isBankCard.d.ts +3 -0
- package/types/isBusinessLicense.d.ts +5 -0
- package/types/isSocialCreditCode.d.ts +4 -4
- package/types/isUnifiedIdentifier.d.ts +30 -0
package/README.md
CHANGED
|
@@ -88,7 +88,6 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
88
88
|
- [treeToList](https://doly-dev.github.io/util-helpers/module-Processor.html#.treeToList) - 树结构转列表数据
|
|
89
89
|
- 数据验证
|
|
90
90
|
- [isBankCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isBankCard) - 银行卡
|
|
91
|
-
- [isBusinessLicense](https://doly-dev.github.io/util-helpers/module-Validator.html#.isBusinessLicense) - 营业执照,也叫工商注册号
|
|
92
91
|
- [isChinese](https://doly-dev.github.io/util-helpers/module-Validator.html#.isChinese) - 中文
|
|
93
92
|
- [isEmail](https://doly-dev.github.io/util-helpers/module-Validator.html#.isEmail) - 邮箱
|
|
94
93
|
- [isHMCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isHMCard) - 港澳居民来往内地通行证,俗称回乡证或回乡卡
|
|
@@ -100,10 +99,10 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
100
99
|
- [isPassword](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPassword) 密码强度
|
|
101
100
|
- [isPostcode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isPostcode) - 邮政编码
|
|
102
101
|
- [isQQ](https://doly-dev.github.io/util-helpers/module-Validator.html#.isQQ) - QQ 号
|
|
103
|
-
- [isSocialCreditCode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isSocialCreditCode) - 统一社会信用代码,也叫三证合一组织代码
|
|
104
102
|
- [isSwiftCode](https://doly-dev.github.io/util-helpers/module-Validator.html#.isSwiftCode) - Swift Code
|
|
105
103
|
- [isTWCard](https://doly-dev.github.io/util-helpers/module-Validator.html#.isTWCard) - 台湾居民来往大陆通行证,俗称台胞证
|
|
106
104
|
- [isTelephone](https://doly-dev.github.io/util-helpers/module-Validator.html#.isTelephone) - 固定电话
|
|
105
|
+
- [isUnifiedIdentifier](https://doly-dev.github.io/util-helpers/module-Validator.html#.isUnifiedIdentifier) - 统一社会信用代码,也叫三证合一组织代码
|
|
107
106
|
- [isUrl](https://doly-dev.github.io/util-helpers/module-Validator.html#.isUrl) - URL
|
|
108
107
|
- [isValidNumber](https://doly-dev.github.io/util-helpers/module-Validator.html#.isValidNumber) - 有效数字
|
|
109
108
|
- [isVehicle](https://doly-dev.github.io/util-helpers/module-Validator.html#.isVehicle) - 车牌号
|
package/dist/util-helpers.js
CHANGED
|
@@ -531,6 +531,7 @@
|
|
|
531
531
|
}
|
|
532
532
|
return validateResult;
|
|
533
533
|
}
|
|
534
|
+
isBankCard.sumCheckCode = sumCheckCode$2;
|
|
534
535
|
|
|
535
536
|
var baseReg$1 = /^[\dA-HJ-NPQRTUWXY]{2}\d{6}[\dA-HJ-NPQRTUWXY]{10}$/;
|
|
536
537
|
var baseCodeArr = '0123456789ABCDEFGHJKLMNPQRTUWXY'.split('');
|
|
@@ -548,7 +549,7 @@
|
|
|
548
549
|
var checkCodeIndex = remainder !== 0 ? 31 - remainder : 0;
|
|
549
550
|
return baseCodeArr[checkCodeIndex];
|
|
550
551
|
}
|
|
551
|
-
function
|
|
552
|
+
function isUnifiedIdentifier(value, options) {
|
|
552
553
|
var valueStr = toString(value);
|
|
553
554
|
var _a = (options || {}).checkCode, needCheckCode = _a === void 0 ? true : _a;
|
|
554
555
|
var passBaseRule = baseReg$1.test(valueStr);
|
|
@@ -560,6 +561,9 @@
|
|
|
560
561
|
var checkCode = sumCheckCode$1(preCode);
|
|
561
562
|
return lastCode === checkCode;
|
|
562
563
|
}
|
|
564
|
+
isUnifiedIdentifier.sumCheckCode = sumCheckCode$1;
|
|
565
|
+
|
|
566
|
+
var isSocialCreditCode = isUnifiedIdentifier;
|
|
563
567
|
|
|
564
568
|
var config$1 = {
|
|
565
569
|
disableWarning: true
|
|
@@ -788,6 +792,7 @@
|
|
|
788
792
|
var checkCode = sumCheckCode(preCode);
|
|
789
793
|
return lastCode === String(checkCode);
|
|
790
794
|
}
|
|
795
|
+
isBusinessLicense.sumCheckCode = sumCheckCode;
|
|
791
796
|
|
|
792
797
|
var regHMCard = /^[hm]{1}([0-9]{10}|[0-9]{8})$/i;
|
|
793
798
|
function isHMCard(value) {
|
|
@@ -833,29 +838,6 @@
|
|
|
833
838
|
return typeof ret === 'number' && !isNaN(ret);
|
|
834
839
|
}
|
|
835
840
|
|
|
836
|
-
var checkResult = function () {
|
|
837
|
-
var args_1 = [];
|
|
838
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
839
|
-
args_1[_i] = arguments[_i];
|
|
840
|
-
}
|
|
841
|
-
return __awaiter(void 0, __spreadArray([], __read(args_1), false), void 0, function (fn) {
|
|
842
|
-
var _a, _b, err, ret;
|
|
843
|
-
if (fn === void 0) { fn = function () { return true; }; }
|
|
844
|
-
var args = [];
|
|
845
|
-
for (_a = 1; _a < arguments.length; _a++) {
|
|
846
|
-
args[_a - 1] = arguments[_a];
|
|
847
|
-
}
|
|
848
|
-
return __generator(this, function (_c) {
|
|
849
|
-
switch (_c.label) {
|
|
850
|
-
case 0: return [4, tryit(fn).apply(void 0, __spreadArray([], __read(args), false))];
|
|
851
|
-
case 1:
|
|
852
|
-
_b = __read.apply(void 0, [_c.sent(), 2]), err = _b[0], ret = _b[1];
|
|
853
|
-
return [2, !err && ret !== false];
|
|
854
|
-
}
|
|
855
|
-
});
|
|
856
|
-
});
|
|
857
|
-
};
|
|
858
|
-
|
|
859
841
|
var radixReg = /^[-+]?0[b|o|x]\d+/i;
|
|
860
842
|
var dotNumberStringReg = /^\.\d+/;
|
|
861
843
|
function transformEffectiveNumber(value) {
|
|
@@ -1970,6 +1952,29 @@
|
|
|
1970
1952
|
return len;
|
|
1971
1953
|
}
|
|
1972
1954
|
|
|
1955
|
+
var checkResult = function () {
|
|
1956
|
+
var args_1 = [];
|
|
1957
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
1958
|
+
args_1[_i] = arguments[_i];
|
|
1959
|
+
}
|
|
1960
|
+
return __awaiter(void 0, __spreadArray([], __read(args_1), false), void 0, function (fn) {
|
|
1961
|
+
var _a, _b, err, ret;
|
|
1962
|
+
if (fn === void 0) { fn = function () { return true; }; }
|
|
1963
|
+
var args = [];
|
|
1964
|
+
for (_a = 1; _a < arguments.length; _a++) {
|
|
1965
|
+
args[_a - 1] = arguments[_a];
|
|
1966
|
+
}
|
|
1967
|
+
return __generator(this, function (_c) {
|
|
1968
|
+
switch (_c.label) {
|
|
1969
|
+
case 0: return [4, tryit(fn).apply(void 0, __spreadArray([], __read(args), false))];
|
|
1970
|
+
case 1:
|
|
1971
|
+
_b = __read.apply(void 0, [_c.sent(), 2]), err = _b[0], ret = _b[1];
|
|
1972
|
+
return [2, !err && ret !== false];
|
|
1973
|
+
}
|
|
1974
|
+
});
|
|
1975
|
+
});
|
|
1976
|
+
};
|
|
1977
|
+
|
|
1973
1978
|
function transformFieldNames(data, fieldNames, childrenField, nodeAssign) {
|
|
1974
1979
|
if (nodeAssign === void 0) { nodeAssign = 'spread'; }
|
|
1975
1980
|
if (!isArray(data)) {
|
|
@@ -2200,7 +2205,7 @@
|
|
|
2200
2205
|
return internalFindTreeSelect(tree, predicate, childrenField);
|
|
2201
2206
|
}
|
|
2202
2207
|
|
|
2203
|
-
var VERSION = "5.
|
|
2208
|
+
var VERSION = "5.6.0";
|
|
2204
2209
|
|
|
2205
2210
|
/**
|
|
2206
2211
|
* 事件触发器,支持浏览器端和 node 端。
|
|
@@ -3266,6 +3271,7 @@
|
|
|
3266
3271
|
exports.isSwiftCode = isSwiftCode;
|
|
3267
3272
|
exports.isTWCard = isTWCard;
|
|
3268
3273
|
exports.isTelephone = isTelephone;
|
|
3274
|
+
exports.isUnifiedIdentifier = isUnifiedIdentifier;
|
|
3269
3275
|
exports.isUrl = isUrl;
|
|
3270
3276
|
exports.isValidNumber = isValidNumber;
|
|
3271
3277
|
exports.isVehicle = isVehicle;
|