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

vue-types

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-types - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

2

dist/vue-types.js

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

function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function o(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}function i(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var u=Object.prototype,a=u.toString,f=u.hasOwnProperty,c=/^\s*function (\w+)/;function s(e){var t,r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){var n=r.toString().match(c);return n?n[1]:""}return""}var l=function(e){var t,r;return!1!==i(e)&&"function"==typeof(t=e.constructor)&&!1!==i(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")},p=function(e){return e},y=p;if("production"!==process.env.NODE_ENV){var v="undefined"!=typeof console;y=v?function(e){console.warn("[VueTypes warn]: "+e)}:p}var d=function(e,t){return f.call(e,t)},h=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},b=Array.isArray||function(e){return"[object Array]"===a.call(e)},O=function(e){return"[object Function]"===a.call(e)},g=function(e){return l(e)&&d(e,"_vueTypes_name")},m=function(e){return l(e)&&(d(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return d(e,t)}))};function j(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function _(e,t,r){var n;void 0===r&&(r=!1);var o=!0,i="";n=l(e)?e:{type:e};var u=g(n)?n._vueTypes_name+" - ":"";if(m(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return o;if(!n.required&&void 0===t)return o;b(n.type)?(o=n.type.some(function(e){return!0===_(e,t,!0)}),i=n.type.map(function(e){return s(e)}).join(" or ")):o="Array"===(i=s(n))?b(t):"Object"===i?l(t):"String"===i||"Number"===i||"Boolean"===i||"Function"===i?function(e){if(null==e)return"";var t=e.constructor.toString().match(c);return t?t[1]:""}(t)===i:t instanceof n.type}if(!o){var a=u+'value "'+t+'" should be of type "'+i+'"';return!1===r?(y(a),!1):a}if(d(n,"validator")&&O(n.validator)){var f=y,p=[];if(y=function(e){p.push(e)},o=n.validator(t),y=f,!o){var v=(p.length>1?"* ":"")+p.join("\n* ");return p.length=0,!1===r?(y(v),o):v}}return o}function T(e,t){var r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0===e?(d(this,"default")&&delete this.default,this):O(e)||!0===_(this,e,!0)?(this.default=b(e)?function(){return[].concat(e)}:l(e)?function(){return Object.assign({},e)}:e,this):(y(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),n=r.validator;return O(n)&&(r.validator=j(n,r)),r}function x(e,t){var r=T(e,t);return Object.defineProperty(r,"validate",{value:function(e){return O(this.validator)&&y(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=j(e,this),this}})}function w(e,t,r){var n,i,u=(n=t,i={},Object.getOwnPropertyNames(n).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(n,e)}),Object.defineProperties({},i));if(u._vueTypes_name=e,!l(r))return u;var a,f,c=r.validator,s=o(r,["validator"]);if(O(c)){var p=u.validator;p&&(p=null!==(f=(a=p).__original)&&void 0!==f?f:a),u.validator=j(p?function(e){return p.call(this,e)&&c.call(this,e)}:c,u)}return Object.assign(u,s)}function k(e){return e.replace(/^(?!\s*$)/gm," ")}var P=function(){return x("any",{})},A=function(){return x("function",{type:Function})},E=function(){return x("boolean",{type:Boolean})},N=function(){return x("string",{type:String})},V=function(){return x("number",{type:Number})},q=function(){return x("array",{type:Array})},S=function(){return x("object",{type:Object})},F=function(){return T("integer",{type:Number,validator:function(e){return h(e)}})},D=function(){return T("symbol",{validator:function(e){return"symbol"==typeof e}})};function L(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return T(e.name||"<<anonymous function>>",{validator:function(r){var n=e(r);return n||y(this._vueTypes_name+" - "+t),n}})}function Y(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'."',r=e.reduce(function(e,t){if(null!=t){var r=t.constructor;-1===e.indexOf(r)&&e.push(r)}return e},[]);return T("oneOf",{type:r.length>0?r:void 0,validator:function(r){var n=-1!==e.indexOf(r);return n||y(t),n}})}function B(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,r=[],n=0;n<e.length;n+=1){var o=e[n];if(m(o)){if(g(o)&&"oneOf"===o._vueTypes_name){r=r.concat(o.type);continue}if(O(o.validator)&&(t=!0),!0!==o.type&&o.type){r=r.concat(o.type);continue}}r.push(o)}return r=r.filter(function(e,t){return r.indexOf(e)===t}),T("oneOfType",t?{type:r,validator:function(t){var r=[],n=e.some(function(e){var n=_(g(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||y("oneOfType - provided value does not match any of the "+r.length+" passed-in validators:\n"+k(r.join("\n"))),n}}:{type:r})}function M(e){return T("arrayOf",{type:Array,validator:function(t){var r,n=t.every(function(t){return!0===(r=_(e,t,!0))});return n||y("arrayOf - value validation error:\n"+k(r)),n}})}function I(e){return T("instanceOf",{type:e})}function J(e){return T("objectOf",{type:Object,validator:function(t){var r,n=Object.keys(t).every(function(n){return!0===(r=_(e,t[n],!0))});return n||y("objectOf - value validation error:\n"+k(r)),n}})}function R(e){var t=Object.keys(e),r=t.filter(function(t){var r;return!!(null===(r=e[t])||void 0===r?void 0:r.required)}),n=T("shape",{type:Object,validator:function(n){var o=this;if(!l(n))return!1;var i=Object.keys(n);if(r.length>0&&r.some(function(e){return-1===i.indexOf(e)})){var u=r.filter(function(e){return-1===i.indexOf(e)});return y(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return i.every(function(r){if(-1===t.indexOf(r))return!0===o._vueTypes_isLoose||(y('shape - shape definition does not include a "'+r+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var i=_(e[r],n[r],!0);return"string"==typeof i&&y('shape - "'+r+'" property validation error:\n '+k(i)),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),n}var $=function(){function e(){}return e.extend=function(e){var t=this;if(b(e))return e.forEach(function(e){return t.extend(e)}),this;var r=e.name,n=e.validate,i=void 0!==n&&n,u=e.getter,a=void 0!==u&&u,f=o(e,["name","validate","getter"]);if(d(this,r))throw new TypeError('[VueTypes error]: Type "'+r+'" already defined');var c,s=f.type;return g(s)?(delete f.type,Object.defineProperty(this,r,a?{get:function(){return w(r,s,f)}}:{value:function(){var e,t=w(r,s,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return i?x(r,e):T(r,e)},enumerable:!0}:{value:function(){var e,t,n=Object.assign({},f);return e=i?x(r,n):T(r,n),n.validator&&(e.validator=(t=n.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,r,c))},t(e,null,[{key:"any",get:function(){return P()}},{key:"func",get:function(){return A().def(this.defaults.func)}},{key:"bool",get:function(){return E().def(this.defaults.bool)}},{key:"string",get:function(){return N().def(this.defaults.string)}},{key:"number",get:function(){return V().def(this.defaults.number)}},{key:"array",get:function(){return q().def(this.defaults.array)}},{key:"object",get:function(){return S().def(this.defaults.object)}},{key:"integer",get:function(){return F().def(this.defaults.integer)}},{key:"symbol",get:function(){return D()}}]),e}();function z(e){var o;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(o=function(o){function i(){return o.apply(this,arguments)||this}return n(i,o),t(i,null,[{key:"sensibleDefaults",get:function(){return r({},this.defaults)},set:function(t){this.defaults=!1!==t?r({},!0!==t?t:e):{}}}]),i}($)).defaults=r({},e),o}$.defaults={},$.custom=L,$.oneOf=Y,$.instanceOf=I,$.oneOfType=B,$.arrayOf=M,$.objectOf=J,$.shape=R,$.utils={validate:function(e,t){return!0===_(t,e,!0)},toType:function(e,t,r){return void 0===r&&(r=!1),r?x(e,t):T(e,t)}};var C=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(z());Object.defineProperty(exports,"__esModule",{value:!0}),exports.any=P,exports.array=q,exports.arrayOf=M,exports.bool=E,exports.createTypes=z,exports.custom=L,exports.default=C,exports.fromType=w,exports.func=A,exports.instanceOf=I,exports.integer=F,exports.number=V,exports.object=S,exports.objectOf=J,exports.oneOf=Y,exports.oneOfType=B,exports.shape=R,exports.string=N,exports.symbol=D,exports.toType=T,exports.toValidableType=x,exports.validateType=_;
function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function t(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function n(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function o(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(o[r]=e[r]);return o}function i(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var u=Object.prototype,a=u.toString,f=u.hasOwnProperty,c=/^\s*function (\w+)/;function s(e){var t,r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){var n=r.toString().match(c);return n?n[1]:""}return""}var l=function(e){var t,r;return!1!==i(e)&&"function"==typeof(t=e.constructor)&&!1!==i(r=t.prototype)&&!1!==r.hasOwnProperty("isPrototypeOf")},p=function(e){return e},y=p;if("production"!==process.env.NODE_ENV){var v="undefined"!=typeof console;y=v?function(e){console.warn("[VueTypes warn]: "+e)}:p}var d=function(e,t){return f.call(e,t)},h=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},b=Array.isArray||function(e){return"[object Array]"===a.call(e)},O=function(e){return"[object Function]"===a.call(e)},g=function(e){return l(e)&&d(e,"_vueTypes_name")},m=function(e){return l(e)&&(d(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return d(e,t)}))};function j(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function _(e,t,r){var n;void 0===r&&(r=!1);var o=!0,i="";n=l(e)?e:{type:e};var u=g(n)?n._vueTypes_name+" - ":"";if(m(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return o;if(!n.required&&void 0===t)return o;b(n.type)?(o=n.type.some(function(e){return!0===_(e,t,!0)}),i=n.type.map(function(e){return s(e)}).join(" or ")):o="Array"===(i=s(n))?b(t):"Object"===i?l(t):"String"===i||"Number"===i||"Boolean"===i||"Function"===i?function(e){if(null==e)return"";var t=e.constructor.toString().match(c);return t?t[1]:""}(t)===i:t instanceof n.type}if(!o){var a=u+'value "'+t+'" should be of type "'+i+'"';return!1===r?(y(a),!1):a}if(d(n,"validator")&&O(n.validator)){var f=y,p=[];if(y=function(e){p.push(e)},o=n.validator(t),y=f,!o){var v=(p.length>1?"* ":"")+p.join("\n* ");return p.length=0,!1===r?(y(v),o):v}}return o}function T(e,t){var r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0!==e||this.default?O(e)||!0===_(this,e,!0)?(this.default=b(e)?function(){return[].concat(e)}:l(e)?function(){return Object.assign({},e)}:e,this):(y(this._vueTypes_name+' - invalid default value: "'+e+'"'),this):this}}}),n=r.validator;return O(n)&&(r.validator=j(n,r)),r}function x(e,t){var r=T(e,t);return Object.defineProperty(r,"validate",{value:function(e){return O(this.validator)&&y(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=j(e,this),this}})}function w(e,t,r){var n,i,u=(n=t,i={},Object.getOwnPropertyNames(n).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(n,e)}),Object.defineProperties({},i));if(u._vueTypes_name=e,!l(r))return u;var a,f,c=r.validator,s=o(r,["validator"]);if(O(c)){var p=u.validator;p&&(p=null!==(f=(a=p).__original)&&void 0!==f?f:a),u.validator=j(p?function(e){return p.call(this,e)&&c.call(this,e)}:c,u)}return Object.assign(u,s)}function k(e){return e.replace(/^(?!\s*$)/gm," ")}var P=function(){return x("any",{})},A=function(){return x("function",{type:Function})},E=function(){return x("boolean",{type:Boolean})},N=function(){return x("string",{type:String})},V=function(){return x("number",{type:Number})},q=function(){return x("array",{type:Array})},S=function(){return x("object",{type:Object})},F=function(){return T("integer",{type:Number,validator:function(e){return h(e)}})},D=function(){return T("symbol",{validator:function(e){return"symbol"==typeof e}})};function L(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return T(e.name||"<<anonymous function>>",{validator:function(r){var n=e(r);return n||y(this._vueTypes_name+" - "+t),n}})}function Y(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'".',r=e.reduce(function(e,t){if(null!=t){var r=t.constructor;-1===e.indexOf(r)&&e.push(r)}return e},[]);return T("oneOf",{type:r.length>0?r:void 0,validator:function(r){var n=-1!==e.indexOf(r);return n||y(t),n}})}function B(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,r=[],n=0;n<e.length;n+=1){var o=e[n];if(m(o)){if(g(o)&&"oneOf"===o._vueTypes_name){r=r.concat(o.type);continue}if(O(o.validator)&&(t=!0),!0!==o.type&&o.type){r=r.concat(o.type);continue}}r.push(o)}return r=r.filter(function(e,t){return r.indexOf(e)===t}),T("oneOfType",t?{type:r,validator:function(t){var r=[],n=e.some(function(e){var n=_(g(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||y("oneOfType - provided value does not match any of the "+r.length+" passed-in validators:\n"+k(r.join("\n"))),n}}:{type:r})}function M(e){return T("arrayOf",{type:Array,validator:function(t){var r,n=t.every(function(t){return!0===(r=_(e,t,!0))});return n||y("arrayOf - value validation error:\n"+k(r)),n}})}function I(e){return T("instanceOf",{type:e})}function J(e){return T("objectOf",{type:Object,validator:function(t){var r,n=Object.keys(t).every(function(n){return!0===(r=_(e,t[n],!0))});return n||y("objectOf - value validation error:\n"+k(r)),n}})}function R(e){var t=Object.keys(e),r=t.filter(function(t){var r;return!!(null===(r=e[t])||void 0===r?void 0:r.required)}),n=T("shape",{type:Object,validator:function(n){var o=this;if(!l(n))return!1;var i=Object.keys(n);if(r.length>0&&r.some(function(e){return-1===i.indexOf(e)})){var u=r.filter(function(e){return-1===i.indexOf(e)});return y(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return i.every(function(r){if(-1===t.indexOf(r))return!0===o._vueTypes_isLoose||(y('shape - shape definition does not include a "'+r+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var i=_(e[r],n[r],!0);return"string"==typeof i&&y('shape - "'+r+'" property validation error:\n '+k(i)),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),n}var $=function(){function e(){}return e.extend=function(e){var t=this;if(b(e))return e.forEach(function(e){return t.extend(e)}),this;var r=e.name,n=e.validate,i=void 0!==n&&n,u=e.getter,a=void 0!==u&&u,f=o(e,["name","validate","getter"]);if(d(this,r))throw new TypeError('[VueTypes error]: Type "'+r+'" already defined');var c,s=f.type;return g(s)?(delete f.type,Object.defineProperty(this,r,a?{get:function(){return w(r,s,f)}}:{value:function(){var e,t=w(r,s,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return i?x(r,e):T(r,e)},enumerable:!0}:{value:function(){var e,t,n=Object.assign({},f);return e=i?x(r,n):T(r,n),n.validator&&(e.validator=(t=n.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,r,c))},t(e,null,[{key:"any",get:function(){return P()}},{key:"func",get:function(){return A().def(this.defaults.func)}},{key:"bool",get:function(){return E().def(this.defaults.bool)}},{key:"string",get:function(){return N().def(this.defaults.string)}},{key:"number",get:function(){return V().def(this.defaults.number)}},{key:"array",get:function(){return q().def(this.defaults.array)}},{key:"object",get:function(){return S().def(this.defaults.object)}},{key:"integer",get:function(){return F().def(this.defaults.integer)}},{key:"symbol",get:function(){return D()}}]),e}();function z(e){var o;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(o=function(o){function i(){return o.apply(this,arguments)||this}return n(i,o),t(i,null,[{key:"sensibleDefaults",get:function(){return r({},this.defaults)},set:function(t){this.defaults=!1!==t?r({},!0!==t?t:e):{}}}]),i}($)).defaults=r({},e),o}$.defaults={},$.custom=L,$.oneOf=Y,$.instanceOf=I,$.oneOfType=B,$.arrayOf=M,$.objectOf=J,$.shape=R,$.utils={validate:function(e,t){return!0===_(t,e,!0)},toType:function(e,t,r){return void 0===r&&(r=!1),r?x(e,t):T(e,t)}};var C=function(e){function t(){return e.apply(this,arguments)||this}return n(t,e),t}(z());Object.defineProperty(exports,"__esModule",{value:!0}),exports.any=P,exports.array=q,exports.arrayOf=M,exports.bool=E,exports.createTypes=z,exports.custom=L,exports.default=C,exports.fromType=w,exports.func=A,exports.instanceOf=I,exports.integer=F,exports.number=V,exports.object=S,exports.objectOf=J,exports.oneOf=Y,exports.oneOfType=B,exports.shape=R,exports.string=N,exports.symbol=D,exports.toType=T,exports.toValidableType=x,exports.validateType=_;
//# sourceMappingURL=vue-types.js.map

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

function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function o(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var u=Object.prototype,a=u.toString,f=u.hasOwnProperty,c=/^\s*function (\w+)/;function l(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(c);return r?r[1]:""}return""}var s=function(e){var t,n;return!1!==o(e)&&"function"==typeof(t=e.constructor)&&!1!==o(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},v=function(e){return e},y=v;if("production"!==process.env.NODE_ENV){var p="undefined"!=typeof console;y=p?function(e){console.warn("[VueTypes warn]: "+e)}:v}var d=function(e,t){return f.call(e,t)},h=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},b=Array.isArray||function(e){return"[object Array]"===a.call(e)},O=function(e){return"[object Function]"===a.call(e)},g=function(e){return s(e)&&d(e,"_vueTypes_name")},m=function(e){return s(e)&&(d(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return d(e,t)}))};function j(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function _(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=s(e)?e:{type:e};var u=g(r)?r._vueTypes_name+" - ":"";if(m(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;b(r.type)?(i=r.type.some(function(e){return!0===_(e,t,!0)}),o=r.type.map(function(e){return l(e)}).join(" or ")):i="Array"===(o=l(r))?b(t):"Object"===o?s(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(c);return t?t[1]:""}(t)===o:t instanceof r.type}if(!i){var a=u+'value "'+t+'" should be of type "'+o+'"';return!1===n?(y(a),!1):a}if(d(r,"validator")&&O(r.validator)){var f=y,v=[];if(y=function(e){v.push(e)},i=r.validator(t),y=f,!i){var p=(v.length>1?"* ":"")+v.join("\n* ");return v.length=0,!1===n?(y(p),i):p}}return i}function T(e,t){var n=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0===e?(d(this,"default")&&delete this.default,this):O(e)||!0===_(this,e,!0)?(this.default=b(e)?function(){return[].concat(e)}:s(e)?function(){return Object.assign({},e)}:e,this):(y(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),r=n.validator;return O(r)&&(n.validator=j(r,n)),n}function w(e,t){var n=T(e,t);return Object.defineProperty(n,"validate",{value:function(e){return O(this.validator)&&y(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=j(e,this),this}})}function k(e,t,n){var r,o,u=(r=t,o={},Object.getOwnPropertyNames(r).forEach(function(e){o[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},o));if(u._vueTypes_name=e,!s(n))return u;var a,f,c=n.validator,l=i(n,["validator"]);if(O(c)){var v=u.validator;v&&(v=null!==(f=(a=v).__original)&&void 0!==f?f:a),u.validator=j(v?function(e){return v.call(this,e)&&c.call(this,e)}:c,u)}return Object.assign(u,l)}function P(e){return e.replace(/^(?!\s*$)/gm," ")}var x=function(){return w("any",{})},A=function(){return w("function",{type:Function})},E=function(){return w("boolean",{type:Boolean})},N=function(){return w("string",{type:String})},q=function(){return w("number",{type:Number})},S=function(){return w("array",{type:Array})},V=function(){return w("object",{type:Object})},F=function(){return T("integer",{type:Number,validator:function(e){return h(e)}})},D=function(){return T("symbol",{validator:function(e){return"symbol"==typeof e}})};function L(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return T(e.name||"<<anonymous function>>",{validator:function(n){var r=e(n);return r||y(this._vueTypes_name+" - "+t),r}})}function Y(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'."',n=e.reduce(function(e,t){if(null!=t){var n=t.constructor;-1===e.indexOf(n)&&e.push(n)}return e},[]);return T("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||y(t),r}})}function B(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,n=[],r=0;r<e.length;r+=1){var i=e[r];if(m(i)){if(g(i)&&"oneOf"===i._vueTypes_name){n=n.concat(i.type);continue}if(O(i.validator)&&(t=!0),!0!==i.type&&i.type){n=n.concat(i.type);continue}}n.push(i)}return n=n.filter(function(e,t){return n.indexOf(e)===t}),T("oneOfType",t?{type:n,validator:function(t){var n=[],r=e.some(function(e){var r=_(g(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||y("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+P(n.join("\n"))),r}}:{type:n})}function I(e){return T("arrayOf",{type:Array,validator:function(t){var n,r=t.every(function(t){return!0===(n=_(e,t,!0))});return r||y("arrayOf - value validation error:\n"+P(n)),r}})}function J(e){return T("instanceOf",{type:e})}function M(e){return T("objectOf",{type:Object,validator:function(t){var n,r=Object.keys(t).every(function(r){return!0===(n=_(e,t[r],!0))});return r||y("objectOf - value validation error:\n"+P(n)),r}})}function R(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.required)}),r=T("shape",{type:Object,validator:function(r){var i=this;if(!s(r))return!1;var o=Object.keys(r);if(n.length>0&&n.some(function(e){return-1===o.indexOf(e)})){var u=n.filter(function(e){return-1===o.indexOf(e)});return y(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return o.every(function(n){if(-1===t.indexOf(n))return!0===i._vueTypes_isLoose||(y('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=_(e[n],r[n],!0);return"string"==typeof o&&y('shape - "'+n+'" property validation error:\n '+P(o)),!0===o})}});return Object.defineProperty(r,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),r}var $=function(){function e(){}return e.extend=function(e){var t=this;if(b(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,o=void 0!==r&&r,u=e.getter,a=void 0!==u&&u,f=i(e,["name","validate","getter"]);if(d(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return g(l)?(delete f.type,Object.defineProperty(this,n,a?{get:function(){return k(n,l,f)}}:{value:function(){var e,t=k(n,l,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return o?w(n,e):T(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=o?w(n,r):T(n,r),r.validator&&(e.validator=(t=r.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,n,c))},t(e,null,[{key:"any",get:function(){return x()}},{key:"func",get:function(){return A().def(this.defaults.func)}},{key:"bool",get:function(){return E().def(this.defaults.bool)}},{key:"string",get:function(){return N().def(this.defaults.string)}},{key:"number",get:function(){return q().def(this.defaults.number)}},{key:"array",get:function(){return S().def(this.defaults.array)}},{key:"object",get:function(){return V().def(this.defaults.object)}},{key:"integer",get:function(){return F().def(this.defaults.integer)}},{key:"symbol",get:function(){return D()}}]),e}();function z(e){var i;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(i=function(i){function o(){return i.apply(this,arguments)||this}return r(o,i),t(o,null,[{key:"sensibleDefaults",get:function(){return n({},this.defaults)},set:function(t){this.defaults=!1!==t?n({},!0!==t?t:e):{}}}]),o}($)).defaults=n({},e),i}$.defaults={},$.custom=L,$.oneOf=Y,$.instanceOf=J,$.oneOfType=B,$.arrayOf=I,$.objectOf=M,$.shape=R,$.utils={validate:function(e,t){return!0===_(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?w(e,t):T(e,t)}};var C=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t}(z());export default C;export{x as any,S as array,I as arrayOf,E as bool,z as createTypes,L as custom,k as fromType,A as func,J as instanceOf,F as integer,q as number,V as object,M as objectOf,Y as oneOf,B as oneOfType,R as shape,N as string,D as symbol,T as toType,w as toValidableType,_ as validateType};
function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function t(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function r(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function i(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function o(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var u=Object.prototype,a=u.toString,f=u.hasOwnProperty,c=/^\s*function (\w+)/;function l(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(c);return r?r[1]:""}return""}var s=function(e){var t,n;return!1!==o(e)&&"function"==typeof(t=e.constructor)&&!1!==o(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},v=function(e){return e},y=v;if("production"!==process.env.NODE_ENV){var p="undefined"!=typeof console;y=p?function(e){console.warn("[VueTypes warn]: "+e)}:v}var d=function(e,t){return f.call(e,t)},h=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},b=Array.isArray||function(e){return"[object Array]"===a.call(e)},O=function(e){return"[object Function]"===a.call(e)},g=function(e){return s(e)&&d(e,"_vueTypes_name")},m=function(e){return s(e)&&(d(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return d(e,t)}))};function j(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function _(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=s(e)?e:{type:e};var u=g(r)?r._vueTypes_name+" - ":"";if(m(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;b(r.type)?(i=r.type.some(function(e){return!0===_(e,t,!0)}),o=r.type.map(function(e){return l(e)}).join(" or ")):i="Array"===(o=l(r))?b(t):"Object"===o?s(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(c);return t?t[1]:""}(t)===o:t instanceof r.type}if(!i){var a=u+'value "'+t+'" should be of type "'+o+'"';return!1===n?(y(a),!1):a}if(d(r,"validator")&&O(r.validator)){var f=y,v=[];if(y=function(e){v.push(e)},i=r.validator(t),y=f,!i){var p=(v.length>1?"* ":"")+v.join("\n* ");return v.length=0,!1===n?(y(p),i):p}}return i}function T(e,t){var n=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0!==e||this.default?O(e)||!0===_(this,e,!0)?(this.default=b(e)?function(){return[].concat(e)}:s(e)?function(){return Object.assign({},e)}:e,this):(y(this._vueTypes_name+' - invalid default value: "'+e+'"'),this):this}}}),r=n.validator;return O(r)&&(n.validator=j(r,n)),n}function w(e,t){var n=T(e,t);return Object.defineProperty(n,"validate",{value:function(e){return O(this.validator)&&y(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=j(e,this),this}})}function k(e,t,n){var r,o,u=(r=t,o={},Object.getOwnPropertyNames(r).forEach(function(e){o[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},o));if(u._vueTypes_name=e,!s(n))return u;var a,f,c=n.validator,l=i(n,["validator"]);if(O(c)){var v=u.validator;v&&(v=null!==(f=(a=v).__original)&&void 0!==f?f:a),u.validator=j(v?function(e){return v.call(this,e)&&c.call(this,e)}:c,u)}return Object.assign(u,l)}function P(e){return e.replace(/^(?!\s*$)/gm," ")}var x=function(){return w("any",{})},A=function(){return w("function",{type:Function})},E=function(){return w("boolean",{type:Boolean})},N=function(){return w("string",{type:String})},q=function(){return w("number",{type:Number})},S=function(){return w("array",{type:Array})},V=function(){return w("object",{type:Object})},F=function(){return T("integer",{type:Number,validator:function(e){return h(e)}})},D=function(){return T("symbol",{validator:function(e){return"symbol"==typeof e}})};function L(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return T(e.name||"<<anonymous function>>",{validator:function(n){var r=e(n);return r||y(this._vueTypes_name+" - "+t),r}})}function Y(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'".',n=e.reduce(function(e,t){if(null!=t){var n=t.constructor;-1===e.indexOf(n)&&e.push(n)}return e},[]);return T("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||y(t),r}})}function B(e){if(!b(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,n=[],r=0;r<e.length;r+=1){var i=e[r];if(m(i)){if(g(i)&&"oneOf"===i._vueTypes_name){n=n.concat(i.type);continue}if(O(i.validator)&&(t=!0),!0!==i.type&&i.type){n=n.concat(i.type);continue}}n.push(i)}return n=n.filter(function(e,t){return n.indexOf(e)===t}),T("oneOfType",t?{type:n,validator:function(t){var n=[],r=e.some(function(e){var r=_(g(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||y("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+P(n.join("\n"))),r}}:{type:n})}function I(e){return T("arrayOf",{type:Array,validator:function(t){var n,r=t.every(function(t){return!0===(n=_(e,t,!0))});return r||y("arrayOf - value validation error:\n"+P(n)),r}})}function J(e){return T("instanceOf",{type:e})}function M(e){return T("objectOf",{type:Object,validator:function(t){var n,r=Object.keys(t).every(function(r){return!0===(n=_(e,t[r],!0))});return r||y("objectOf - value validation error:\n"+P(n)),r}})}function R(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.required)}),r=T("shape",{type:Object,validator:function(r){var i=this;if(!s(r))return!1;var o=Object.keys(r);if(n.length>0&&n.some(function(e){return-1===o.indexOf(e)})){var u=n.filter(function(e){return-1===o.indexOf(e)});return y(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return o.every(function(n){if(-1===t.indexOf(n))return!0===i._vueTypes_isLoose||(y('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=_(e[n],r[n],!0);return"string"==typeof o&&y('shape - "'+n+'" property validation error:\n '+P(o)),!0===o})}});return Object.defineProperty(r,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),r}var $=function(){function e(){}return e.extend=function(e){var t=this;if(b(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,o=void 0!==r&&r,u=e.getter,a=void 0!==u&&u,f=i(e,["name","validate","getter"]);if(d(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return g(l)?(delete f.type,Object.defineProperty(this,n,a?{get:function(){return k(n,l,f)}}:{value:function(){var e,t=k(n,l,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return o?w(n,e):T(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=o?w(n,r):T(n,r),r.validator&&(e.validator=(t=r.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,n,c))},t(e,null,[{key:"any",get:function(){return x()}},{key:"func",get:function(){return A().def(this.defaults.func)}},{key:"bool",get:function(){return E().def(this.defaults.bool)}},{key:"string",get:function(){return N().def(this.defaults.string)}},{key:"number",get:function(){return q().def(this.defaults.number)}},{key:"array",get:function(){return S().def(this.defaults.array)}},{key:"object",get:function(){return V().def(this.defaults.object)}},{key:"integer",get:function(){return F().def(this.defaults.integer)}},{key:"symbol",get:function(){return D()}}]),e}();function z(e){var i;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(i=function(i){function o(){return i.apply(this,arguments)||this}return r(o,i),t(o,null,[{key:"sensibleDefaults",get:function(){return n({},this.defaults)},set:function(t){this.defaults=!1!==t?n({},!0!==t?t:e):{}}}]),o}($)).defaults=n({},e),i}$.defaults={},$.custom=L,$.oneOf=Y,$.instanceOf=J,$.oneOfType=B,$.arrayOf=I,$.objectOf=M,$.shape=R,$.utils={validate:function(e,t){return!0===_(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?w(e,t):T(e,t)}};var C=function(e){function t(){return e.apply(this,arguments)||this}return r(t,e),t}(z());export default C;export{x as any,S as array,I as arrayOf,E as bool,z as createTypes,L as custom,k as fromType,A as func,J as instanceOf,F as integer,q as number,V as object,M as objectOf,Y as oneOf,B as oneOfType,R as shape,N as string,D as symbol,T as toType,w as toValidableType,_ as validateType};
//# sourceMappingURL=vue-types.m.js.map

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

function e(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}const t=Object.prototype,r=t.toString,n=t.hasOwnProperty,o=/^\s*function (\w+)/;function i(e){var t;const r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){const e=r.toString().match(o);return e?e[1]:""}return""}const a=function(t){var r,n;return!1!==e(t)&&"function"==typeof(r=t.constructor)&&!1!==e(n=r.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},s=e=>e;let u=s;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;u=e?function(e){console.warn("[VueTypes warn]: "+e)}:s}const c=(e,t)=>n.call(e,t),l=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},f=Array.isArray||function(e){return"[object Array]"===r.call(e)},d=e=>"[object Function]"===r.call(e),p=e=>a(e)&&c(e,"_vueTypes_name"),y=e=>a(e)&&(c(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>c(e,t)));function v(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function h(e,t,r=!1){let n,s=!0,l="";n=a(e)?e:{type:e};const v=p(n)?n._vueTypes_name+" - ":"";if(y(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return s;if(!n.required&&void 0===t)return s;f(n.type)?(s=n.type.some(e=>!0===h(e,t,!0)),l=n.type.map(e=>i(e)).join(" or ")):(l=i(n),s="Array"===l?f(t):"Object"===l?a(t):"String"===l||"Number"===l||"Boolean"===l||"Function"===l?function(e){if(null==e)return"";const t=e.constructor.toString().match(o);return t?t[1]:""}(t)===l:t instanceof n.type)}if(!s){const e=`${v}value "${t}" should be of type "${l}"`;return!1===r?(u(e),!1):e}if(c(n,"validator")&&d(n.validator)){const e=u,o=[];if(u=e=>{o.push(e)},s=n.validator(t),u=e,!s){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(u(e),s):e}}return s}function b(e,t){const r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(e){return void 0===e?(c(this,"default")&&delete this.default,this):d(e)||!0===h(this,e,!0)?(this.default=f(e)?()=>[...e]:a(e)?()=>Object.assign({},e):e,this):(u(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return d(n)&&(r.validator=v(n,r)),r}function g(e,t){const r=b(e,t);return Object.defineProperty(r,"validate",{value(e){return d(this.validator)&&u(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=v(e,this),this}})}function O(e,t,r){const n=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r)}),Object.defineProperties({},t)}(t);if(n._vueTypes_name=e,!a(r))return n;const{validator:o,...i}=r;if(d(o)){let{validator:e}=n;e&&(e=null!==(u=(s=e).__original)&&void 0!==u?u:s),n.validator=v(e?function(t){return e.call(this,t)&&o.call(this,t)}:o,n)}var s,u;return Object.assign(n,i)}function m(e){return e.replace(/^(?!\s*$)/gm," ")}const j=()=>g("any",{}),_=()=>g("function",{type:Function}),T=()=>g("boolean",{type:Boolean}),w=()=>g("string",{type:String}),$=()=>g("number",{type:Number}),P=()=>g("array",{type:Array}),x=()=>g("object",{type:Object}),A=()=>b("integer",{type:Number,validator:e=>l(e)}),E=()=>b("symbol",{validator:e=>"symbol"==typeof e});function N(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return b(e.name||"<<anonymous function>>",{validator(r){const n=e(r);return n||u(`${this._vueTypes_name} - ${t}`),n}})}function q(e){if(!f(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const t=`oneOf - value should be one of "${e.join('", "')}."`,r=e.reduce((e,t)=>{if(null!=t){const r=t.constructor;-1===e.indexOf(r)&&e.push(r)}return e},[]);return b("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||u(t),n}})}function S(e){if(!f(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let t=!1,r=[];for(let n=0;n<e.length;n+=1){const o=e[n];if(y(o)){if(p(o)&&"oneOf"===o._vueTypes_name){r=r.concat(o.type);continue}if(d(o.validator)&&(t=!0),!0!==o.type&&o.type){r=r.concat(o.type);continue}}r.push(o)}return r=r.filter((e,t)=>r.indexOf(e)===t),b("oneOfType",t?{type:r,validator(t){const r=[],n=e.some(e=>{const n=h(p(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||u(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${m(r.join("\n"))}`),n}}:{type:r})}function V(e){return b("arrayOf",{type:Array,validator(t){let r;const n=t.every(t=>(r=h(e,t,!0),!0===r));return n||u("arrayOf - value validation error:\n"+m(r)),n}})}function k(e){return b("instanceOf",{type:e})}function D(e){return b("objectOf",{type:Object,validator(t){let r;const n=Object.keys(t).every(n=>(r=h(e,t[n],!0),!0===r));return n||u("objectOf - value validation error:\n"+m(r)),n}})}function F(e){const t=Object.keys(e),r=t.filter(t=>{var r;return!!(null===(r=e[t])||void 0===r?void 0:r.required)}),n=b("shape",{type:Object,validator(n){if(!a(n))return!1;const o=Object.keys(n);if(r.length>0&&r.some(e=>-1===o.indexOf(e))){const e=r.filter(e=>-1===o.indexOf(e));return u(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return o.every(r=>{if(-1===t.indexOf(r))return!0===this._vueTypes_isLoose||(u(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const o=h(e[r],n[r],!0);return"string"==typeof o&&u(`shape - "${r}" property validation error:\n ${m(o)}`),!0===o})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}class L{static get any(){return j()}static get func(){return _().def(this.defaults.func)}static get bool(){return T().def(this.defaults.bool)}static get string(){return w().def(this.defaults.string)}static get number(){return $().def(this.defaults.number)}static get array(){return P().def(this.defaults.array)}static get object(){return x().def(this.defaults.object)}static get integer(){return A().def(this.defaults.integer)}static get symbol(){return E()}static extend(e){if(f(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:r=!1,getter:n=!1,...o}=e;if(c(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:i}=o;if(p(i))return delete o.type,Object.defineProperty(this,t,n?{get:()=>O(t,i,o)}:{value(...e){const r=O(t,i,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let a;return a=n?{get(){const e=Object.assign({},o);return r?g(t,e):b(t,e)},enumerable:!0}:{value(...e){const n=Object.assign({},o);let i;return i=r?g(t,n):b(t,n),n.validator&&(i.validator=n.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,a)}}function Y(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var t;return(t=class extends L{static get sensibleDefaults(){return{...this.defaults}}static set sensibleDefaults(t){this.defaults=!1!==t?!0!==t?{...t}:{...e}:{}}}).defaults={...e},t}L.defaults={},L.custom=N,L.oneOf=q,L.instanceOf=k,L.oneOfType=S,L.arrayOf=V,L.objectOf=D,L.shape=F,L.utils={validate:(e,t)=>!0===h(t,e,!0),toType:(e,t,r=!1)=>r?g(e,t):b(e,t)};class B extends(Y()){}export default B;export{j as any,P as array,V as arrayOf,T as bool,Y as createTypes,N as custom,O as fromType,_ as func,k as instanceOf,A as integer,$ as number,x as object,D as objectOf,q as oneOf,S as oneOfType,F as shape,w as string,E as symbol,b as toType,g as toValidableType,h as validateType};
function e(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}const t=Object.prototype,r=t.toString,n=t.hasOwnProperty,o=/^\s*function (\w+)/;function i(e){var t;const r=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(r){const e=r.toString().match(o);return e?e[1]:""}return""}const a=function(t){var r,n;return!1!==e(t)&&"function"==typeof(r=t.constructor)&&!1!==e(n=r.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},s=e=>e;let u=s;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;u=e?function(e){console.warn("[VueTypes warn]: "+e)}:s}const c=(e,t)=>n.call(e,t),l=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},f=Array.isArray||function(e){return"[object Array]"===r.call(e)},d=e=>"[object Function]"===r.call(e),p=e=>a(e)&&c(e,"_vueTypes_name"),y=e=>a(e)&&(c(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>c(e,t)));function v(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function h(e,t,r=!1){let n,s=!0,l="";n=a(e)?e:{type:e};const v=p(n)?n._vueTypes_name+" - ":"";if(y(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return s;if(!n.required&&void 0===t)return s;f(n.type)?(s=n.type.some(e=>!0===h(e,t,!0)),l=n.type.map(e=>i(e)).join(" or ")):(l=i(n),s="Array"===l?f(t):"Object"===l?a(t):"String"===l||"Number"===l||"Boolean"===l||"Function"===l?function(e){if(null==e)return"";const t=e.constructor.toString().match(o);return t?t[1]:""}(t)===l:t instanceof n.type)}if(!s){const e=`${v}value "${t}" should be of type "${l}"`;return!1===r?(u(e),!1):e}if(c(n,"validator")&&d(n.validator)){const e=u,o=[];if(u=e=>{o.push(e)},s=n.validator(t),u=e,!s){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(u(e),s):e}}return s}function b(e,t){const r=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get(){return this.required=!0,this}},def:{value(e){return void 0!==e||this.default?d(e)||!0===h(this,e,!0)?(this.default=f(e)?()=>[...e]:a(e)?()=>Object.assign({},e):e,this):(u(`${this._vueTypes_name} - invalid default value: "${e}"`),this):this}}}),{validator:n}=r;return d(n)&&(r.validator=v(n,r)),r}function g(e,t){const r=b(e,t);return Object.defineProperty(r,"validate",{value(e){return d(this.validator)&&u(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=v(e,this),this}})}function O(e,t,r){const n=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r)}),Object.defineProperties({},t)}(t);if(n._vueTypes_name=e,!a(r))return n;const{validator:o,...i}=r;if(d(o)){let{validator:e}=n;e&&(e=null!==(u=(s=e).__original)&&void 0!==u?u:s),n.validator=v(e?function(t){return e.call(this,t)&&o.call(this,t)}:o,n)}var s,u;return Object.assign(n,i)}function m(e){return e.replace(/^(?!\s*$)/gm," ")}const j=()=>g("any",{}),_=()=>g("function",{type:Function}),T=()=>g("boolean",{type:Boolean}),w=()=>g("string",{type:String}),$=()=>g("number",{type:Number}),P=()=>g("array",{type:Array}),x=()=>g("object",{type:Object}),A=()=>b("integer",{type:Number,validator:e=>l(e)}),E=()=>b("symbol",{validator:e=>"symbol"==typeof e});function N(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return b(e.name||"<<anonymous function>>",{validator(r){const n=e(r);return n||u(`${this._vueTypes_name} - ${t}`),n}})}function q(e){if(!f(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");const t=`oneOf - value should be one of "${e.join('", "')}".`,r=e.reduce((e,t)=>{if(null!=t){const r=t.constructor;-1===e.indexOf(r)&&e.push(r)}return e},[]);return b("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||u(t),n}})}function S(e){if(!f(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");let t=!1,r=[];for(let n=0;n<e.length;n+=1){const o=e[n];if(y(o)){if(p(o)&&"oneOf"===o._vueTypes_name){r=r.concat(o.type);continue}if(d(o.validator)&&(t=!0),!0!==o.type&&o.type){r=r.concat(o.type);continue}}r.push(o)}return r=r.filter((e,t)=>r.indexOf(e)===t),b("oneOfType",t?{type:r,validator(t){const r=[],n=e.some(e=>{const n=h(p(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||u(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${m(r.join("\n"))}`),n}}:{type:r})}function V(e){return b("arrayOf",{type:Array,validator(t){let r;const n=t.every(t=>(r=h(e,t,!0),!0===r));return n||u("arrayOf - value validation error:\n"+m(r)),n}})}function k(e){return b("instanceOf",{type:e})}function D(e){return b("objectOf",{type:Object,validator(t){let r;const n=Object.keys(t).every(n=>(r=h(e,t[n],!0),!0===r));return n||u("objectOf - value validation error:\n"+m(r)),n}})}function F(e){const t=Object.keys(e),r=t.filter(t=>{var r;return!!(null===(r=e[t])||void 0===r?void 0:r.required)}),n=b("shape",{type:Object,validator(n){if(!a(n))return!1;const o=Object.keys(n);if(r.length>0&&r.some(e=>-1===o.indexOf(e))){const e=r.filter(e=>-1===o.indexOf(e));return u(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return o.every(r=>{if(-1===t.indexOf(r))return!0===this._vueTypes_isLoose||(u(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const o=h(e[r],n[r],!0);return"string"==typeof o&&u(`shape - "${r}" property validation error:\n ${m(o)}`),!0===o})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}class L{static get any(){return j()}static get func(){return _().def(this.defaults.func)}static get bool(){return T().def(this.defaults.bool)}static get string(){return w().def(this.defaults.string)}static get number(){return $().def(this.defaults.number)}static get array(){return P().def(this.defaults.array)}static get object(){return x().def(this.defaults.object)}static get integer(){return A().def(this.defaults.integer)}static get symbol(){return E()}static extend(e){if(f(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:r=!1,getter:n=!1,...o}=e;if(c(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:i}=o;if(p(i))return delete o.type,Object.defineProperty(this,t,n?{get:()=>O(t,i,o)}:{value(...e){const r=O(t,i,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let a;return a=n?{get(){const e=Object.assign({},o);return r?g(t,e):b(t,e)},enumerable:!0}:{value(...e){const n=Object.assign({},o);let i;return i=r?g(t,n):b(t,n),n.validator&&(i.validator=n.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,a)}}function Y(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var t;return(t=class extends L{static get sensibleDefaults(){return{...this.defaults}}static set sensibleDefaults(t){this.defaults=!1!==t?!0!==t?{...t}:{...e}:{}}}).defaults={...e},t}L.defaults={},L.custom=N,L.oneOf=q,L.instanceOf=k,L.oneOfType=S,L.arrayOf=V,L.objectOf=D,L.shape=F,L.utils={validate:(e,t)=>!0===h(t,e,!0),toType:(e,t,r=!1)=>r?g(e,t):b(e,t)};class B extends(Y()){}export default B;export{j as any,P as array,V as arrayOf,T as bool,Y as createTypes,N as custom,O as fromType,_ as func,k as instanceOf,A as integer,$ as number,x as object,D as objectOf,q as oneOf,S as oneOfType,F as shape,w as string,E as symbol,b as toType,g as toValidableType,h as validateType};
//# sourceMappingURL=vue-types.modern.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).VueTypes={})}(this,function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function o(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function u(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var a=Object.prototype,f=a.toString,c=a.hasOwnProperty,l=/^\s*function (\w+)/;function s(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(l);return r?r[1]:""}return""}var y=function(e){var t,n;return!1!==u(e)&&"function"==typeof(t=e.constructor)&&!1!==u(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},p=function(e){return e},d=function(e,t){return c.call(e,t)},v=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},h=Array.isArray||function(e){return"[object Array]"===f.call(e)},b=function(e){return"[object Function]"===f.call(e)},O=function(e){return y(e)&&d(e,"_vueTypes_name")},g=function(e){return y(e)&&(d(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return d(e,t)}))};function m(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function j(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=y(e)?e:{type:e};var u=O(r)?r._vueTypes_name+" - ":"";if(g(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;h(r.type)?(i=r.type.some(function(e){return!0===j(e,t,!0)}),o=r.type.map(function(e){return s(e)}).join(" or ")):i="Array"===(o=s(r))?h(t):"Object"===o?y(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(l);return t?t[1]:""}(t)===o:t instanceof r.type}if(!i){var a=u+'value "'+t+'" should be of type "'+o+'"';return!1===n?(p(a),!1):a}if(d(r,"validator")&&b(r.validator)){var f=p,c=[];if(p=function(e){c.push(e)},i=r.validator(t),p=f,!i){var v=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===n?(p(v),i):v}}return i}function _(e,t){var n=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0===e?(d(this,"default")&&delete this.default,this):b(e)||!0===j(this,e,!0)?(this.default=h(e)?function(){return[].concat(e)}:y(e)?function(){return Object.assign({},e)}:e,this):(p(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),r=n.validator;return b(r)&&(n.validator=m(r,n)),n}function T(e,t){var n=_(e,t);return Object.defineProperty(n,"validate",{value:function(e){return b(this.validator)&&p(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=m(e,this),this}})}function w(e,t,n){var r,i,u=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(u._vueTypes_name=e,!y(n))return u;var a,f,c=n.validator,l=o(n,["validator"]);if(b(c)){var s=u.validator;s&&(s=null!==(f=(a=s).__original)&&void 0!==f?f:a),u.validator=m(s?function(e){return s.call(this,e)&&c.call(this,e)}:c,u)}return Object.assign(u,l)}function k(e){return e.replace(/^(?!\s*$)/gm," ")}var P=function(){return T("any",{})},x=function(){return T("function",{type:Function})},A=function(){return T("boolean",{type:Boolean})},q=function(){return T("string",{type:String})},S=function(){return T("number",{type:Number})},V=function(){return T("array",{type:Array})},E=function(){return T("object",{type:Object})},N=function(){return _("integer",{type:Number,validator:function(e){return v(e)}})},F=function(){return _("symbol",{validator:function(e){return"symbol"==typeof e}})};function L(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return _(e.name||"<<anonymous function>>",{validator:function(n){var r=e(n);return r||p(this._vueTypes_name+" - "+t),r}})}function Y(e){if(!h(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'."',n=e.reduce(function(e,t){if(null!=t){var n=t.constructor;-1===e.indexOf(n)&&e.push(n)}return e},[]);return _("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||p(t),r}})}function B(e){if(!h(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,n=[],r=0;r<e.length;r+=1){var i=e[r];if(g(i)){if(O(i)&&"oneOf"===i._vueTypes_name){n=n.concat(i.type);continue}if(b(i.validator)&&(t=!0),!0!==i.type&&i.type){n=n.concat(i.type);continue}}n.push(i)}return n=n.filter(function(e,t){return n.indexOf(e)===t}),_("oneOfType",t?{type:n,validator:function(t){var n=[],r=e.some(function(e){var r=j(O(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||p("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+k(n.join("\n"))),r}}:{type:n})}function D(e){return _("arrayOf",{type:Array,validator:function(t){var n,r=t.every(function(t){return!0===(n=j(e,t,!0))});return r||p("arrayOf - value validation error:\n"+k(n)),r}})}function I(e){return _("instanceOf",{type:e})}function J(e){return _("objectOf",{type:Object,validator:function(t){var n,r=Object.keys(t).every(function(r){return!0===(n=j(e,t[r],!0))});return r||p("objectOf - value validation error:\n"+k(n)),r}})}function M(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.required)}),r=_("shape",{type:Object,validator:function(r){var i=this;if(!y(r))return!1;var o=Object.keys(r);if(n.length>0&&n.some(function(e){return-1===o.indexOf(e)})){var u=n.filter(function(e){return-1===o.indexOf(e)});return p(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return o.every(function(n){if(-1===t.indexOf(n))return!0===i._vueTypes_isLoose||(p('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=j(e[n],r[n],!0);return"string"==typeof o&&p('shape - "'+n+'" property validation error:\n '+k(o)),!0===o})}});return Object.defineProperty(r,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),r}var R=function(){function e(){}return e.extend=function(e){var t=this;if(h(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,u=e.getter,a=void 0!==u&&u,f=o(e,["name","validate","getter"]);if(d(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return O(l)?(delete f.type,Object.defineProperty(this,n,a?{get:function(){return w(n,l,f)}}:{value:function(){var e,t=w(n,l,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return i?T(n,e):_(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=i?T(n,r):_(n,r),r.validator&&(e.validator=(t=r.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,n,c))},n(e,null,[{key:"any",get:function(){return P()}},{key:"func",get:function(){return x().def(this.defaults.func)}},{key:"bool",get:function(){return A().def(this.defaults.bool)}},{key:"string",get:function(){return q().def(this.defaults.string)}},{key:"number",get:function(){return S().def(this.defaults.number)}},{key:"array",get:function(){return V().def(this.defaults.array)}},{key:"object",get:function(){return E().def(this.defaults.object)}},{key:"integer",get:function(){return N().def(this.defaults.integer)}},{key:"symbol",get:function(){return F()}}]),e}();function $(e){var t;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(t=function(t){function o(){return t.apply(this,arguments)||this}return i(o,t),n(o,null,[{key:"sensibleDefaults",get:function(){return r({},this.defaults)},set:function(t){this.defaults=!1!==t?r({},!0!==t?t:e):{}}}]),o}(R)).defaults=r({},e),t}R.defaults={},R.custom=L,R.oneOf=Y,R.instanceOf=I,R.oneOfType=B,R.arrayOf=D,R.objectOf=J,R.shape=M,R.utils={validate:function(e,t){return!0===j(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?T(e,t):_(e,t)}};var z=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}($());e.any=P,e.array=V,e.arrayOf=D,e.bool=A,e.createTypes=$,e.custom=L,e.default=z,e.fromType=w,e.func=x,e.instanceOf=I,e.integer=N,e.number=S,e.object=E,e.objectOf=J,e.oneOf=Y,e.oneOfType=B,e.shape=M,e.string=q,e.symbol=F,e.toType=_,e.toValidableType=T,e.validateType=j});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).VueTypes={})}(this,function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function r(){return(r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}function o(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(i[n]=e[n]);return i}function u(e){return 1==(null!=(t=e)&&"object"==typeof t&&!1===Array.isArray(t))&&"[object Object]"===Object.prototype.toString.call(e);var t}var a=Object.prototype,f=a.toString,c=a.hasOwnProperty,l=/^\s*function (\w+)/;function s(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(l);return r?r[1]:""}return""}var y=function(e){var t,n;return!1!==u(e)&&"function"==typeof(t=e.constructor)&&!1!==u(n=t.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf")},p=function(e){return e},v=function(e,t){return c.call(e,t)},d=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},h=Array.isArray||function(e){return"[object Array]"===f.call(e)},b=function(e){return"[object Function]"===f.call(e)},O=function(e){return y(e)&&v(e,"_vueTypes_name")},g=function(e){return y(e)&&(v(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return v(e,t)}))};function m(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function j(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=y(e)?e:{type:e};var u=O(r)?r._vueTypes_name+" - ":"";if(g(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;h(r.type)?(i=r.type.some(function(e){return!0===j(e,t,!0)}),o=r.type.map(function(e){return s(e)}).join(" or ")):i="Array"===(o=s(r))?h(t):"Object"===o?y(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(l);return t?t[1]:""}(t)===o:t instanceof r.type}if(!i){var a=u+'value "'+t+'" should be of type "'+o+'"';return!1===n?(p(a),!1):a}if(v(r,"validator")&&b(r.validator)){var f=p,c=[];if(p=function(e){c.push(e)},i=r.validator(t),p=f,!i){var d=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===n?(p(d),i):d}}return i}function _(e,t){var n=Object.defineProperties(t,{_vueTypes_name:{value:e,writable:!0},isRequired:{get:function(){return this.required=!0,this}},def:{value:function(e){return void 0!==e||this.default?b(e)||!0===j(this,e,!0)?(this.default=h(e)?function(){return[].concat(e)}:y(e)?function(){return Object.assign({},e)}:e,this):(p(this._vueTypes_name+' - invalid default value: "'+e+'"'),this):this}}}),r=n.validator;return b(r)&&(n.validator=m(r,n)),n}function T(e,t){var n=_(e,t);return Object.defineProperty(n,"validate",{value:function(e){return b(this.validator)&&p(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=m(e,this),this}})}function w(e,t,n){var r,i,u=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(u._vueTypes_name=e,!y(n))return u;var a,f,c=n.validator,l=o(n,["validator"]);if(b(c)){var s=u.validator;s&&(s=null!==(f=(a=s).__original)&&void 0!==f?f:a),u.validator=m(s?function(e){return s.call(this,e)&&c.call(this,e)}:c,u)}return Object.assign(u,l)}function k(e){return e.replace(/^(?!\s*$)/gm," ")}var P=function(){return T("any",{})},x=function(){return T("function",{type:Function})},A=function(){return T("boolean",{type:Boolean})},q=function(){return T("string",{type:String})},S=function(){return T("number",{type:Number})},V=function(){return T("array",{type:Array})},E=function(){return T("object",{type:Object})},N=function(){return _("integer",{type:Number,validator:function(e){return d(e)}})},F=function(){return _("symbol",{validator:function(e){return"symbol"==typeof e}})};function L(e,t){if(void 0===t&&(t="custom validation failed"),"function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return _(e.name||"<<anonymous function>>",{validator:function(n){var r=e(n);return r||p(this._vueTypes_name+" - "+t),r}})}function Y(e){if(!h(e))throw new TypeError("[VueTypes error]: You must provide an array as argument.");var t='oneOf - value should be one of "'+e.join('", "')+'".',n=e.reduce(function(e,t){if(null!=t){var n=t.constructor;-1===e.indexOf(n)&&e.push(n)}return e},[]);return _("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||p(t),r}})}function B(e){if(!h(e))throw new TypeError("[VueTypes error]: You must provide an array as argument");for(var t=!1,n=[],r=0;r<e.length;r+=1){var i=e[r];if(g(i)){if(O(i)&&"oneOf"===i._vueTypes_name){n=n.concat(i.type);continue}if(b(i.validator)&&(t=!0),!0!==i.type&&i.type){n=n.concat(i.type);continue}}n.push(i)}return n=n.filter(function(e,t){return n.indexOf(e)===t}),_("oneOfType",t?{type:n,validator:function(t){var n=[],r=e.some(function(e){var r=j(O(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||p("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+k(n.join("\n"))),r}}:{type:n})}function D(e){return _("arrayOf",{type:Array,validator:function(t){var n,r=t.every(function(t){return!0===(n=j(e,t,!0))});return r||p("arrayOf - value validation error:\n"+k(n)),r}})}function I(e){return _("instanceOf",{type:e})}function J(e){return _("objectOf",{type:Object,validator:function(t){var n,r=Object.keys(t).every(function(r){return!0===(n=j(e,t[r],!0))});return r||p("objectOf - value validation error:\n"+k(n)),r}})}function M(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!!(null===(n=e[t])||void 0===n?void 0:n.required)}),r=_("shape",{type:Object,validator:function(r){var i=this;if(!y(r))return!1;var o=Object.keys(r);if(n.length>0&&n.some(function(e){return-1===o.indexOf(e)})){var u=n.filter(function(e){return-1===o.indexOf(e)});return p(1===u.length?'shape - required property "'+u[0]+'" is not defined.':'shape - required properties "'+u.join('", "')+'" are not defined.'),!1}return o.every(function(n){if(-1===t.indexOf(n))return!0===i._vueTypes_isLoose||(p('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=j(e[n],r[n],!0);return"string"==typeof o&&p('shape - "'+n+'" property validation error:\n '+k(o)),!0===o})}});return Object.defineProperty(r,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(r,"loose",{get:function(){return this._vueTypes_isLoose=!0,this}}),r}var R=function(){function e(){}return e.extend=function(e){var t=this;if(h(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,u=e.getter,a=void 0!==u&&u,f=o(e,["name","validate","getter"]);if(v(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return O(l)?(delete f.type,Object.defineProperty(this,n,a?{get:function(){return w(n,l,f)}}:{value:function(){var e,t=w(n,l,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=a?{get:function(){var e=Object.assign({},f);return i?T(n,e):_(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=i?T(n,r):_(n,r),r.validator&&(e.validator=(t=r.validator).bind.apply(t,[e].concat([].slice.call(arguments)))),e},enumerable:!0},Object.defineProperty(this,n,c))},n(e,null,[{key:"any",get:function(){return P()}},{key:"func",get:function(){return x().def(this.defaults.func)}},{key:"bool",get:function(){return A().def(this.defaults.bool)}},{key:"string",get:function(){return q().def(this.defaults.string)}},{key:"number",get:function(){return S().def(this.defaults.number)}},{key:"array",get:function(){return V().def(this.defaults.array)}},{key:"object",get:function(){return E().def(this.defaults.object)}},{key:"integer",get:function(){return N().def(this.defaults.integer)}},{key:"symbol",get:function(){return F()}}]),e}();function $(e){var t;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(t=function(t){function o(){return t.apply(this,arguments)||this}return i(o,t),n(o,null,[{key:"sensibleDefaults",get:function(){return r({},this.defaults)},set:function(t){this.defaults=!1!==t?r({},!0!==t?t:e):{}}}]),o}(R)).defaults=r({},e),t}R.defaults={},R.custom=L,R.oneOf=Y,R.instanceOf=I,R.oneOfType=B,R.arrayOf=D,R.objectOf=J,R.shape=M,R.utils={validate:function(e,t){return!0===j(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?T(e,t):_(e,t)}};var z=function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}($());e.any=P,e.array=V,e.arrayOf=D,e.bool=A,e.createTypes=$,e.custom=L,e.default=z,e.fromType=w,e.func=x,e.instanceOf=I,e.integer=N,e.number=S,e.object=E,e.objectOf=J,e.oneOf=Y,e.oneOfType=B,e.shape=M,e.string=q,e.symbol=F,e.toType=_,e.toValidableType=T,e.validateType=j});
//# sourceMappingURL=vue-types.umd.js.map
{
"name": "vue-types",
"version": "3.0.1",
"version": "3.0.2",
"description": "Prop types utility for Vue",

@@ -5,0 +5,0 @@ "author": "Marco Solazzi",

@@ -273,6 +273,3 @@ import _isPlainObject from 'is-plain-object'

value(def?: any) {
if (def === undefined) {
if (has(this, 'default')) {
delete this.default
}
if (def === undefined && !this.default) {
return this

@@ -279,0 +276,0 @@ }

@@ -10,3 +10,3 @@ import { Prop } from '../types'

}
const msg = `oneOf - value should be one of "${arr.join('", "')}."`
const msg = `oneOf - value should be one of "${arr.join('", "')}".`
const allowedTypes = arr.reduce((ret, v) => {

@@ -13,0 +13,0 @@ if (v !== null && v !== undefined) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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