util-helpers 4.17.1 → 4.17.3
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 -0
- package/dist/util-helpers.js +27 -4
- 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/index.js +1 -0
- package/esm/isValidNumber.js +23 -0
- package/esm/utils/config.js +1 -1
- package/lib/index.js +2 -0
- package/lib/isValidNumber.js +25 -0
- package/lib/utils/config.js +1 -1
- package/package.json +23 -24
- package/types/ajax.d.ts +1 -1
- package/types/blobToDataURL.d.ts +1 -1
- package/types/calculateCursorPosition.d.ts +1 -1
- package/types/download.d.ts +7 -3
- package/types/fileReader.d.ts +0 -26
- package/types/filterTree.d.ts +3 -1
- package/types/index.d.ts +1 -0
- package/types/isIdCard.d.ts +3 -1
- package/types/isValidNumber.d.ts +33 -0
- package/types/numberToChinese.d.ts +1 -1
- package/types/safeDate.d.ts +0 -22
- package/types/setDataURLPrefix.d.ts +2 -1
- package/types/treeToList.d.ts +3 -6
- package/types/utils/type/isBlob.d.ts +1 -1
- package/types/utils/type/isError.d.ts +2 -2
- package/types/utils/type/isNil.d.ts +1 -1
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ formatBankCard('6228480402564890018', { spaceMark: '-' }); // 6228-4804-0256-489
|
|
|
92
92
|
- [isIPv4](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv4) - IPv4
|
|
93
93
|
- [isIPv6](https://doly-dev.github.io/util-helpers/module-Validator.html#.isIPv6) - IPv6
|
|
94
94
|
- [isUrl](https://doly-dev.github.io/util-helpers/module-Validator.html#.isUrl) - URL
|
|
95
|
+
- [isValidNumber](https://doly-dev.github.io/util-helpers/module-Validator.html#.isValidNumber) - 有效数字
|
|
95
96
|
- [isBusinessLicense](https://doly-dev.github.io/util-helpers/module-Validator.html#.isBusinessLicense) - 营业执照,也叫工商注册号
|
|
96
97
|
- [validatePassword](https://doly-dev.github.io/util-helpers/module-Validator.html#.validatePassword) - 验证密码
|
|
97
98
|
- 其他
|
package/dist/util-helpers.js
CHANGED
|
@@ -178,6 +178,8 @@
|
|
|
178
178
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
179
179
|
PERFORMANCE OF THIS SOFTWARE.
|
|
180
180
|
***************************************************************************** */
|
|
181
|
+
/* global Reflect, Promise */
|
|
182
|
+
|
|
181
183
|
|
|
182
184
|
var __assign = function() {
|
|
183
185
|
__assign = Object.assign || function __assign(t) {
|
|
@@ -273,7 +275,7 @@
|
|
|
273
275
|
function setDisableWarning(bool) {
|
|
274
276
|
config.disableWarning = !!bool;
|
|
275
277
|
}
|
|
276
|
-
var version = "4.17.
|
|
278
|
+
var version = "4.17.3";
|
|
277
279
|
|
|
278
280
|
function devWarn() {
|
|
279
281
|
var args = [];
|
|
@@ -522,9 +524,6 @@
|
|
|
522
524
|
return reg$1.test(valueStr);
|
|
523
525
|
}
|
|
524
526
|
|
|
525
|
-
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
526
|
-
var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
|
|
527
|
-
|
|
528
527
|
function isBlob(value) {
|
|
529
528
|
return isType(value, 'Blob');
|
|
530
529
|
}
|
|
@@ -546,6 +545,29 @@
|
|
|
546
545
|
return isType(value, 'Symbol');
|
|
547
546
|
}
|
|
548
547
|
|
|
548
|
+
function isValidNumber(value, strict) {
|
|
549
|
+
if (strict === void 0) { strict = false; }
|
|
550
|
+
var ret;
|
|
551
|
+
if (strict) {
|
|
552
|
+
ret = typeof value === 'string' && value !== '' ? Number(value) : value;
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
if (typeof value === 'number') {
|
|
556
|
+
ret = value;
|
|
557
|
+
}
|
|
558
|
+
else if (isSymbol(value)) {
|
|
559
|
+
ret = Number.NaN;
|
|
560
|
+
}
|
|
561
|
+
else {
|
|
562
|
+
ret = Number(value);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return typeof ret === 'number' && !Number.isNaN(ret);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
|
569
|
+
var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991;
|
|
570
|
+
|
|
549
571
|
function transformEffectiveNumber(value) {
|
|
550
572
|
var ret;
|
|
551
573
|
if (isString(value)) {
|
|
@@ -1598,6 +1620,7 @@
|
|
|
1598
1620
|
exports.isTWCard = isTWCard;
|
|
1599
1621
|
exports.isTelephone = isTelephone;
|
|
1600
1622
|
exports.isUrl = isUrl;
|
|
1623
|
+
exports.isValidNumber = isValidNumber;
|
|
1601
1624
|
exports.isVehicle = isVehicle;
|
|
1602
1625
|
exports.isWX = isWX;
|
|
1603
1626
|
exports.listToTree = listToTree;
|