util-helpers 4.20.4 → 4.20.5
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/dist/util-helpers.js +14 -14
- 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/bytesToSize.js +2 -0
- package/esm/index.js +1 -1
- package/esm/isValidNumber.js +2 -2
- package/esm/numberToChinese.js +1 -0
- package/esm/randomString.js +3 -1
- package/esm/utils/math.util.js +3 -3
- package/lib/VERSION.js +1 -1
- package/lib/bytesToSize.js +3 -1
- package/lib/index.js +1 -1
- package/lib/isValidNumber.js +1 -1
- package/lib/numberToChinese.js +2 -1
- package/lib/randomString.js +3 -1
- package/lib/utils/math.util.js +2 -2
- package/package.json +1 -1
package/dist/util-helpers.js
CHANGED
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
return typeof value === 'number' || objectToString.call(value) === numberTag;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
function isNaN
|
|
106
|
+
function isNaN(value) {
|
|
107
107
|
return isNumber(value) && root$1.isNaN(value);
|
|
108
108
|
}
|
|
109
109
|
|
|
@@ -539,7 +539,7 @@
|
|
|
539
539
|
ret = Number(value);
|
|
540
540
|
}
|
|
541
541
|
}
|
|
542
|
-
return typeof ret === 'number' && !
|
|
542
|
+
return typeof ret === 'number' && !isNaN(ret);
|
|
543
543
|
}
|
|
544
544
|
|
|
545
545
|
/******************************************************************************
|
|
@@ -671,7 +671,7 @@
|
|
|
671
671
|
if (ret === '') {
|
|
672
672
|
ret = Number(ret);
|
|
673
673
|
}
|
|
674
|
-
else if (
|
|
674
|
+
else if (isNaN(Number(ret))) {
|
|
675
675
|
ret = Number.NaN;
|
|
676
676
|
}
|
|
677
677
|
}
|
|
@@ -684,7 +684,7 @@
|
|
|
684
684
|
else {
|
|
685
685
|
ret = value;
|
|
686
686
|
}
|
|
687
|
-
if (
|
|
687
|
+
if (isNaN(ret)) {
|
|
688
688
|
return Number.NaN;
|
|
689
689
|
}
|
|
690
690
|
return ret;
|
|
@@ -764,7 +764,7 @@
|
|
|
764
764
|
|
|
765
765
|
var reg = /^[+-]?\d*\.?\d*$/;
|
|
766
766
|
function checkNumber(num) {
|
|
767
|
-
if ((typeof num !== 'number' && typeof num !== 'string') || (typeof num === 'number' && isNaN
|
|
767
|
+
if ((typeof num !== 'number' && typeof num !== 'string') || (typeof num === 'number' && isNaN(num)) || (typeof num === 'string' && (!(reg.test(num) || isScientificNumber(num)) || num === ''))) {
|
|
768
768
|
devWarn("".concat(num, " invalid parameter."));
|
|
769
769
|
return false;
|
|
770
770
|
}
|
|
@@ -809,7 +809,7 @@
|
|
|
809
809
|
if (typeof num === 'number' && !isFinite(num)) {
|
|
810
810
|
return num + '';
|
|
811
811
|
}
|
|
812
|
-
if (typeof precision !== 'number' || isNaN
|
|
812
|
+
if (typeof precision !== 'number' || isNaN(precision) || precision < 0) {
|
|
813
813
|
precision = 2;
|
|
814
814
|
}
|
|
815
815
|
else if (precision > 10) {
|
|
@@ -1153,7 +1153,7 @@
|
|
|
1153
1153
|
}
|
|
1154
1154
|
num1 = transformEffectiveNumber(num1);
|
|
1155
1155
|
num2 = transformEffectiveNumber(num2);
|
|
1156
|
-
if (isNaN
|
|
1156
|
+
if (isNaN(num1) || isNaN(num2)) {
|
|
1157
1157
|
return Number.NaN;
|
|
1158
1158
|
}
|
|
1159
1159
|
var num1Changed = float2Fixed(num1);
|
|
@@ -1177,7 +1177,7 @@
|
|
|
1177
1177
|
}
|
|
1178
1178
|
num1 = transformEffectiveNumber(num1);
|
|
1179
1179
|
num2 = transformEffectiveNumber(num2);
|
|
1180
|
-
if (isNaN
|
|
1180
|
+
if (isNaN(num1) || isNaN(num2)) {
|
|
1181
1181
|
return Number.NaN;
|
|
1182
1182
|
}
|
|
1183
1183
|
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
@@ -1197,7 +1197,7 @@
|
|
|
1197
1197
|
}
|
|
1198
1198
|
num1 = transformEffectiveNumber(num1);
|
|
1199
1199
|
num2 = transformEffectiveNumber(num2);
|
|
1200
|
-
if (isNaN
|
|
1200
|
+
if (isNaN(num1) || isNaN(num2)) {
|
|
1201
1201
|
return Number.NaN;
|
|
1202
1202
|
}
|
|
1203
1203
|
var baseNum = Math.pow(10, Math.max(digitLength(num1), digitLength(num2)));
|
|
@@ -1217,7 +1217,7 @@
|
|
|
1217
1217
|
}
|
|
1218
1218
|
num1 = transformEffectiveNumber(num1);
|
|
1219
1219
|
num2 = transformEffectiveNumber(num2);
|
|
1220
|
-
if (isNaN
|
|
1220
|
+
if (isNaN(num1) || isNaN(num2)) {
|
|
1221
1221
|
return Number.NaN;
|
|
1222
1222
|
}
|
|
1223
1223
|
var num1Changed = float2Fixed(num1);
|
|
@@ -1245,7 +1245,7 @@
|
|
|
1245
1245
|
}
|
|
1246
1246
|
num1 = Math.abs(round(num1));
|
|
1247
1247
|
num2 = Math.abs(round(num2));
|
|
1248
|
-
if (isNaN
|
|
1248
|
+
if (isNaN(num1) || isNaN(num2)) {
|
|
1249
1249
|
return Number.NaN;
|
|
1250
1250
|
}
|
|
1251
1251
|
if (num1 === 0 && num2 === 0) {
|
|
@@ -1693,7 +1693,7 @@
|
|
|
1693
1693
|
function randomString(len, optionalChars) {
|
|
1694
1694
|
if (len === void 0) { len = 0; }
|
|
1695
1695
|
var realChars = typeof optionalChars === 'string' && optionalChars ? optionalChars : defaultChars;
|
|
1696
|
-
return internalRandomString(len, realChars);
|
|
1696
|
+
return internalRandomString(toNumber(len), realChars);
|
|
1697
1697
|
}
|
|
1698
1698
|
|
|
1699
1699
|
function strlen(str) {
|
|
@@ -1976,9 +1976,9 @@
|
|
|
1976
1976
|
return internalFindTreeSelect(tree, predicate, childrenField);
|
|
1977
1977
|
}
|
|
1978
1978
|
|
|
1979
|
-
var VERSION = "4.20.
|
|
1979
|
+
var VERSION = "4.20.5";
|
|
1980
1980
|
|
|
1981
|
-
var version = "4.20.
|
|
1981
|
+
var version = "4.20.5";
|
|
1982
1982
|
|
|
1983
1983
|
exports.VERSION = VERSION;
|
|
1984
1984
|
exports.ajax = ajax;
|