Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

of-type

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

of-type - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

webpack.config.js

2

dist/of-type.js

@@ -1,1 +0,1 @@

var ofType=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value:value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__),function(global){function _typeof(obj){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})(obj)}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}var _g=function(){return global||window}.bind(void 0),OfType=function(){function OfType(){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,OfType);var _this=this;return function(value,type){return _this._setInitials(arguments,value,type),_this._validate()}}var Constructor,protoProps,staticProps;return Constructor=OfType,(protoProps=[{key:"_setInitials",value:function(_arguments,value,type){this._arguments=_arguments,this._value=value,this._type=type}},{key:"_validate",value:function(){return!!this.isTypeDefined&&(this.isTypeNull?this.isValueNull:this.isTypeUndefined?void 0===this._value:this.isTypeFunction?this._typeConstructor():this.isTypeArray?this._typeArray():this.isTypeString?this._typeString():!!this.isTypeRegExp&&this._typeRegexp())}},{key:"_typeConstructor",value:function(){return!this.isValueUndefined&&!this.isValueNull&&Object.getPrototypeOf(this._value).constructor===this._type}},{key:"_typeArray",value:function(){if(!this._type.length)return!0;var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=this._type[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var t=_step.value;if(null===t&&this.isValueNull)return!0;if(void 0===t&&this.isValueUndefined)return!0;if(!this.isValueNull&&!this.isValueUndefined&&(null!==t&&void 0!==t&&Object.getPrototypeOf(this._value).constructor===t))return!0}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return!1}},{key:"_typeString",value:function(){var _this2=this,typeList=this._type.toLowerCase().split("|");if(1===typeList.length&&""===typeList[0]||typeList.some(function(i){return"any"===i}))return!0;if(typeList.some(function(i){return"truthy"===i})&&this._value)return!0;if(typeList.some(function(i){return"falsy"===i})&&!this._value)return!0;if(this.isValueUndefined&&typeList.some(function(i){return"undefined"===i}))return!0;if(this.isValueNull&&typeList.some(function(i){return"null"===i}))return!0;if(this.isValueNull||void 0===this._value)return!1;var valueConstructor=Object.getPrototypeOf(this._value).constructor;return!!(this.argumentsRegExp.test(this._value.toString())&&valueConstructor&&valueConstructor===Object&&typeList.some(function(i){return"arguments"===i}))||(!!(typeList.some(function(i){return"instance"===i})&&this.isValueObject&&valueConstructor&&valueConstructor!==_g()[valueConstructor.name])||(!(!typeList.some(function(i){return"objectable"===i})||!this.isObjectInstance)||typeList.some(function(i){return i===Object.getPrototypeOf(_this2._value).constructor.name.toLowerCase()})))}},{key:"_typeRegexp",value:function(){if(this._exec("any")||this._type.test(""))return!0;if(this._exec("truthy")&&this._value)return!0;if(this._exec("falsy")&&!this._value)return!0;if(this._type.test("undefined")&&this.isValueUndefined)return!0;if(this._type.test("null")&&this.isValueNull)return!0;if(this.isValueNull||void 0===this._value)return!1;var valueConstructor=Object.getPrototypeOf(this._value).constructor;return!!(this._exec("arguments")&&valueConstructor&&valueConstructor===Object&&this.argumentsRegExp.test(this._value.toString()))||(!!(this._exec("instance")&&this.isValueObject&&valueConstructor&&valueConstructor!==_g()[valueConstructor.name])||(!(!this._exec("objectable")||!this.isObjectInstance)||this._type.test(Object.getPrototypeOf(this._value).constructor.name)))}},{key:"_exec",value:function(name){var _exec=this._type.exec(name);return null!==_exec&&_exec[0]===name}},{key:"isTypeDefined",get:function(){return this._arguments.length>=2}},{key:"isTypeString",get:function(){return"string"==typeof this._type}},{key:"isTypeFunction",get:function(){return"function"==typeof this._type}},{key:"isTypeUndefined",get:function(){return void 0===this._type}},{key:"isValueUndefined",get:function(){return void 0===this._value}},{key:"isTypeNull",get:function(){return null===this._type}},{key:"isValueNull",get:function(){return null===this._value}},{key:"isValueObject",get:function(){return"object"===_typeof(this._value)}},{key:"isObjectInstance",get:function(){return this._value instanceof Object}},{key:"isTypeArray",get:function(){return!this.isTypeNull&&"object"===_typeof(this._type)&&this._type.constructor===Array}},{key:"isTypeRegExp",get:function(){return this._type&&this._type.constructor===RegExp}},{key:"argumentsRegExp",get:function(){return/^\[object Arguments\]$/i}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),OfType}();__webpack_exports__.default=new OfType}.call(this,__webpack_require__(1))},function(module,exports){var g;g=function(){return this}();try{g=g||new Function("return this")()}catch(e){"object"==typeof window&&(g=window)}module.exports=g}]).default;
var ofType=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),function(t){function n(t){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function r(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,u=function(){};return{s:u,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:u}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){l=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=function(){return t||window}.bind(void 0),s=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var e=this;return function(t,n){return e._setInitials(arguments,t,n),e._validate()}}var e,i,s;return e=t,(i=[{key:"_setInitials",value:function(t,e,n){this._arguments=t,this._value=e,this._type=n}},{key:"_validate",value:function(){return!!this.isTypeDefined&&(this.isTypeNull?this.isValueNull:this.isTypeUndefined?void 0===this._value:this.isTypeFunction?this._typeConstructor():this.isTypeArray?this._typeArray():this.isTypeString?this._typeString():!!this.isTypeRegExp&&this._typeRegexp())}},{key:"_typeConstructor",value:function(){return!this.isValueUndefined&&!this.isValueNull&&Object.getPrototypeOf(this._value).constructor===this._type}},{key:"_typeArray",value:function(){if(!this._type.length)return!0;var t,e=r(this._type);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(null===n&&this.isValueNull)return!0;if(void 0===n&&this.isValueUndefined)return!0;if(!this.isValueNull&&!this.isValueUndefined&&null!=n&&Object.getPrototypeOf(this._value).constructor===n)return!0}}catch(t){e.e(t)}finally{e.f()}return!1}},{key:"_typeString",value:function(){var t=this,e=this._type.toLowerCase().split("|");if(1===e.length&&""===e[0]||e.some((function(t){return"any"===t})))return!0;if(e.some((function(t){return"truthy"===t}))&&this._value)return!0;if(e.some((function(t){return"falsy"===t}))&&!this._value)return!0;if(this.isValueUndefined&&e.some((function(t){return"undefined"===t})))return!0;if(this.isValueNull&&e.some((function(t){return"null"===t})))return!0;if(this.isValueNull||void 0===this._value)return!1;var n=Object.getPrototypeOf(this._value).constructor;return!!(this.argumentsRegExp.test(this._value.toString())&&n&&n===Object&&e.some((function(t){return"arguments"===t})))||!!(e.some((function(t){return"instance"===t}))&&this.isValueObject&&n&&n!==o()[n.name])||!(!e.some((function(t){return"objectable"===t}))||!this.isObjectInstance)||e.some((function(e){return e===Object.getPrototypeOf(t._value).constructor.name.toLowerCase()}))}},{key:"_typeRegexp",value:function(){if(this._exec("any")||this._type.test(""))return!0;if(this._exec("truthy")&&this._value)return!0;if(this._exec("falsy")&&!this._value)return!0;if(this._type.test("undefined")&&this.isValueUndefined)return!0;if(this._type.test("null")&&this.isValueNull)return!0;if(this.isValueNull||void 0===this._value)return!1;var t=Object.getPrototypeOf(this._value).constructor;return!!(this._exec("arguments")&&t&&t===Object&&this.argumentsRegExp.test(this._value.toString()))||!!(this._exec("instance")&&this.isValueObject&&t&&t!==o()[t.name])||!(!this._exec("objectable")||!this.isObjectInstance)||this._type.test(Object.getPrototypeOf(this._value).constructor.name)}},{key:"_exec",value:function(t){var e=this._type.exec(t);return null!==e&&e[0]===t}},{key:"isTypeDefined",get:function(){return this._arguments.length>=2}},{key:"isTypeString",get:function(){return"string"==typeof this._type}},{key:"isTypeFunction",get:function(){return"function"==typeof this._type}},{key:"isTypeUndefined",get:function(){return void 0===this._type}},{key:"isValueUndefined",get:function(){return void 0===this._value}},{key:"isTypeNull",get:function(){return null===this._type}},{key:"isValueNull",get:function(){return null===this._value}},{key:"isValueObject",get:function(){return"object"===n(this._value)}},{key:"isObjectInstance",get:function(){return this._value instanceof Object}},{key:"isTypeArray",get:function(){return!this.isTypeNull&&"object"===n(this._type)&&this._type.constructor===Array}},{key:"isTypeRegExp",get:function(){return this._type&&this._type.constructor===RegExp}},{key:"argumentsRegExp",get:function(){return/^\[object Arguments\]$/i}}])&&u(e.prototype,i),s&&u(e,s),t}();e.default=new s}.call(this,n(1))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n}]).default;

@@ -1,1 +0,1 @@

module.exports=function(modules){var installedModules={};function __webpack_require__(moduleId){if(installedModules[moduleId])return installedModules[moduleId].exports;var module=installedModules[moduleId]={i:moduleId,l:!1,exports:{}};return modules[moduleId].call(module.exports,module,module.exports,__webpack_require__),module.l=!0,module.exports}return __webpack_require__.m=modules,__webpack_require__.c=installedModules,__webpack_require__.d=function(exports,name,getter){__webpack_require__.o(exports,name)||Object.defineProperty(exports,name,{enumerable:!0,get:getter})},__webpack_require__.r=function(exports){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(exports,"__esModule",{value:!0})},__webpack_require__.t=function(value,mode){if(1&mode&&(value=__webpack_require__(value)),8&mode)return value;if(4&mode&&"object"==typeof value&&value&&value.__esModule)return value;var ns=Object.create(null);if(__webpack_require__.r(ns),Object.defineProperty(ns,"default",{enumerable:!0,value:value}),2&mode&&"string"!=typeof value)for(var key in value)__webpack_require__.d(ns,key,function(key){return value[key]}.bind(null,key));return ns},__webpack_require__.n=function(module){var getter=module&&module.__esModule?function(){return module.default}:function(){return module};return __webpack_require__.d(getter,"a",getter),getter},__webpack_require__.o=function(object,property){return Object.prototype.hasOwnProperty.call(object,property)},__webpack_require__.p="",__webpack_require__(__webpack_require__.s=0)}([function(module,__webpack_exports__,__webpack_require__){"use strict";function _typeof(obj){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})(obj)}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}__webpack_require__.r(__webpack_exports__);var _g=function(){return global||window}.bind(void 0),OfType=function(){function OfType(){!function(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,OfType);var _this=this;return function(value,type){return _this._setInitials(arguments,value,type),_this._validate()}}var Constructor,protoProps,staticProps;return Constructor=OfType,(protoProps=[{key:"_setInitials",value:function(_arguments,value,type){this._arguments=_arguments,this._value=value,this._type=type}},{key:"_validate",value:function(){return!!this.isTypeDefined&&(this.isTypeNull?this.isValueNull:this.isTypeUndefined?void 0===this._value:this.isTypeFunction?this._typeConstructor():this.isTypeArray?this._typeArray():this.isTypeString?this._typeString():!!this.isTypeRegExp&&this._typeRegexp())}},{key:"_typeConstructor",value:function(){return!this.isValueUndefined&&!this.isValueNull&&Object.getPrototypeOf(this._value).constructor===this._type}},{key:"_typeArray",value:function(){if(!this._type.length)return!0;var _iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=this._type[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){var t=_step.value;if(null===t&&this.isValueNull)return!0;if(void 0===t&&this.isValueUndefined)return!0;if(!this.isValueNull&&!this.isValueUndefined&&(null!==t&&void 0!==t&&Object.getPrototypeOf(this._value).constructor===t))return!0}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return!1}},{key:"_typeString",value:function(){var _this2=this,typeList=this._type.toLowerCase().split("|");if(1===typeList.length&&""===typeList[0]||typeList.some(function(i){return"any"===i}))return!0;if(typeList.some(function(i){return"truthy"===i})&&this._value)return!0;if(typeList.some(function(i){return"falsy"===i})&&!this._value)return!0;if(this.isValueUndefined&&typeList.some(function(i){return"undefined"===i}))return!0;if(this.isValueNull&&typeList.some(function(i){return"null"===i}))return!0;if(this.isValueNull||void 0===this._value)return!1;var valueConstructor=Object.getPrototypeOf(this._value).constructor;return!!(this.argumentsRegExp.test(this._value.toString())&&valueConstructor&&valueConstructor===Object&&typeList.some(function(i){return"arguments"===i}))||(!!(typeList.some(function(i){return"instance"===i})&&this.isValueObject&&valueConstructor&&valueConstructor!==_g()[valueConstructor.name])||(!(!typeList.some(function(i){return"objectable"===i})||!this.isObjectInstance)||typeList.some(function(i){return i===Object.getPrototypeOf(_this2._value).constructor.name.toLowerCase()})))}},{key:"_typeRegexp",value:function(){if(this._exec("any")||this._type.test(""))return!0;if(this._exec("truthy")&&this._value)return!0;if(this._exec("falsy")&&!this._value)return!0;if(this._type.test("undefined")&&this.isValueUndefined)return!0;if(this._type.test("null")&&this.isValueNull)return!0;if(this.isValueNull||void 0===this._value)return!1;var valueConstructor=Object.getPrototypeOf(this._value).constructor;return!!(this._exec("arguments")&&valueConstructor&&valueConstructor===Object&&this.argumentsRegExp.test(this._value.toString()))||(!!(this._exec("instance")&&this.isValueObject&&valueConstructor&&valueConstructor!==_g()[valueConstructor.name])||(!(!this._exec("objectable")||!this.isObjectInstance)||this._type.test(Object.getPrototypeOf(this._value).constructor.name)))}},{key:"_exec",value:function(name){var _exec=this._type.exec(name);return null!==_exec&&_exec[0]===name}},{key:"isTypeDefined",get:function(){return this._arguments.length>=2}},{key:"isTypeString",get:function(){return"string"==typeof this._type}},{key:"isTypeFunction",get:function(){return"function"==typeof this._type}},{key:"isTypeUndefined",get:function(){return void 0===this._type}},{key:"isValueUndefined",get:function(){return void 0===this._value}},{key:"isTypeNull",get:function(){return null===this._type}},{key:"isValueNull",get:function(){return null===this._value}},{key:"isValueObject",get:function(){return"object"===_typeof(this._value)}},{key:"isObjectInstance",get:function(){return this._value instanceof Object}},{key:"isTypeArray",get:function(){return!this.isTypeNull&&"object"===_typeof(this._type)&&this._type.constructor===Array}},{key:"isTypeRegExp",get:function(){return this._type&&this._type.constructor===RegExp}},{key:"argumentsRegExp",get:function(){return/^\[object Arguments\]$/i}}])&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),OfType}();__webpack_exports__.default=new OfType}]).default;
module.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t,e){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,e){if(!t)return;if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(t,e)}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,l=!1;return{s:function(){n=t[Symbol.iterator]()},n:function(){var t=n.next();return s=t.done,t},e:function(t){l=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(l)throw o}}}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}n.r(e);var s=function(){return global||window}.bind(void 0),l=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t);var e=this;return function(t,n){return e._setInitials(arguments,t,n),e._validate()}}var e,n,u;return e=t,(n=[{key:"_setInitials",value:function(t,e,n){this._arguments=t,this._value=e,this._type=n}},{key:"_validate",value:function(){return!!this.isTypeDefined&&(this.isTypeNull?this.isValueNull:this.isTypeUndefined?void 0===this._value:this.isTypeFunction?this._typeConstructor():this.isTypeArray?this._typeArray():this.isTypeString?this._typeString():!!this.isTypeRegExp&&this._typeRegexp())}},{key:"_typeConstructor",value:function(){return!this.isValueUndefined&&!this.isValueNull&&Object.getPrototypeOf(this._value).constructor===this._type}},{key:"_typeArray",value:function(){if(!this._type.length)return!0;var t,e=i(this._type);try{for(e.s();!(t=e.n()).done;){var n=t.value;if(null===n&&this.isValueNull)return!0;if(void 0===n&&this.isValueUndefined)return!0;if(!this.isValueNull&&!this.isValueUndefined&&null!=n&&Object.getPrototypeOf(this._value).constructor===n)return!0}}catch(t){e.e(t)}finally{e.f()}return!1}},{key:"_typeString",value:function(){var t=this,e=this._type.toLowerCase().split("|");if(1===e.length&&""===e[0]||e.some((function(t){return"any"===t})))return!0;if(e.some((function(t){return"truthy"===t}))&&this._value)return!0;if(e.some((function(t){return"falsy"===t}))&&!this._value)return!0;if(this.isValueUndefined&&e.some((function(t){return"undefined"===t})))return!0;if(this.isValueNull&&e.some((function(t){return"null"===t})))return!0;if(this.isValueNull||void 0===this._value)return!1;var n=Object.getPrototypeOf(this._value).constructor;return!!(this.argumentsRegExp.test(this._value.toString())&&n&&n===Object&&e.some((function(t){return"arguments"===t})))||!!(e.some((function(t){return"instance"===t}))&&this.isValueObject&&n&&n!==s()[n.name])||!(!e.some((function(t){return"objectable"===t}))||!this.isObjectInstance)||e.some((function(e){return e===Object.getPrototypeOf(t._value).constructor.name.toLowerCase()}))}},{key:"_typeRegexp",value:function(){if(this._exec("any")||this._type.test(""))return!0;if(this._exec("truthy")&&this._value)return!0;if(this._exec("falsy")&&!this._value)return!0;if(this._type.test("undefined")&&this.isValueUndefined)return!0;if(this._type.test("null")&&this.isValueNull)return!0;if(this.isValueNull||void 0===this._value)return!1;var t=Object.getPrototypeOf(this._value).constructor;return!!(this._exec("arguments")&&t&&t===Object&&this.argumentsRegExp.test(this._value.toString()))||!!(this._exec("instance")&&this.isValueObject&&t&&t!==s()[t.name])||!(!this._exec("objectable")||!this.isObjectInstance)||this._type.test(Object.getPrototypeOf(this._value).constructor.name)}},{key:"_exec",value:function(t){var e=this._type.exec(t);return null!==e&&e[0]===t}},{key:"isTypeDefined",get:function(){return this._arguments.length>=2}},{key:"isTypeString",get:function(){return"string"==typeof this._type}},{key:"isTypeFunction",get:function(){return"function"==typeof this._type}},{key:"isTypeUndefined",get:function(){return void 0===this._type}},{key:"isValueUndefined",get:function(){return void 0===this._value}},{key:"isTypeNull",get:function(){return null===this._type}},{key:"isValueNull",get:function(){return null===this._value}},{key:"isValueObject",get:function(){return"object"===r(this._value)}},{key:"isObjectInstance",get:function(){return this._value instanceof Object}},{key:"isTypeArray",get:function(){return!this.isTypeNull&&"object"===r(this._type)&&this._type.constructor===Array}},{key:"isTypeRegExp",get:function(){return this._type&&this._type.constructor===RegExp}},{key:"argumentsRegExp",get:function(){return/^\[object Arguments\]$/i}}])&&o(e.prototype,n),u&&o(e,u),t}();e.default=new l}]).default;
{
"name": "of-type",
"version": "3.0.2",
"version": "3.0.3",
"description": "Check if the given value is of the particular type or types.",
"main": "dist/of-type.node.js",
"scripts": {
"start": "webpack --config webpack.dev.js",
"build": "webpack --config webpack.prod.js",
"start": "webpack --env.dev",
"build": "webpack --env.prod",
"test": "babel-node jasmine.conf.js"

@@ -30,15 +30,15 @@ },

"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.0.1",
"@babel/node": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-loader": "^8.0.2",
"jasmine": "^3.3.1",
"jasmine-spec-reporter": "^4.2.1",
"uglifyjs-webpack-plugin": "^1.3.0",
"webpack": "^4.19.1",
"webpack-cli": "^3.1.1",
"webpack-merge": "^4.1.4",
"webpack-node-externals": "^1.7.2"
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/node": "^7.10.5",
"@babel/preset-env": "^7.11.0",
"babel-loader": "^8.1.0",
"jasmine": "^3.6.1",
"jasmine-spec-reporter": "^5.0.2",
"terser-webpack-plugin": "^4.1.0",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-merge": "^5.1.1",
"webpack-node-externals": "^2.5.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc