@tmagic/utils 1.0.0-beta.11 → 1.0.0-beta.12
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/tmagic-utils.es.js +20 -11
- package/dist/tmagic-utils.es.js.map +1 -1
- package/dist/tmagic-utils.umd.js +21 -10
- package/dist/tmagic-utils.umd.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +6 -2
- package/src/index.ts +5 -1
package/dist/tmagic-utils.umd.js
CHANGED
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
return input === void 0;
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
function isNumber(input) {
|
|
63
|
+
function isNumber$1(input) {
|
|
64
64
|
return (
|
|
65
65
|
typeof input === 'number' ||
|
|
66
66
|
Object.prototype.toString.call(input) === '[object Number]'
|
|
@@ -831,7 +831,7 @@
|
|
|
831
831
|
if (typeof token === 'string') {
|
|
832
832
|
token = [token];
|
|
833
833
|
}
|
|
834
|
-
if (isNumber(callback)) {
|
|
834
|
+
if (isNumber$1(callback)) {
|
|
835
835
|
func = function (input, array) {
|
|
836
836
|
array[callback] = toInt(input);
|
|
837
837
|
};
|
|
@@ -1101,7 +1101,7 @@
|
|
|
1101
1101
|
} else {
|
|
1102
1102
|
value = mom.localeData().monthsParse(value);
|
|
1103
1103
|
// TODO: Another silent failure?
|
|
1104
|
-
if (!isNumber(value)) {
|
|
1104
|
+
if (!isNumber$1(value)) {
|
|
1105
1105
|
return mom;
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
@@ -2982,7 +2982,7 @@
|
|
|
2982
2982
|
configFromArray(config);
|
|
2983
2983
|
} else if (isObject(input)) {
|
|
2984
2984
|
configFromObject(config);
|
|
2985
|
-
} else if (isNumber(input)) {
|
|
2985
|
+
} else if (isNumber$1(input)) {
|
|
2986
2986
|
// from milliseconds
|
|
2987
2987
|
config._d = new Date(input);
|
|
2988
2988
|
} else {
|
|
@@ -3456,7 +3456,7 @@
|
|
|
3456
3456
|
d: input._days,
|
|
3457
3457
|
M: input._months,
|
|
3458
3458
|
};
|
|
3459
|
-
} else if (isNumber(input) || !isNaN(+input)) {
|
|
3459
|
+
} else if (isNumber$1(input) || !isNaN(+input)) {
|
|
3460
3460
|
duration = {};
|
|
3461
3461
|
if (key) {
|
|
3462
3462
|
duration[key] = +input;
|
|
@@ -3623,7 +3623,7 @@
|
|
|
3623
3623
|
isMoment(input) ||
|
|
3624
3624
|
isDate(input) ||
|
|
3625
3625
|
isString(input) ||
|
|
3626
|
-
isNumber(input) ||
|
|
3626
|
+
isNumber$1(input) ||
|
|
3627
3627
|
isNumberOrStringArray(input) ||
|
|
3628
3628
|
isMomentInputObject(input) ||
|
|
3629
3629
|
input === null ||
|
|
@@ -3677,7 +3677,7 @@
|
|
|
3677
3677
|
if (arrayTest) {
|
|
3678
3678
|
dataTypeTest =
|
|
3679
3679
|
input.filter(function (item) {
|
|
3680
|
-
return !isNumber(item) && isString(input);
|
|
3680
|
+
return !isNumber$1(item) && isString(input);
|
|
3681
3681
|
}).length === 0;
|
|
3682
3682
|
}
|
|
3683
3683
|
return arrayTest && dataTypeTest;
|
|
@@ -5037,7 +5037,7 @@
|
|
|
5037
5037
|
}
|
|
5038
5038
|
|
|
5039
5039
|
function listMonthsImpl(format, index, field) {
|
|
5040
|
-
if (isNumber(format)) {
|
|
5040
|
+
if (isNumber$1(format)) {
|
|
5041
5041
|
index = format;
|
|
5042
5042
|
format = undefined;
|
|
5043
5043
|
}
|
|
@@ -5066,7 +5066,7 @@
|
|
|
5066
5066
|
// (true, fmt)
|
|
5067
5067
|
function listWeekdaysImpl(localeSorted, format, index, field) {
|
|
5068
5068
|
if (typeof localeSorted === 'boolean') {
|
|
5069
|
-
if (isNumber(format)) {
|
|
5069
|
+
if (isNumber$1(format)) {
|
|
5070
5070
|
index = format;
|
|
5071
5071
|
format = undefined;
|
|
5072
5072
|
}
|
|
@@ -5077,7 +5077,7 @@
|
|
|
5077
5077
|
index = format;
|
|
5078
5078
|
localeSorted = false;
|
|
5079
5079
|
|
|
5080
|
-
if (isNumber(format)) {
|
|
5080
|
+
if (isNumber$1(format)) {
|
|
5081
5081
|
index = format;
|
|
5082
5082
|
format = undefined;
|
|
5083
5083
|
}
|
|
@@ -5665,6 +5665,13 @@
|
|
|
5665
5665
|
MONTH: 'YYYY-MM', // <input type="month" />
|
|
5666
5666
|
};
|
|
5667
5667
|
|
|
5668
|
+
var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
5669
|
+
NodeType2["CONTAINER"] = "container";
|
|
5670
|
+
NodeType2["PAGE"] = "page";
|
|
5671
|
+
NodeType2["ROOT"] = "app";
|
|
5672
|
+
return NodeType2;
|
|
5673
|
+
})(NodeType || {});
|
|
5674
|
+
|
|
5668
5675
|
const sleep = (ms) => new Promise((resolve) => {
|
|
5669
5676
|
const timer = setTimeout(() => {
|
|
5670
5677
|
clearTimeout(timer);
|
|
@@ -5804,6 +5811,8 @@
|
|
|
5804
5811
|
return "";
|
|
5805
5812
|
};
|
|
5806
5813
|
const isPop = (node) => Boolean(node.type?.toLowerCase().endsWith("pop"));
|
|
5814
|
+
const isPage = (node) => Boolean(node.type?.toLowerCase() === NodeType.PAGE);
|
|
5815
|
+
const isNumber = (value) => /^(\d|\.)+$/.test(value);
|
|
5807
5816
|
|
|
5808
5817
|
exports.asyncLoadCss = asyncLoadCss;
|
|
5809
5818
|
exports.asyncLoadJs = asyncLoadJs;
|
|
@@ -5812,6 +5821,8 @@
|
|
|
5812
5821
|
exports.filterXSS = filterXSS;
|
|
5813
5822
|
exports.getNodePath = getNodePath;
|
|
5814
5823
|
exports.getUrlParam = getUrlParam;
|
|
5824
|
+
exports.isNumber = isNumber;
|
|
5825
|
+
exports.isPage = isPage;
|
|
5815
5826
|
exports.isPop = isPop;
|
|
5816
5827
|
exports.sleep = sleep;
|
|
5817
5828
|
exports.toHump = toHump;
|