vimo-dt
Version:
A Vue2.x UI Project For Mobile & HyBrid
75 lines (67 loc) • 2.67 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.isPrimitive = isPrimitive;
exports.isTrueProperty = isTrueProperty;
exports.isCheckedProperty = isCheckedProperty;
var isBoolean = exports.isBoolean = function isBoolean(val) {
return typeof val === 'boolean';
};
var isString = exports.isString = function isString(val) {
return typeof val === 'string';
};
var isNumber = exports.isNumber = function isNumber(val) {
return typeof val === 'number';
};
var isFunction = exports.isFunction = function isFunction(val) {
return typeof val === 'function';
};
var isDefined = exports.isDefined = function isDefined(val) {
return typeof val !== 'undefined';
};
var isUndefined = exports.isUndefined = function isUndefined(val) {
return typeof val === 'undefined';
};
var isPresent = exports.isPresent = function isPresent(val) {
return val !== undefined && val !== null && val !== '';
};
var isBlank = exports.isBlank = function isBlank(val) {
return val === undefined || val === null;
};
var isDate = exports.isDate = function isDate(val) {
return Object.prototype.toString.call(val).match(/^(\[object )(\w+)\]$/i)[2].toLowerCase() === 'date';
};
var isArray = exports.isArray = Array.isArray;
var isObject = exports.isObject = function isObject(val) {
return (typeof val === 'undefined' ? 'undefined' : _typeof(val)) === 'object';
};
var isRegexp = exports.isRegexp = function isRegexp(val) {
return Object.prototype.toString.call(val).match(/^(\[object )(\w+)\]$/i)[2].toLowerCase() === 'regexp';
};
var isPlainObject = exports.isPlainObject = function isPlainObject(val) {
return isObject(val) && Object.getPrototypeOf(val) === Object.prototype;
};
function isPrimitive(val) {
return isString(val) || isBoolean(val) || isNumber(val) && !isNaN(val);
}
function isTrueProperty(val) {
if (typeof val === 'string') {
val = val.toLowerCase().trim();
return val === 'true' || val === 'on' || val === '';
}
return !!val;
}
function isCheckedProperty(a, b) {
if (a === undefined || a === null || a === '') {
return b === undefined || b === null || b === '';
} else if (a === true || a === 'true') {
return b === true || b === 'true';
} else if (a === false || a === 'false') {
return b === false || b === 'false';
} else if (a === 0 || a === '0') {
return b === 0 || b === '0';
}
return a == b;
}