diff --git a/.babelrc b/.babelrc index a039539..b39f5a6 100644 --- a/.babelrc +++ b/.babelrc @@ -1,8 +1,7 @@ { "presets": [ - ["env", { + ["@babel/preset-env", { "modules": false }] - ], - "plugins": ["external-helpers"] + ] } \ No newline at end of file diff --git a/README.md b/README.md index 4a4217e..7f4a54a 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ function isString (payload) { return getType(payload) === 'String' } function isNumber (payload) { - return getType(payload) === 'Number' + return (getType(payload) === 'Number' && !isNaN(payload)) } function isBoolean (payload) { return getType(payload) === 'Boolean' @@ -34,10 +34,12 @@ function isRegExp (payload) { return getType(payload) === 'RegExp' } function isDate (payload) { - return getType(payload) === 'Date' + return (getType(payload) === 'Date' && !isNaN(payload)) } ``` +Since v2.0.0 it will return false on `isNumber()` and `isDate()` if the payload is `NaN` or an invalid date. + ## Build from source ```bash diff --git a/build/rollup.js b/build/rollup.js index 9b2b9f9..af6db88 100644 --- a/build/rollup.js +++ b/build/rollup.js @@ -1,6 +1,34 @@ +/* eslint-disable */ + +/* Required packages: */ +// npm i -D \ +// @babel/core \ +// @babel/plugin-proposal-object-rest-spread \ +// @babel/preset-env \ +// rollup \ +// rollup-plugin-babel@latest \ +// rollup-plugin-commonjs \ +// rollup-plugin-node-resolve \ +// rollup-plugin-terser \ +// is-what + +/* Required .babelrc setup: */ +// { +// "presets": [ +// ["@babel/preset-env", { +// "modules": false +// }] +// ], +// "plugins": [ +// "@babel/plugin-proposal-object-rest-spread" +// ] +// } + import babel from 'rollup-plugin-babel' import commonjs from 'rollup-plugin-commonjs' import { terser } from 'rollup-plugin-terser' +import { isArray } from 'is-what' +// import resolve from 'rollup-plugin-node-resolve' // ------------------------------------------------------------------------------------------ // formats @@ -13,50 +41,78 @@ import { terser } from 'rollup-plugin-terser' // ------------------------------------------------------------------------------------------ // setup // ------------------------------------------------------------------------------------------ +const files = [ + {in: 'src/index.js', out: 'dist', formats: ['cjs', 'es', 'iife', 'umd']}, +] +const minify = true +const sourcemap = true +const plugins = [ + babel({ + exclude: 'node_modules/**' // only transpile our source code + }), + commonjs() +] +// ------------------------------------------------------------------------------------------ const pkg = require('../package.json') const name = pkg.name const className = name.replace(/(^\w|-\w)/g, c => c.replace('-', '').toUpperCase()) const external = Object.keys(pkg.dependencies || []) -const _plugins = [ - babel({ - exclude: 'node_modules/**', // only transpile our source code - }), - commonjs(), -] // ------------------------------------------------------------------------------------------ -// build helpers +// Builds // ------------------------------------------------------------------------------------------ -function output (ext, format) { +const nsNameExt = new RegExp('(.+)\/([^\/]+)\.([^\.]+$)', 'g') +function getNS (name) { + if (!name.includes('/')) return '' + return name.replace(nsNameExt, '$1') +} +function getName (name) { + if (!name.includes('/')) name = 'a/' + name + name = name.replace(nsNameExt, '$2') + if (name.endsWith('.')) name = name.slice(0, -1) + return name +} +function getExt (name) { + return name.split('.').pop() +} +function getFileInfo (file) { return { - name: className, - sourcemap: true, - exports: 'named', - file: `dist/index.${ext}`, - format + ns: getNS(file.in), + name: getName(file.in), + ext: getExt(file.in), + out: file.out, + formats: !isArray(file.formats) ? [file.formats] : file.formats, + plugins: (file.plugins === undefined) ? plugins : file.plugins, + min: (file.minify === undefined) ? minify : file.minify, + map: (file.sourcemap === undefined) ? sourcemap : file.sourcemap, + external: external, } } -function buildTemplate (format, minified = false) { - const plugins = (minified) - ? _plugins.concat(terser()) - : _plugins - const ext = (minified) - ? `${format}.min.js` - : `${format}.js` +function getRollupObject (info, format) { return { - input: `src/index.js`, - output: output(ext, format), - plugins, - external + input: `${info.ns}/${info.name}.${info.ext}`, + output: { + name: className, + sourcemap: info.map, + exports: 'named', + file: (!info.min) + ? `${info.out}/${info.name}.${format}.${info.ext}` + : `${info.out}/${info.name}.${format}.min.${info.ext}`, + format + }, + plugins: (!info.min) ? plugins : plugins.concat(terser()), + external: info.external } } +const builds = files.reduce((carry, file) => { + const info = getFileInfo(file) + const _builds = info.formats + .reduce((carry, format) => { + return carry + .concat(getRollupObject(info, format)) + }, []) -// ------------------------------------------------------------------------------------------ -// builds -// ------------------------------------------------------------------------------------------ -const formats = ['umd', 'cjs', 'es', 'iife'] -const regBuilds = formats.map(format => buildTemplate(format)) -const minBuilds = formats.map(format => buildTemplate(format, true)) -const result = regBuilds.concat(minBuilds) + return carry.concat(_builds) +}, []) -export default result +export default builds diff --git a/dist/index.cjs.js b/dist/index.cjs.js deleted file mode 100644 index 3186218..0000000 --- a/dist/index.cjs.js +++ /dev/null @@ -1,50 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -function getType(payload) { - return Object.prototype.toString.call(payload).slice(8, -1); -} -function isUndefined(payload) { - return getType(payload) === 'Undefined'; -} -function isNull(payload) { - return getType(payload) === 'Null'; -} -function isObject(payload) { - return getType(payload) === 'Object'; -} -function isFunction(payload) { - return getType(payload) === 'Function'; -} -function isArray(payload) { - return getType(payload) === 'Array'; -} -function isString(payload) { - return getType(payload) === 'String'; -} -function isNumber(payload) { - return getType(payload) === 'Number'; -} -function isBoolean(payload) { - return getType(payload) === 'Boolean'; -} -function isRegExp(payload) { - return getType(payload) === 'RegExp'; -} -function isDate(payload) { - return getType(payload) === 'Date'; -} - -exports.getType = getType; -exports.isUndefined = isUndefined; -exports.isNull = isNull; -exports.isObject = isObject; -exports.isFunction = isFunction; -exports.isArray = isArray; -exports.isString = isString; -exports.isNumber = isNumber; -exports.isBoolean = isBoolean; -exports.isRegExp = isRegExp; -exports.isDate = isDate; -//# sourceMappingURL=index.cjs.js.map diff --git a/dist/index.cjs.js.map b/dist/index.cjs.js.map deleted file mode 100644 index 7cd21a1..0000000 --- a/dist/index.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.cjs.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isBoolean","isRegExp","isDate"],"mappings":";;;;AACA,SAASA,OAAT,CAAkBC,OAAlB,EAA2B;SAClBC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BJ,OAA/B,EAAwCK,KAAxC,CAA8C,CAA9C,EAAiD,CAAC,CAAlD,CAAP;;AAEF,SAASC,WAAT,CAAsBN,OAAtB,EAA+B;SACtBD,QAAQC,OAAR,MAAqB,WAA5B;;AAEF,SAASO,MAAT,CAAiBP,OAAjB,EAA0B;SACjBD,QAAQC,OAAR,MAAqB,MAA5B;;AAEF,SAASQ,QAAT,CAAmBR,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASS,UAAT,CAAqBT,OAArB,EAA8B;SACrBD,QAAQC,OAAR,MAAqB,UAA5B;;AAEF,SAASU,OAAT,CAAkBV,OAAlB,EAA2B;SAClBD,QAAQC,OAAR,MAAqB,OAA5B;;AAEF,SAASW,QAAT,CAAmBX,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASY,QAAT,CAAmBZ,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASa,SAAT,CAAoBb,OAApB,EAA6B;SACpBD,QAAQC,OAAR,MAAqB,SAA5B;;AAEF,SAASc,QAAT,CAAmBd,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASe,MAAT,CAAiBf,OAAjB,EAA0B;SACjBD,QAAQC,OAAR,MAAqB,MAA5B;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/index.cjs.min.js b/dist/index.cjs.min.js index b88dafb..33782d3 100644 --- a/dist/index.cjs.min.js +++ b/dist/index.cjs.min.js @@ -1,2 +1,2 @@ -"use strict";function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function isUndefined(e){return"Undefined"===getType(e)}function isNull(e){return"Null"===getType(e)}function isObject(e){return"Object"===getType(e)}function isFunction(e){return"Function"===getType(e)}function isArray(e){return"Array"===getType(e)}function isString(e){return"String"===getType(e)}function isNumber(e){return"Number"===getType(e)}function isBoolean(e){return"Boolean"===getType(e)}function isRegExp(e){return"RegExp"===getType(e)}function isDate(e){return"Date"===getType(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getType=getType,exports.isUndefined=isUndefined,exports.isNull=isNull,exports.isObject=isObject,exports.isFunction=isFunction,exports.isArray=isArray,exports.isString=isString,exports.isNumber=isNumber,exports.isBoolean=isBoolean,exports.isRegExp=isRegExp,exports.isDate=isDate; +"use strict";function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function isUndefined(e){return"Undefined"===getType(e)}function isNull(e){return"Null"===getType(e)}function isObject(e){return"Object"===getType(e)}function isFunction(e){return"Function"===getType(e)}function isArray(e){return"Array"===getType(e)}function isString(e){return"String"===getType(e)}function isNumber(e){return"Number"===getType(e)&&!isNaN(e)}function isBoolean(e){return"Boolean"===getType(e)}function isRegExp(e){return"RegExp"===getType(e)}function isDate(e){return"Date"===getType(e)&&!isNaN(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getType=getType,exports.isUndefined=isUndefined,exports.isNull=isNull,exports.isObject=isObject,exports.isFunction=isFunction,exports.isArray=isArray,exports.isString=isString,exports.isNumber=isNumber,exports.isBoolean=isBoolean,exports.isRegExp=isRegExp,exports.isDate=isDate; //# sourceMappingURL=index.cjs.min.js.map diff --git a/dist/index.cjs.min.js.map b/dist/index.cjs.min.js.map index 991986b..6290e4e 100644 --- a/dist/index.cjs.min.js.map +++ b/dist/index.cjs.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.cjs.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isBoolean","isRegExp","isDate"],"mappings":"aACA,SAASA,QAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,GAE3D,SAASC,YAAaN,SACQ,cAArBD,QAAQC,GAEjB,SAASO,OAAQP,SACa,SAArBD,QAAQC,GAEjB,SAASQ,SAAUR,SACW,WAArBD,QAAQC,GAEjB,SAASS,WAAYT,SACS,aAArBD,QAAQC,GAEjB,SAASU,QAASV,SACY,UAArBD,QAAQC,GAEjB,SAASW,SAAUX,SACW,WAArBD,QAAQC,GAEjB,SAASY,SAAUZ,SACW,WAArBD,QAAQC,GAEjB,SAASa,UAAWb,SACU,YAArBD,QAAQC,GAEjB,SAASc,SAAUd,SACW,WAArBD,QAAQC,GAEjB,SAASe,OAAQf,SACa,SAArBD,QAAQC"} \ No newline at end of file +{"version":3,"file":"index.cjs.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return (getType(payload) === 'Number' && !isNaN(payload))\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return (getType(payload) === 'Date' && !isNaN(payload))\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isNaN","isBoolean","isRegExp","isDate"],"mappings":"aACA,SAASA,QAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,GAE3D,SAASC,YAAaN,SACQ,cAArBD,QAAQC,GAEjB,SAASO,OAAQP,SACa,SAArBD,QAAQC,GAEjB,SAASQ,SAAUR,SACW,WAArBD,QAAQC,GAEjB,SAASS,WAAYT,SACS,aAArBD,QAAQC,GAEjB,SAASU,QAASV,SACY,UAArBD,QAAQC,GAEjB,SAASW,SAAUX,SACW,WAArBD,QAAQC,GAEjB,SAASY,SAAUZ,SACY,WAArBD,QAAQC,KAA0Ba,MAAMb,GAElD,SAASc,UAAWd,SACU,YAArBD,QAAQC,GAEjB,SAASe,SAAUf,SACW,WAArBD,QAAQC,GAEjB,SAASgB,OAAQhB,SACc,SAArBD,QAAQC,KAAyBa,MAAMb"} \ No newline at end of file diff --git a/dist/index.es.js b/dist/index.es.js deleted file mode 100644 index 1668e4b..0000000 --- a/dist/index.es.js +++ /dev/null @@ -1,36 +0,0 @@ -function getType(payload) { - return Object.prototype.toString.call(payload).slice(8, -1); -} -function isUndefined(payload) { - return getType(payload) === 'Undefined'; -} -function isNull(payload) { - return getType(payload) === 'Null'; -} -function isObject(payload) { - return getType(payload) === 'Object'; -} -function isFunction(payload) { - return getType(payload) === 'Function'; -} -function isArray(payload) { - return getType(payload) === 'Array'; -} -function isString(payload) { - return getType(payload) === 'String'; -} -function isNumber(payload) { - return getType(payload) === 'Number'; -} -function isBoolean(payload) { - return getType(payload) === 'Boolean'; -} -function isRegExp(payload) { - return getType(payload) === 'RegExp'; -} -function isDate(payload) { - return getType(payload) === 'Date'; -} - -export { getType, isUndefined, isNull, isObject, isFunction, isArray, isString, isNumber, isBoolean, isRegExp, isDate }; -//# sourceMappingURL=index.es.js.map diff --git a/dist/index.es.js.map b/dist/index.es.js.map deleted file mode 100644 index fd5fbe1..0000000 --- a/dist/index.es.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.es.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isBoolean","isRegExp","isDate"],"mappings":"AACA,SAASA,OAAT,CAAkBC,OAAlB,EAA2B;SAClBC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BJ,OAA/B,EAAwCK,KAAxC,CAA8C,CAA9C,EAAiD,CAAC,CAAlD,CAAP;;AAEF,SAASC,WAAT,CAAsBN,OAAtB,EAA+B;SACtBD,QAAQC,OAAR,MAAqB,WAA5B;;AAEF,SAASO,MAAT,CAAiBP,OAAjB,EAA0B;SACjBD,QAAQC,OAAR,MAAqB,MAA5B;;AAEF,SAASQ,QAAT,CAAmBR,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASS,UAAT,CAAqBT,OAArB,EAA8B;SACrBD,QAAQC,OAAR,MAAqB,UAA5B;;AAEF,SAASU,OAAT,CAAkBV,OAAlB,EAA2B;SAClBD,QAAQC,OAAR,MAAqB,OAA5B;;AAEF,SAASW,QAAT,CAAmBX,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASY,QAAT,CAAmBZ,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASa,SAAT,CAAoBb,OAApB,EAA6B;SACpBD,QAAQC,OAAR,MAAqB,SAA5B;;AAEF,SAASc,QAAT,CAAmBd,OAAnB,EAA4B;SACnBD,QAAQC,OAAR,MAAqB,QAA5B;;AAEF,SAASe,MAAT,CAAiBf,OAAjB,EAA0B;SACjBD,QAAQC,OAAR,MAAqB,MAA5B;;;;;"} \ No newline at end of file diff --git a/dist/index.es.min.js b/dist/index.es.min.js index 6026583..b1e1b2b 100644 --- a/dist/index.es.min.js +++ b/dist/index.es.min.js @@ -1,2 +1,2 @@ -function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function isUndefined(e){return"Undefined"===getType(e)}function isNull(e){return"Null"===getType(e)}function isObject(e){return"Object"===getType(e)}function isFunction(e){return"Function"===getType(e)}function isArray(e){return"Array"===getType(e)}function isString(e){return"String"===getType(e)}function isNumber(e){return"Number"===getType(e)}function isBoolean(e){return"Boolean"===getType(e)}function isRegExp(e){return"RegExp"===getType(e)}function isDate(e){return"Date"===getType(e)}export{getType,isUndefined,isNull,isObject,isFunction,isArray,isString,isNumber,isBoolean,isRegExp,isDate}; +function getType(e){return Object.prototype.toString.call(e).slice(8,-1)}function isUndefined(e){return"Undefined"===getType(e)}function isNull(e){return"Null"===getType(e)}function isObject(e){return"Object"===getType(e)}function isFunction(e){return"Function"===getType(e)}function isArray(e){return"Array"===getType(e)}function isString(e){return"String"===getType(e)}function isNumber(e){return"Number"===getType(e)&&!isNaN(e)}function isBoolean(e){return"Boolean"===getType(e)}function isRegExp(e){return"RegExp"===getType(e)}function isDate(e){return"Date"===getType(e)&&!isNaN(e)}export{getType,isUndefined,isNull,isObject,isFunction,isArray,isString,isNumber,isBoolean,isRegExp,isDate}; //# sourceMappingURL=index.es.min.js.map diff --git a/dist/index.es.min.js.map b/dist/index.es.min.js.map index 5d330f6..659475f 100644 --- a/dist/index.es.min.js.map +++ b/dist/index.es.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.es.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isBoolean","isRegExp","isDate"],"mappings":"AACA,SAASA,QAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,GAE3D,SAASC,YAAaN,SACQ,cAArBD,QAAQC,GAEjB,SAASO,OAAQP,SACa,SAArBD,QAAQC,GAEjB,SAASQ,SAAUR,SACW,WAArBD,QAAQC,GAEjB,SAASS,WAAYT,SACS,aAArBD,QAAQC,GAEjB,SAASU,QAASV,SACY,UAArBD,QAAQC,GAEjB,SAASW,SAAUX,SACW,WAArBD,QAAQC,GAEjB,SAASY,SAAUZ,SACW,WAArBD,QAAQC,GAEjB,SAASa,UAAWb,SACU,YAArBD,QAAQC,GAEjB,SAASc,SAAUd,SACW,WAArBD,QAAQC,GAEjB,SAASe,OAAQf,SACa,SAArBD,QAAQC"} \ No newline at end of file +{"version":3,"file":"index.es.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return (getType(payload) === 'Number' && !isNaN(payload))\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return (getType(payload) === 'Date' && !isNaN(payload))\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isNaN","isBoolean","isRegExp","isDate"],"mappings":"AACA,SAASA,QAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,GAE3D,SAASC,YAAaN,SACQ,cAArBD,QAAQC,GAEjB,SAASO,OAAQP,SACa,SAArBD,QAAQC,GAEjB,SAASQ,SAAUR,SACW,WAArBD,QAAQC,GAEjB,SAASS,WAAYT,SACS,aAArBD,QAAQC,GAEjB,SAASU,QAASV,SACY,UAArBD,QAAQC,GAEjB,SAASW,SAAUX,SACW,WAArBD,QAAQC,GAEjB,SAASY,SAAUZ,SACY,WAArBD,QAAQC,KAA0Ba,MAAMb,GAElD,SAASc,UAAWd,SACU,YAArBD,QAAQC,GAEjB,SAASe,SAAUf,SACW,WAArBD,QAAQC,GAEjB,SAASgB,OAAQhB,SACc,SAArBD,QAAQC,KAAyBa,MAAMb"} \ No newline at end of file diff --git a/dist/index.iife.js b/dist/index.iife.js deleted file mode 100644 index c819fd0..0000000 --- a/dist/index.iife.js +++ /dev/null @@ -1,53 +0,0 @@ -var IsWhat = (function (exports) { - 'use strict'; - - function getType(payload) { - return Object.prototype.toString.call(payload).slice(8, -1); - } - function isUndefined(payload) { - return getType(payload) === 'Undefined'; - } - function isNull(payload) { - return getType(payload) === 'Null'; - } - function isObject(payload) { - return getType(payload) === 'Object'; - } - function isFunction(payload) { - return getType(payload) === 'Function'; - } - function isArray(payload) { - return getType(payload) === 'Array'; - } - function isString(payload) { - return getType(payload) === 'String'; - } - function isNumber(payload) { - return getType(payload) === 'Number'; - } - function isBoolean(payload) { - return getType(payload) === 'Boolean'; - } - function isRegExp(payload) { - return getType(payload) === 'RegExp'; - } - function isDate(payload) { - return getType(payload) === 'Date'; - } - - exports.getType = getType; - exports.isUndefined = isUndefined; - exports.isNull = isNull; - exports.isObject = isObject; - exports.isFunction = isFunction; - exports.isArray = isArray; - exports.isString = isString; - exports.isNumber = isNumber; - exports.isBoolean = isBoolean; - exports.isRegExp = isRegExp; - exports.isDate = isDate; - - return exports; - -}({})); -//# sourceMappingURL=index.iife.js.map diff --git a/dist/index.iife.js.map b/dist/index.iife.js.map deleted file mode 100644 index 8f1ca0c..0000000 --- a/dist/index.iife.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.iife.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isBoolean","isRegExp","isDate"],"mappings":";;;EACA,SAASA,OAAT,CAAkBC,OAAlB,EAA2B;EACzB,SAAOC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BJ,OAA/B,EAAwCK,KAAxC,CAA8C,CAA9C,EAAiD,CAAC,CAAlD,CAAP;EACD;EACD,SAASC,WAAT,CAAsBN,OAAtB,EAA+B;EAC7B,SAAOD,QAAQC,OAAR,MAAqB,WAA5B;EACD;EACD,SAASO,MAAT,CAAiBP,OAAjB,EAA0B;EACxB,SAAOD,QAAQC,OAAR,MAAqB,MAA5B;EACD;EACD,SAASQ,QAAT,CAAmBR,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASS,UAAT,CAAqBT,OAArB,EAA8B;EAC5B,SAAOD,QAAQC,OAAR,MAAqB,UAA5B;EACD;EACD,SAASU,OAAT,CAAkBV,OAAlB,EAA2B;EACzB,SAAOD,QAAQC,OAAR,MAAqB,OAA5B;EACD;EACD,SAASW,QAAT,CAAmBX,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASY,QAAT,CAAmBZ,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASa,SAAT,CAAoBb,OAApB,EAA6B;EAC3B,SAAOD,QAAQC,OAAR,MAAqB,SAA5B;EACD;EACD,SAASc,QAAT,CAAmBd,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASe,MAAT,CAAiBf,OAAjB,EAA0B;EACxB,SAAOD,QAAQC,OAAR,MAAqB,MAA5B;EACD;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/index.iife.min.js b/dist/index.iife.min.js index 87a3cab..b26d402 100644 --- a/dist/index.iife.min.js +++ b/dist/index.iife.min.js @@ -1,2 +1,2 @@ -var IsWhat=function(n){"use strict";function t(n){return Object.prototype.toString.call(n).slice(8,-1)}return n.getType=t,n.isUndefined=function(n){return"Undefined"===t(n)},n.isNull=function(n){return"Null"===t(n)},n.isObject=function(n){return"Object"===t(n)},n.isFunction=function(n){return"Function"===t(n)},n.isArray=function(n){return"Array"===t(n)},n.isString=function(n){return"String"===t(n)},n.isNumber=function(n){return"Number"===t(n)},n.isBoolean=function(n){return"Boolean"===t(n)},n.isRegExp=function(n){return"RegExp"===t(n)},n.isDate=function(n){return"Date"===t(n)},n}({}); +var IsWhat=function(n){"use strict";function t(n){return Object.prototype.toString.call(n).slice(8,-1)}return n.getType=t,n.isUndefined=function(n){return"Undefined"===t(n)},n.isNull=function(n){return"Null"===t(n)},n.isObject=function(n){return"Object"===t(n)},n.isFunction=function(n){return"Function"===t(n)},n.isArray=function(n){return"Array"===t(n)},n.isString=function(n){return"String"===t(n)},n.isNumber=function(n){return"Number"===t(n)&&!isNaN(n)},n.isBoolean=function(n){return"Boolean"===t(n)},n.isRegExp=function(n){return"RegExp"===t(n)},n.isDate=function(n){return"Date"===t(n)&&!isNaN(n)},n}({}); //# sourceMappingURL=index.iife.min.js.map diff --git a/dist/index.iife.min.js.map b/dist/index.iife.min.js.map index b0885f7..cbe5378 100644 --- a/dist/index.iife.min.js.map +++ b/dist/index.iife.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.iife.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice"],"mappings":"oCACA,SAASA,EAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,oCAE3D,SAAsBL,SACQ,cAArBD,EAAQC,aAEjB,SAAiBA,SACa,SAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,iBAEjB,SAAqBA,SACS,aAArBD,EAAQC,cAEjB,SAAkBA,SACY,UAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,gBAEjB,SAAoBA,SACU,YAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,aAEjB,SAAiBA,SACa,SAArBD,EAAQC"} \ No newline at end of file +{"version":3,"file":"index.iife.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return (getType(payload) === 'Number' && !isNaN(payload))\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return (getType(payload) === 'Date' && !isNaN(payload))\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isNaN"],"mappings":"oCACA,SAASA,EAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,oCAE3D,SAAsBL,SACQ,cAArBD,EAAQC,aAEjB,SAAiBA,SACa,SAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,iBAEjB,SAAqBA,SACS,aAArBD,EAAQC,cAEjB,SAAkBA,SACY,UAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,eAEjB,SAAmBA,SACY,WAArBD,EAAQC,KAA0BM,MAAMN,gBAElD,SAAoBA,SACU,YAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,aAEjB,SAAiBA,SACc,SAArBD,EAAQC,KAAyBM,MAAMN"} \ No newline at end of file diff --git a/dist/index.umd.js b/dist/index.umd.js deleted file mode 100644 index e0ade84..0000000 --- a/dist/index.umd.js +++ /dev/null @@ -1,56 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (factory((global.IsWhat = {}))); -}(this, (function (exports) { 'use strict'; - - function getType(payload) { - return Object.prototype.toString.call(payload).slice(8, -1); - } - function isUndefined(payload) { - return getType(payload) === 'Undefined'; - } - function isNull(payload) { - return getType(payload) === 'Null'; - } - function isObject(payload) { - return getType(payload) === 'Object'; - } - function isFunction(payload) { - return getType(payload) === 'Function'; - } - function isArray(payload) { - return getType(payload) === 'Array'; - } - function isString(payload) { - return getType(payload) === 'String'; - } - function isNumber(payload) { - return getType(payload) === 'Number'; - } - function isBoolean(payload) { - return getType(payload) === 'Boolean'; - } - function isRegExp(payload) { - return getType(payload) === 'RegExp'; - } - function isDate(payload) { - return getType(payload) === 'Date'; - } - - exports.getType = getType; - exports.isUndefined = isUndefined; - exports.isNull = isNull; - exports.isObject = isObject; - exports.isFunction = isFunction; - exports.isArray = isArray; - exports.isString = isString; - exports.isNumber = isNumber; - exports.isBoolean = isBoolean; - exports.isRegExp = isRegExp; - exports.isDate = isDate; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); -//# sourceMappingURL=index.umd.js.map diff --git a/dist/index.umd.js.map b/dist/index.umd.js.map deleted file mode 100644 index 99512e1..0000000 --- a/dist/index.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.umd.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isUndefined","isNull","isObject","isFunction","isArray","isString","isNumber","isBoolean","isRegExp","isDate"],"mappings":";;;;;;EACA,SAASA,OAAT,CAAkBC,OAAlB,EAA2B;EACzB,SAAOC,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BJ,OAA/B,EAAwCK,KAAxC,CAA8C,CAA9C,EAAiD,CAAC,CAAlD,CAAP;EACD;EACD,SAASC,WAAT,CAAsBN,OAAtB,EAA+B;EAC7B,SAAOD,QAAQC,OAAR,MAAqB,WAA5B;EACD;EACD,SAASO,MAAT,CAAiBP,OAAjB,EAA0B;EACxB,SAAOD,QAAQC,OAAR,MAAqB,MAA5B;EACD;EACD,SAASQ,QAAT,CAAmBR,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASS,UAAT,CAAqBT,OAArB,EAA8B;EAC5B,SAAOD,QAAQC,OAAR,MAAqB,UAA5B;EACD;EACD,SAASU,OAAT,CAAkBV,OAAlB,EAA2B;EACzB,SAAOD,QAAQC,OAAR,MAAqB,OAA5B;EACD;EACD,SAASW,QAAT,CAAmBX,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASY,QAAT,CAAmBZ,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASa,SAAT,CAAoBb,OAApB,EAA6B;EAC3B,SAAOD,QAAQC,OAAR,MAAqB,SAA5B;EACD;EACD,SAASc,QAAT,CAAmBd,OAAnB,EAA4B;EAC1B,SAAOD,QAAQC,OAAR,MAAqB,QAA5B;EACD;EACD,SAASe,MAAT,CAAiBf,OAAjB,EAA0B;EACxB,SAAOD,QAAQC,OAAR,MAAqB,MAA5B;EACD;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/index.umd.min.js b/dist/index.umd.min.js index f523d85..6d52bb4 100644 --- a/dist/index.umd.min.js +++ b/dist/index.umd.min.js @@ -1,2 +1,2 @@ -!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.IsWhat={})}(this,function(n){"use strict";function e(n){return Object.prototype.toString.call(n).slice(8,-1)}n.getType=e,n.isUndefined=function(n){return"Undefined"===e(n)},n.isNull=function(n){return"Null"===e(n)},n.isObject=function(n){return"Object"===e(n)},n.isFunction=function(n){return"Function"===e(n)},n.isArray=function(n){return"Array"===e(n)},n.isString=function(n){return"String"===e(n)},n.isNumber=function(n){return"Number"===e(n)},n.isBoolean=function(n){return"Boolean"===e(n)},n.isRegExp=function(n){return"RegExp"===e(n)},n.isDate=function(n){return"Date"===e(n)},Object.defineProperty(n,"__esModule",{value:!0})}); +!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.IsWhat={})}(this,function(n){"use strict";function e(n){return Object.prototype.toString.call(n).slice(8,-1)}n.getType=e,n.isUndefined=function(n){return"Undefined"===e(n)},n.isNull=function(n){return"Null"===e(n)},n.isObject=function(n){return"Object"===e(n)},n.isFunction=function(n){return"Function"===e(n)},n.isArray=function(n){return"Array"===e(n)},n.isString=function(n){return"String"===e(n)},n.isNumber=function(n){return"Number"===e(n)&&!isNaN(n)},n.isBoolean=function(n){return"Boolean"===e(n)},n.isRegExp=function(n){return"RegExp"===e(n)},n.isDate=function(n){return"Date"===e(n)&&!isNaN(n)},Object.defineProperty(n,"__esModule",{value:!0})}); //# sourceMappingURL=index.umd.min.js.map diff --git a/dist/index.umd.min.js.map b/dist/index.umd.min.js.map index ce9e72c..7592aae 100644 --- a/dist/index.umd.min.js.map +++ b/dist/index.umd.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.umd.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return getType(payload) === 'Number'\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return getType(payload) === 'Date'\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice"],"mappings":"yLACA,SAASA,EAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,6BAE3D,SAAsBL,SACQ,cAArBD,EAAQC,aAEjB,SAAiBA,SACa,SAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,iBAEjB,SAAqBA,SACS,aAArBD,EAAQC,cAEjB,SAAkBA,SACY,UAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,gBAEjB,SAAoBA,SACU,YAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,aAEjB,SAAiBA,SACa,SAArBD,EAAQC"} \ No newline at end of file +{"version":3,"file":"index.umd.min.js","sources":["../src/index.js"],"sourcesContent":["\nfunction getType (payload) {\n return Object.prototype.toString.call(payload).slice(8, -1)\n}\nfunction isUndefined (payload) {\n return getType(payload) === 'Undefined'\n}\nfunction isNull (payload) {\n return getType(payload) === 'Null'\n}\nfunction isObject (payload) {\n return getType(payload) === 'Object'\n}\nfunction isFunction (payload) {\n return getType(payload) === 'Function'\n}\nfunction isArray (payload) {\n return getType(payload) === 'Array'\n}\nfunction isString (payload) {\n return getType(payload) === 'String'\n}\nfunction isNumber (payload) {\n return (getType(payload) === 'Number' && !isNaN(payload))\n}\nfunction isBoolean (payload) {\n return getType(payload) === 'Boolean'\n}\nfunction isRegExp (payload) {\n return getType(payload) === 'RegExp'\n}\nfunction isDate (payload) {\n return (getType(payload) === 'Date' && !isNaN(payload))\n}\n\nexport {\n getType,\n isUndefined,\n isNull,\n isObject,\n isFunction,\n isArray,\n isString,\n isNumber,\n isBoolean,\n isRegExp,\n isDate\n}\n"],"names":["getType","payload","Object","prototype","toString","call","slice","isNaN"],"mappings":"yLACA,SAASA,EAASC,UACTC,OAAOC,UAAUC,SAASC,KAAKJ,GAASK,MAAM,GAAI,6BAE3D,SAAsBL,SACQ,cAArBD,EAAQC,aAEjB,SAAiBA,SACa,SAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,iBAEjB,SAAqBA,SACS,aAArBD,EAAQC,cAEjB,SAAkBA,SACY,UAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,eAEjB,SAAmBA,SACY,WAArBD,EAAQC,KAA0BM,MAAMN,gBAElD,SAAoBA,SACU,YAArBD,EAAQC,eAEjB,SAAmBA,SACW,WAArBD,EAAQC,aAEjB,SAAiBA,SACc,SAArBD,EAAQC,KAAyBM,MAAMN"} \ No newline at end of file diff --git a/package.json b/package.json index 9463985..92e2249 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "is-what", - "version": "1.1.0", + "version": "2.0.0", "description": "Very simple & small JS type check function", "main": "dist/index.cjs.min.js", "module": "dist/index.es.min.js", @@ -24,12 +24,13 @@ }, "homepage": "https://github.com/mesqueeb/isWhat#readme", "devDependencies": { - "babel-core": "^6.26.3", - "babel-plugin-external-helpers": "^6.22.0", - "babel-preset-env": "^1.7.0", - "rollup": "^0.60.7", - "rollup-plugin-babel": "^3.0.4", - "rollup-plugin-commonjs": "^9.1.3", - "rollup-plugin-terser": "^1.0.1" - } + "@babel/core": "^7.0.0", + "@babel/preset-env": "^7.0.0", + "rollup": "^0.65.2", + "rollup-plugin-babel": "^4.0.3", + "rollup-plugin-commonjs": "^9.1.6", + "rollup-plugin-node-resolve": "^3.4.0", + "rollup-plugin-terser": "^2.0.2" + }, + "dependencies": {} } diff --git a/src/index.js b/src/index.js index 4c86695..b4520fc 100644 --- a/src/index.js +++ b/src/index.js @@ -21,7 +21,7 @@ function isString (payload) { return getType(payload) === 'String' } function isNumber (payload) { - return getType(payload) === 'Number' + return (getType(payload) === 'Number' && !isNaN(payload)) } function isBoolean (payload) { return getType(payload) === 'Boolean' @@ -30,7 +30,7 @@ function isRegExp (payload) { return getType(payload) === 'RegExp' } function isDate (payload) { - return getType(payload) === 'Date' + return (getType(payload) === 'Date' && !isNaN(payload)) } export {