Comparing version 3.0.1 to 3.0.2
@@ -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.name===this._type.name}},{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.name===t.name))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&&"Object"===valueConstructor.name&&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&&"Object"===valueConstructor.name&&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)&&"Array"===this._type.constructor.name}},{key:"isTypeRegExp",get:function(){return this._type&&"RegExp"===this._type.constructor.name}},{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(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; |
@@ -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.name===this._type.name}},{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.name===t.name))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&&"Object"===valueConstructor.name&&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&&"Object"===valueConstructor.name&&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)&&"Array"===this._type.constructor.name}},{key:"isTypeRegExp",get:function(){return this._type&&"RegExp"===this._type.constructor.name}},{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(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; |
{ | ||
"name": "of-type", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Check if the given value is of the particular type or types.", | ||
@@ -5,0 +5,0 @@ "main": "dist/of-type.node.js", |
@@ -49,7 +49,7 @@ const _g = (function () { return global || window; }).bind(this); | ||
get isTypeArray(){ | ||
return !this.isTypeNull && typeof this._type === 'object' && this._type.constructor.name === 'Array'; | ||
return !this.isTypeNull && typeof this._type === 'object' && this._type.constructor === Array; | ||
} | ||
get isTypeRegExp(){ | ||
return this._type && this._type.constructor.name === 'RegExp'; | ||
return this._type && this._type.constructor === RegExp; | ||
} | ||
@@ -80,3 +80,3 @@ | ||
if (this.isValueUndefined || this.isValueNull) return false; | ||
return Object.getPrototypeOf(this._value).constructor.name === this._type.name; | ||
return Object.getPrototypeOf(this._value).constructor === this._type; | ||
} | ||
@@ -91,3 +91,3 @@ | ||
if (t === null || typeof t === 'undefined') continue; | ||
if (Object.getPrototypeOf(this._value).constructor.name === t.name) return true; | ||
if (Object.getPrototypeOf(this._value).constructor === t) return true; | ||
} | ||
@@ -106,3 +106,3 @@ return false; | ||
const valueConstructor = Object.getPrototypeOf(this._value).constructor; | ||
if ((this.argumentsRegExp).test(this._value.toString()) && valueConstructor && valueConstructor.name === 'Object' && typeList.some((i) => i === 'arguments')) return true; | ||
if ((this.argumentsRegExp).test(this._value.toString()) && valueConstructor && valueConstructor === Object && typeList.some((i) => i === 'arguments')) return true; | ||
if (typeList.some((i) => i === 'instance') && this.isValueObject && valueConstructor && valueConstructor !== _g()[valueConstructor.name]) return true; | ||
@@ -121,3 +121,3 @@ if (typeList.some((i) => i === 'objectable') && this.isObjectInstance) return true; | ||
const valueConstructor = Object.getPrototypeOf(this._value).constructor; | ||
if (this._exec('arguments') && valueConstructor && valueConstructor.name === 'Object' && (this.argumentsRegExp).test(this._value.toString())) return true; | ||
if (this._exec('arguments') && valueConstructor && valueConstructor === Object && (this.argumentsRegExp).test(this._value.toString())) return true; | ||
if (this._exec('instance') && this.isValueObject && valueConstructor && valueConstructor !== _g()[valueConstructor.name]) return true; | ||
@@ -124,0 +124,0 @@ if (this._exec('objectable') && this.isObjectInstance) return true; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
614985