@antmjs/vantui
Version:
一套适用于Taro3及React的vantui组件库
47 lines (46 loc) • 1.47 kB
JavaScript
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isBoolean = isBoolean;
exports.isDef = isDef;
exports.isFunction = isFunction;
exports.isImageUrl = isImageUrl;
exports.isNumber = isNumber;
exports.isObj = isObj;
exports.isPlainObject = isPlainObject;
exports.isPromise = isPromise;
exports.isVideoUrl = isVideoUrl;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
// eslint-disable-next-line @typescript-eslint/ban-types
function isFunction(val) {
return typeof val === 'function';
}
function isPlainObject(val) {
return val !== null && (0, _typeof2.default)(val) === 'object' && !Array.isArray(val);
}
function isPromise(val) {
return isPlainObject(val) && isFunction(val.then) && isFunction(val.catch);
}
function isDef(value) {
return value !== undefined && value !== null;
}
function isObj(x) {
var type = (0, _typeof2.default)(x);
return x !== null && (type === 'object' || type === 'function');
}
function isNumber(value) {
return /^\d+(\.\d+)?$/.test(value);
}
function isBoolean(value) {
return typeof value === 'boolean';
}
var IMAGE_REGEXP = /\.(jpeg|jpg|gif|png|svg|webp|jfif|bmp|dpg)/i;
var VIDEO_REGEXP = /\.(mp4|mpg|mpeg|dat|asf|avi|rm|rmvb|mov|wmv|flv|mkv)/i;
function isImageUrl(url) {
return IMAGE_REGEXP.test(url);
}
function isVideoUrl(url) {
return VIDEO_REGEXP.test(url);
}
;