UNPKG

bootstrap-vue

Version:

With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens

77 lines (73 loc) 2.92 kB
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } import { RX_NUMBER } from '../constants/regex'; import { File } from '../constants/safe-types'; // --- Convenience inspection utilities --- export var toType = function toType(value) { return _typeof(value); }; export var toRawType = function toRawType(value) { return Object.prototype.toString.call(value).slice(8, -1); }; export var toRawTypeLC = function toRawTypeLC(value) { return toRawType(value).toLowerCase(); }; export var isUndefined = function isUndefined(value) { return value === undefined; }; export var isNull = function isNull(value) { return value === null; }; export var isEmptyString = function isEmptyString(value) { return value === ''; }; export var isUndefinedOrNull = function isUndefinedOrNull(value) { return isUndefined(value) || isNull(value); }; export var isUndefinedOrNullOrEmpty = function isUndefinedOrNullOrEmpty(value) { return isUndefinedOrNull(value) || isEmptyString(value); }; export var isFunction = function isFunction(value) { return toType(value) === 'function'; }; export var isBoolean = function isBoolean(value) { return toType(value) === 'boolean'; }; export var isString = function isString(value) { return toType(value) === 'string'; }; export var isNumber = function isNumber(value) { return toType(value) === 'number'; }; export var isNumeric = function isNumeric(value) { return RX_NUMBER.test(String(value)); }; export var isPrimitive = function isPrimitive(value) { return isBoolean(value) || isString(value) || isNumber(value); }; export var isArray = function isArray(value) { return Array.isArray(value); }; // Quick object check // This is primarily used to tell Objects from primitive values // when we know the value is a JSON-compliant type // Note object could be a complex type like array, Date, etc. export var isObject = function isObject(obj) { return obj !== null && _typeof(obj) === 'object'; }; // Strict object type check // Only returns true for plain JavaScript objects export var isPlainObject = function isPlainObject(obj) { return Object.prototype.toString.call(obj) === '[object Object]'; }; export var isDate = function isDate(value) { return value instanceof Date; }; export var isEvent = function isEvent(value) { return value instanceof Event; }; export var isFile = function isFile(value) { return value instanceof File; }; export var isRegExp = function isRegExp(value) { return toRawType(value) === 'RegExp'; }; export var isPromise = function isPromise(value) { return !isUndefinedOrNull(value) && isFunction(value.then) && isFunction(value.catch); };