UNPKG

ngx-bootstrap

Version:
56 lines 1.78 kB
import { absFloor } from '../utils'; export function isString(str) { return typeof str === 'string'; } export function isDate(value) { return value instanceof Date || Object.prototype.toString.call(value) === '[object Date]'; } export function isBoolean(value) { return value === true || value === false; } export function isDateValid(date) { return date && date.getTime && !isNaN(date.getTime()); } export function isFunction(fn) { return (fn instanceof Function || Object.prototype.toString.call(fn) === '[object Function]'); } export function isNumber(value) { return typeof value === 'number' || Object.prototype.toString.call(value) === '[object Number]'; } export function isArray(input) { return (input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'); } export function hasOwnProp(a /*object*/, b) { return Object.prototype.hasOwnProperty.call(a, b); } export function isObject(input /*object*/) { // IE8 will treat undefined and null as object if it wasn't for // input != null return (input != null && Object.prototype.toString.call(input) === '[object Object]'); } export function isObjectEmpty(obj) { if (Object.getOwnPropertyNames) { return (Object.getOwnPropertyNames(obj).length === 0); } var k; for (k in obj) { if (obj.hasOwnProperty(k)) { return false; } } return true; } export function isUndefined(input) { return input === void 0; } export function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion; var value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { value = absFloor(coercedNumber); } return value; } //# sourceMappingURL=type-checks.js.map