42 lines
1.8 KiB
JavaScript
42 lines
1.8 KiB
JavaScript
var __defProp = Object.defineProperty;
|
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
var __export = (target, all) => {
|
|
for (var name in all)
|
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
};
|
|
var __copyProps = (to, from, except, desc) => {
|
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
for (let key of __getOwnPropNames(from))
|
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
}
|
|
return to;
|
|
};
|
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
var stdin_exports = {};
|
|
__export(stdin_exports, {
|
|
isDate: () => isDate,
|
|
isDef: () => isDef,
|
|
isFunction: () => isFunction,
|
|
isIOS: () => isIOS,
|
|
isMobile: () => isMobile,
|
|
isNumeric: () => isNumeric,
|
|
isObject: () => isObject,
|
|
isPromise: () => isPromise
|
|
});
|
|
module.exports = __toCommonJS(stdin_exports);
|
|
var import_basic = require("./basic");
|
|
const isDef = (val) => val !== void 0 && val !== null;
|
|
const isFunction = (val) => typeof val === "function";
|
|
const isObject = (val) => val !== null && typeof val === "object";
|
|
const isPromise = (val) => isObject(val) && isFunction(val.then) && isFunction(val.catch);
|
|
const isDate = (val) => Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
function isMobile(value) {
|
|
value = value.replace(/[^-|\d]/g, "");
|
|
return /^((\+86)|(86))?(1)\d{10}$/.test(value) || /^0[0-9-]{10,13}$/.test(value);
|
|
}
|
|
const isNumeric = (val) => typeof val === "number" || /^\d+(\.\d+)?$/.test(val);
|
|
const isIOS = () => import_basic.inBrowser ? /ios|iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase()) : false;
|