util-helpers 5.5.1 → 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 +29 -26
- 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/isSocialCreditCode.js +2 -30
- package/esm/isUnifiedIdentifier.js +33 -0
- package/lib/VERSION.js +1 -1
- package/lib/index.js +4 -2
- package/lib/isSocialCreditCode.js +2 -30
- package/lib/isUnifiedIdentifier.js +35 -0
- package/package.json +1 -1
- package/types/index.d.ts +2 -1
- package/types/isBusinessLicense.d.ts +2 -0
- package/types/isSocialCreditCode.d.ts +4 -7
- 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
|
@@ -549,7 +549,7 @@
|
|
|
549
549
|
var checkCodeIndex = remainder !== 0 ? 31 - remainder : 0;
|
|
550
550
|
return baseCodeArr[checkCodeIndex];
|
|
551
551
|
}
|
|
552
|
-
function
|
|
552
|
+
function isUnifiedIdentifier(value, options) {
|
|
553
553
|
var valueStr = toString(value);
|
|
554
554
|
var _a = (options || {}).checkCode, needCheckCode = _a === void 0 ? true : _a;
|
|
555
555
|
var passBaseRule = baseReg$1.test(valueStr);
|
|
@@ -561,7 +561,9 @@
|
|
|
561
561
|
var checkCode = sumCheckCode$1(preCode);
|
|
562
562
|
return lastCode === checkCode;
|
|
563
563
|
}
|
|
564
|
-
|
|
564
|
+
isUnifiedIdentifier.sumCheckCode = sumCheckCode$1;
|
|
565
|
+
|
|
566
|
+
var isSocialCreditCode = isUnifiedIdentifier;
|
|
565
567
|
|
|
566
568
|
var config$1 = {
|
|
567
569
|
disableWarning: true
|
|
@@ -836,29 +838,6 @@
|
|
|
836
838
|
return typeof ret === 'number' && !isNaN(ret);
|
|
837
839
|
}
|
|
838
840
|
|
|
839
|
-
var checkResult = function () {
|
|
840
|
-
var args_1 = [];
|
|
841
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
842
|
-
args_1[_i] = arguments[_i];
|
|
843
|
-
}
|
|
844
|
-
return __awaiter(void 0, __spreadArray([], __read(args_1), false), void 0, function (fn) {
|
|
845
|
-
var _a, _b, err, ret;
|
|
846
|
-
if (fn === void 0) { fn = function () { return true; }; }
|
|
847
|
-
var args = [];
|
|
848
|
-
for (_a = 1; _a < arguments.length; _a++) {
|
|
849
|
-
args[_a - 1] = arguments[_a];
|
|
850
|
-
}
|
|
851
|
-
return __generator(this, function (_c) {
|
|
852
|
-
switch (_c.label) {
|
|
853
|
-
case 0: return [4, tryit(fn).apply(void 0, __spreadArray([], __read(args), false))];
|
|
854
|
-
case 1:
|
|
855
|
-
_b = __read.apply(void 0, [_c.sent(), 2]), err = _b[0], ret = _b[1];
|
|
856
|
-
return [2, !err && ret !== false];
|
|
857
|
-
}
|
|
858
|
-
});
|
|
859
|
-
});
|
|
860
|
-
};
|
|
861
|
-
|
|
862
841
|
var radixReg = /^[-+]?0[b|o|x]\d+/i;
|
|
863
842
|
var dotNumberStringReg = /^\.\d+/;
|
|
864
843
|
function transformEffectiveNumber(value) {
|
|
@@ -1973,6 +1952,29 @@
|
|
|
1973
1952
|
return len;
|
|
1974
1953
|
}
|
|
1975
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
|
+
|
|
1976
1978
|
function transformFieldNames(data, fieldNames, childrenField, nodeAssign) {
|
|
1977
1979
|
if (nodeAssign === void 0) { nodeAssign = 'spread'; }
|
|
1978
1980
|
if (!isArray(data)) {
|
|
@@ -2203,7 +2205,7 @@
|
|
|
2203
2205
|
return internalFindTreeSelect(tree, predicate, childrenField);
|
|
2204
2206
|
}
|
|
2205
2207
|
|
|
2206
|
-
var VERSION = "5.
|
|
2208
|
+
var VERSION = "5.6.0";
|
|
2207
2209
|
|
|
2208
2210
|
/**
|
|
2209
2211
|
* 事件触发器,支持浏览器端和 node 端。
|
|
@@ -3269,6 +3271,7 @@
|
|
|
3269
3271
|
exports.isSwiftCode = isSwiftCode;
|
|
3270
3272
|
exports.isTWCard = isTWCard;
|
|
3271
3273
|
exports.isTelephone = isTelephone;
|
|
3274
|
+
exports.isUnifiedIdentifier = isUnifiedIdentifier;
|
|
3272
3275
|
exports.isUrl = isUrl;
|
|
3273
3276
|
exports.isValidNumber = isValidNumber;
|
|
3274
3277
|
exports.isVehicle = isVehicle;
|