@shopgate/pwa-common
Version:
Common library for the Shopgate Connect PWA.
39 lines • 2.26 kB
JavaScript
function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}/**
* Tests if the prop is an array-object.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isArray=function isArray(prop){return _typeof(prop)==='object'&&prop!==null&&prop.constructor===Array;};/**
* Tests if the prop is an object.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isObject=function isObject(prop){return _typeof(prop)==='object'&&prop!==null&&prop.constructor===Object;};/**
* Checks if a passed value is numeric.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isNumeric=function isNumeric(prop){return(// eslint-disable-next-line no-restricted-globals
!Number.isNaN(parseFloat(prop))&&isFinite(prop));};/**
* Tests if the prop is a number.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isNumber=function isNumber(prop){return(// eslint-disable-next-line no-restricted-globals
typeof prop==='number'&&isFinite(prop));};/**
* Tests if the prop is an integer.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isInteger=function isInteger(prop){return isNumber(prop)&&prop%1===0;};/**
* Tests if the prop is boolean.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isBoolean=function isBoolean(prop){return typeof prop==='boolean';};/**
* Tests if the prop is function.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isFunction=function isFunction(prop){return typeof prop==='function';};/**
* Tests if the prop is undefined.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isUndefined=function isUndefined(prop){return typeof prop==='undefined';};/**
* Tests if the prop is a promise.
* @param {*} prop The property to test.
* @return {boolean}
*/export var isPromise=function isPromise(prop){return prop!==null&&(_typeof(prop)==='object'||typeof prop==='function')&&typeof prop.then==='function';};