@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.es.js
CHANGED
|
@@ -54,7 +54,7 @@ function isUndefined(input) {
|
|
|
54
54
|
return input === void 0;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function isNumber(input) {
|
|
57
|
+
function isNumber$1(input) {
|
|
58
58
|
return (
|
|
59
59
|
typeof input === 'number' ||
|
|
60
60
|
Object.prototype.toString.call(input) === '[object Number]'
|
|
@@ -825,7 +825,7 @@ function addParseToken(token, callback) {
|
|
|
825
825
|
if (typeof token === 'string') {
|
|
826
826
|
token = [token];
|
|
827
827
|
}
|
|
828
|
-
if (isNumber(callback)) {
|
|
828
|
+
if (isNumber$1(callback)) {
|
|
829
829
|
func = function (input, array) {
|
|
830
830
|
array[callback] = toInt(input);
|
|
831
831
|
};
|
|
@@ -1095,7 +1095,7 @@ function setMonth(mom, value) {
|
|
|
1095
1095
|
} else {
|
|
1096
1096
|
value = mom.localeData().monthsParse(value);
|
|
1097
1097
|
// TODO: Another silent failure?
|
|
1098
|
-
if (!isNumber(value)) {
|
|
1098
|
+
if (!isNumber$1(value)) {
|
|
1099
1099
|
return mom;
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
@@ -2976,7 +2976,7 @@ function configFromInput(config) {
|
|
|
2976
2976
|
configFromArray(config);
|
|
2977
2977
|
} else if (isObject(input)) {
|
|
2978
2978
|
configFromObject(config);
|
|
2979
|
-
} else if (isNumber(input)) {
|
|
2979
|
+
} else if (isNumber$1(input)) {
|
|
2980
2980
|
// from milliseconds
|
|
2981
2981
|
config._d = new Date(input);
|
|
2982
2982
|
} else {
|
|
@@ -3450,7 +3450,7 @@ function createDuration(input, key) {
|
|
|
3450
3450
|
d: input._days,
|
|
3451
3451
|
M: input._months,
|
|
3452
3452
|
};
|
|
3453
|
-
} else if (isNumber(input) || !isNaN(+input)) {
|
|
3453
|
+
} else if (isNumber$1(input) || !isNaN(+input)) {
|
|
3454
3454
|
duration = {};
|
|
3455
3455
|
if (key) {
|
|
3456
3456
|
duration[key] = +input;
|
|
@@ -3617,7 +3617,7 @@ function isMomentInput(input) {
|
|
|
3617
3617
|
isMoment(input) ||
|
|
3618
3618
|
isDate(input) ||
|
|
3619
3619
|
isString(input) ||
|
|
3620
|
-
isNumber(input) ||
|
|
3620
|
+
isNumber$1(input) ||
|
|
3621
3621
|
isNumberOrStringArray(input) ||
|
|
3622
3622
|
isMomentInputObject(input) ||
|
|
3623
3623
|
input === null ||
|
|
@@ -3671,7 +3671,7 @@ function isNumberOrStringArray(input) {
|
|
|
3671
3671
|
if (arrayTest) {
|
|
3672
3672
|
dataTypeTest =
|
|
3673
3673
|
input.filter(function (item) {
|
|
3674
|
-
return !isNumber(item) && isString(input);
|
|
3674
|
+
return !isNumber$1(item) && isString(input);
|
|
3675
3675
|
}).length === 0;
|
|
3676
3676
|
}
|
|
3677
3677
|
return arrayTest && dataTypeTest;
|
|
@@ -5031,7 +5031,7 @@ function get$1(format, index, field, setter) {
|
|
|
5031
5031
|
}
|
|
5032
5032
|
|
|
5033
5033
|
function listMonthsImpl(format, index, field) {
|
|
5034
|
-
if (isNumber(format)) {
|
|
5034
|
+
if (isNumber$1(format)) {
|
|
5035
5035
|
index = format;
|
|
5036
5036
|
format = undefined;
|
|
5037
5037
|
}
|
|
@@ -5060,7 +5060,7 @@ function listMonthsImpl(format, index, field) {
|
|
|
5060
5060
|
// (true, fmt)
|
|
5061
5061
|
function listWeekdaysImpl(localeSorted, format, index, field) {
|
|
5062
5062
|
if (typeof localeSorted === 'boolean') {
|
|
5063
|
-
if (isNumber(format)) {
|
|
5063
|
+
if (isNumber$1(format)) {
|
|
5064
5064
|
index = format;
|
|
5065
5065
|
format = undefined;
|
|
5066
5066
|
}
|
|
@@ -5071,7 +5071,7 @@ function listWeekdaysImpl(localeSorted, format, index, field) {
|
|
|
5071
5071
|
index = format;
|
|
5072
5072
|
localeSorted = false;
|
|
5073
5073
|
|
|
5074
|
-
if (isNumber(format)) {
|
|
5074
|
+
if (isNumber$1(format)) {
|
|
5075
5075
|
index = format;
|
|
5076
5076
|
format = undefined;
|
|
5077
5077
|
}
|
|
@@ -5659,6 +5659,13 @@ hooks.HTML5_FMT = {
|
|
|
5659
5659
|
MONTH: 'YYYY-MM', // <input type="month" />
|
|
5660
5660
|
};
|
|
5661
5661
|
|
|
5662
|
+
var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
5663
|
+
NodeType2["CONTAINER"] = "container";
|
|
5664
|
+
NodeType2["PAGE"] = "page";
|
|
5665
|
+
NodeType2["ROOT"] = "app";
|
|
5666
|
+
return NodeType2;
|
|
5667
|
+
})(NodeType || {});
|
|
5668
|
+
|
|
5662
5669
|
const sleep = (ms) => new Promise((resolve) => {
|
|
5663
5670
|
const timer = setTimeout(() => {
|
|
5664
5671
|
clearTimeout(timer);
|
|
@@ -5798,6 +5805,8 @@ const getUrlParam = (param, url) => {
|
|
|
5798
5805
|
return "";
|
|
5799
5806
|
};
|
|
5800
5807
|
const isPop = (node) => Boolean(node.type?.toLowerCase().endsWith("pop"));
|
|
5808
|
+
const isPage = (node) => Boolean(node.type?.toLowerCase() === NodeType.PAGE);
|
|
5809
|
+
const isNumber = (value) => /^(\d|\.)+$/.test(value);
|
|
5801
5810
|
|
|
5802
|
-
export { asyncLoadCss, asyncLoadJs, datetimeFormatter, emptyFn, filterXSS, getNodePath, getUrlParam, isPop, sleep, toHump, toLine };
|
|
5811
|
+
export { asyncLoadCss, asyncLoadJs, datetimeFormatter, emptyFn, filterXSS, getNodePath, getUrlParam, isNumber, isPage, isPop, sleep, toHump, toLine };
|
|
5803
5812
|
//# sourceMappingURL=tmagic-utils.es.js.map
|