go-types
Version:
Type-checking utilities for JavaScript
1 lines • 5.96 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Types=e():t.Types=e()}(this,()=>{return n=[(t,e,r)=>{t.exports.isUndefined=r(1),t.exports.isNull=r(2),t.exports.isBoolean=r(3),t.exports.isNumber=r(4),t.exports.isString=r(5),t.exports.isSymbol=r(6),t.exports.isBigInt=r(7),t.exports.isPrimitive=r(8),t.exports.isNullish=r(9),t.exports.isEmpty=r(10),t.exports.isBlank=r(15),t.exports.isTruthy=r(16),t.exports.isFalsy=r(17),t.exports.isInteger=r(18),t.exports.isFloat=r(20),t.exports.isFinite=r(19),t.exports.isInfinite=r(21),t.exports.isNaN=r(22),t.exports.isNumeric=r(23),t.exports.isTypeOf=r(24),t.exports.isObject=r(25),t.exports.isPlainObject=r(12),t.exports.isCyclic=r(26),t.exports.isIterable=r(13),t.exports.isArray=r(14),t.exports.isArrayOf=r(28),t.exports.isArrayLike=r(11),t.exports.isArrayLikeOf=r(29),t.exports.isPair=r(30),t.exports.isMap=r(31),t.exports.isSet=r(32),t.exports.isWeakMap=r(33),t.exports.isWeakSet=r(34),t.exports.isFunction=r(35),t.exports.isDate=r(36),t.exports.isValidDate=r(37),t.exports.isInvalidDate=r(38),t.exports.isRegExp=r(39),t.exports.isPromise=r(40),t.exports.isPromiseLike=r(41),t.exports.isThenable=r(42),t.exports.isError=r(43),t.exports.isNode=r(44),t.exports.isElement=r(45),t.exports.isFragment=r(46)},t=>{t.exports=function(t){return void 0===t}},t=>{t.exports=function(t){return null===t}},t=>{t.exports=function(t){return"boolean"==typeof t||t instanceof Boolean}},t=>{t.exports=function(t){return"number"==typeof t||t instanceof Number}},t=>{t.exports=function(t){return"string"==typeof t||t instanceof String}},t=>{t.exports=function(t){return"symbol"==typeof t}},t=>{t.exports=function(t){return"bigint"==typeof t}},t=>{t.exports=function(t){return!(t instanceof Object)}},t=>{t.exports=function(t){return null==t}},(t,e,r)=>{var n=r(5),o=r(11),i=r(12),s=r(13);t.exports=function(t){return null==t||(n(t)||o(t)?0===t.length:i(t)?0===Object.keys(t).length:!!s(t)&&!0===t[Symbol.iterator]().next().done)}},t=>{t.exports=function(t){return null!=t&&"number"==typeof t.length&&0<=t.length&&t.length<=9007199254740991&&"function"!=typeof t}},t=>{t.exports=function(t){return t instanceof Object&&t.constructor===Object}},(t,e,r)=>{var n=r(14),o=r(5);t.exports=function(t){return null!=t&&"function"==typeof Symbol&&Symbol.iterator&&"function"==typeof t[Symbol.iterator]||n(t)||o(t)}},t=>{t.exports=function(t){return t instanceof Array}},(t,e,r)=>{var n=r(10),o=r(5),i=r(11),s=r(12),u=r(9),f=r(13),p=new RegExp("\\S");t.exports=function(t){if(n(t))return!0;if(o(t))return!p.test(t);if(i(t))return Array.prototype.every.call(t,u);if(s(t))return Array.prototype.every.call(Object.values(t),u);if(f(t)){for(var e,r=t[Symbol.iterator]();!0!==(e=r.next()).done;)if(null!=e.value)return!1;return!0}return!1}},t=>{t.exports=function(t){return!!t}},t=>{t.exports=function(t){return!t}},(t,e,r)=>{var n=r(19);t.exports=function(t){return n(t)&&Math.floor(t)===t.valueOf()}},(t,e,r)=>{var n=r(4);t.exports=function(t){return!!n(t)&&((t=t.valueOf())!==Number.POSITIVE_INFINITY&&t!==Number.NEGATIVE_INFINITY&&t==t)}},(t,e,r)=>{var n=r(19);t.exports=function(t){return n(t)&&Math.floor(t)!==t.valueOf()}},(t,e,r)=>{var n=r(4);t.exports=function(t){return!!n(t)&&((t=t.valueOf())===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}},(t,e,r)=>{var n=r(4);t.exports=function(t){return!!n(t)&&(t=t.valueOf())!=t}},(t,e,r)=>{var n=r(19),o=r(5),i=r(7);t.exports=function(t){return n(t)||o(t)&&0<t.length&&n(+t)||i(t)}},(t,e,r)=>{var o=r(5);t.exports=function t(e,r){if(o(r))return typeof e===r;if("function"==typeof r)return e instanceof r||!!r(e);if(r instanceof Array){for(var n=0;n<r.length;n++)if(t(e,r[n]))return!0;return!1}if(null==r)return e===r;throw new TypeError("The type should be either a string, function, null or undefined, but found: "+r)}},t=>{t.exports=function(t){return t instanceof Object}},(t,e,r)=>{var n=r(27);t.exports=function(t){return t instanceof Object&&n(t,[],[t])}},t=>{t.exports=function t(e,r,n){var o,i=[];for(o in e){var s=e[o];if(0<=n.indexOf(i[i.length]=s))return!0;if(s instanceof Object&&t(s,r.concat(o),n.concat(i)))return!0}return!1}},(t,e,r)=>{var n=r(24);t.exports=function(t,e){if(t instanceof Array&&0<t.length){for(var r=0;r<t.length;r++)if(!n(t[r],e))return!1;return!0}return!1}},(t,e,r)=>{var n=r(11),o=r(24);t.exports=function(t,e){if(n(t)&&0<t.length){for(var r=0;r<t.length;r++)if(!o(t[r],e))return!1;return!0}return!1}},(t,e,r)=>{var n=r(14);t.exports=function(t){return n(t)&&2===t.length}},t=>{t.exports=function(t){return"function"==typeof Map&&t instanceof Map}},t=>{t.exports=function(t){return"function"==typeof Set&&t instanceof Set}},t=>{t.exports=function(t){return"function"==typeof WeakMap&&t instanceof WeakMap}},t=>{t.exports=function(t){return"function"==typeof WeakSet&&t instanceof WeakSet}},t=>{t.exports=function(t){return"function"==typeof t}},t=>{t.exports=function(t){return t instanceof Date}},(t,e,r)=>{var n=r(18);t.exports=function(t){return t instanceof Date&&n(t.getTime())}},(t,e,r)=>{var n=r(22);t.exports=function(t){return t instanceof Date&&n(t.getTime())}},t=>{t.exports=function(t){return t instanceof RegExp}},t=>{t.exports=function(t){return"function"==typeof Promise&&t instanceof Promise}},t=>{t.exports=function(t){return t instanceof Object&&"function"==typeof t.then&&"function"==typeof t.catch}},t=>{t.exports=function(t){return t instanceof Object&&"function"==typeof t.then}},t=>{t.exports=function(t){return t instanceof Error}},t=>{t.exports=function(t){return"function"==typeof Node&&t instanceof Node}},t=>{t.exports=function(t){return"function"==typeof Element&&t instanceof Element}},t=>{t.exports=function(t){return"function"==typeof DocumentFragment&&t instanceof DocumentFragment}}],o={},function t(e){var r=o[e];return void 0===r&&(r=o[e]={exports:{}},n[e](r,r.exports,t)),r.exports}(0);var n,o});