Comparing version 4.1.1 to 4.2.0-rc.1
import { toType, toValidableType, validateType, fromType } from './utils'; | ||
import { VueTypesDefaults, ExtendProps, VueTypeDef, VueTypeValidableDef, VueTypeShape, VueTypeLooseShape } from './types'; | ||
import { PropOptions } from './types'; | ||
import { any, func, bool, string, number, array, integer, symbol, object } from './validators/native'; | ||
import { any, func, bool, string, number, array, integer, symbol, object, nullable } from './validators/native'; | ||
import custom from './validators/custom'; | ||
@@ -45,2 +45,5 @@ import oneOf from './validators/oneof'; | ||
readonly symbol: VueTypeDef<symbol>; | ||
readonly nullable: { | ||
type: import("./types").PropType<null>; | ||
}; | ||
readonly custom: typeof custom; | ||
@@ -85,2 +88,5 @@ readonly oneOf: typeof oneOf; | ||
readonly symbol: VueTypeDef<symbol>; | ||
readonly nullable: { | ||
type: import("./types").PropType<null>; | ||
}; | ||
readonly custom: typeof custom; | ||
@@ -136,2 +142,5 @@ readonly oneOf: typeof oneOf; | ||
readonly symbol: VueTypeDef<symbol>; | ||
readonly nullable: { | ||
type: import("./types").PropType<null>; | ||
}; | ||
readonly custom: typeof custom; | ||
@@ -176,2 +185,5 @@ readonly oneOf: typeof oneOf; | ||
readonly symbol: VueTypeDef<symbol>; | ||
readonly nullable: { | ||
type: import("./types").PropType<null>; | ||
}; | ||
readonly custom: typeof custom; | ||
@@ -197,4 +209,4 @@ readonly oneOf: typeof oneOf; | ||
} | ||
export { any, func, bool, string, number, array, integer, symbol, object, custom, oneOf, oneOfType, arrayOf, instanceOf, objectOf, shape, createTypes, toType, toValidableType, validateType, fromType, config, }; | ||
export { any, func, bool, string, number, array, integer, symbol, object, custom, oneOf, oneOfType, arrayOf, instanceOf, objectOf, shape, nullable, createTypes, toType, toValidableType, validateType, fromType, config, }; | ||
export declare type VueTypesInterface = ReturnType<typeof createTypes>; | ||
export type { VueTypeDef, VueTypeValidableDef, VueTypeShape, VueTypeLooseShape }; |
@@ -22,2 +22,3 @@ import { config } from './config'; | ||
export declare const shape: TypeShim; | ||
export declare const nullable: TypeShim; | ||
export declare function fromType(name: string, source: any, props?: any): any; | ||
@@ -40,2 +41,3 @@ export declare const toValidableType: <T>(name: string, props: any) => any; | ||
readonly integer: any; | ||
readonly nullable: any; | ||
oneOf: TypeShim; | ||
@@ -68,2 +70,3 @@ custom: TypeShim; | ||
readonly integer: any; | ||
readonly nullable: any; | ||
oneOf: TypeShim; | ||
@@ -70,0 +73,0 @@ custom: TypeShim; |
@@ -1,2 +0,2 @@ | ||
import{isPlainObject as t}from"is-plain-object";function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}var i={silent:!1,logLevel:"warn"},o=Object.defineProperty,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function c(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:e,writable:!0},def:{value:function(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=f(e)?function(){return[].concat(e)}:t(e)?function(){return Object.assign({},e)}:e,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var a=function(){return c("any",{},!0)},s=function(){return c("func",{type:Function},!0)},l=function(){return c("bool",{type:Boolean},!0)},d=function(){return c("string",{type:String},!0)},y=function(){return c("number",{type:Number},!0)},p=function(){return c("array",{type:Array},!0)},b=function(){return c("object",{type:Object},!0)},v=function(){return c("symbol")},g=function(){return c("integer",{type:Number})},h=function(t){return c("oneOf")},O=function(t){return c("custom")},j=function(t){return c("instanceOf",{type:t})},m=function(t){return c("oneOfType")},k=function(t){return c("arrayOf",{type:Array})},_=function(t){return c("objectOf",{type:Object})},w=function(t){return o(c("shape",{type:Object}),"loose",{get:function(){return this}})};function T(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var f=((i={})[r?"get":"value"]=function(){return c(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return o(t,e,f)}function A(t,e,n){void 0===n&&(n={});var r=c(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r}var N=function(t,e){return c(t,e,!0)},P=function(t,e){return c(t,e)},x=/*#__PURE__*/function(){var e,r;return r=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var n=this;if(f(e))return e.forEach(function(t){return n.extend(t)}),this;var r=e.validate,u=e.getter,i=void 0!==u&&u,o=e.type,c=void 0===o?null:o;return T(this,e.name,{type:t(c)&&c.type?null:c},i,!!r)},n(e,null,[{key:"any",get:function(){return a()}},{key:"func",get:function(){return s().def(this.defaults.func)}},{key:"bool",get:function(){return l().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return y().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return b().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return g().def(this.defaults.integer)}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=i,e.oneOf=h,e.custom=O,e.instanceOf=j,e.oneOfType=m,e.arrayOf=k,e.objectOf=_,e.shape=w,e.utils={toType:c,validate:function(){return!![].slice.call(arguments)}},r}();function D(t){var e,u;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),u=e=/*#__PURE__*/function(e){function u(){return e.apply(this,arguments)||this}return r(u,e),n(u,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),u}(x),e.defaults=Object.assign({},t),u}"production"!==process.env.NODE_ENV&&!1===i.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");var E=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(/*#__PURE__*/ /*#__PURE__*/D());export{a as any,p as array,k as arrayOf,l as bool,i as config,D as createTypes,O as custom,E as default,A as fromType,s as func,j as instanceOf,g as integer,y as number,b as object,_ as objectOf,h as oneOf,m as oneOfType,w as shape,d as string,v as symbol,P as toType,N as toValidableType}; | ||
import{isPlainObject as t}from"is-plain-object";function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}var i={silent:!1,logLevel:"warn"},o=Object.defineProperty,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function c(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:e,writable:!0},def:{value:function(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=f(e)?function(){return[].concat(e)}:t(e)?function(){return Object.assign({},e)}:e,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var a=function(){return c("any",{},!0)},s=function(){return c("func",{type:Function},!0)},l=function(){return c("bool",{type:Boolean},!0)},d=function(){return c("string",{type:String},!0)},y=function(){return c("number",{type:Number},!0)},p=function(){return c("array",{type:Array},!0)},b=function(){return c("object",{type:Object},!0)},v=function(){return c("symbol")},g=function(){return c("integer",{type:Number})},h=function(t){return c("oneOf")},O=function(t){return c("custom")},j=function(t){return c("instanceOf",{type:t})},m=function(t){return c("oneOfType")},k=function(t){return c("arrayOf",{type:Array})},_=function(t){return c("objectOf",{type:Object})},w=function(t){return o(c("shape",{type:Object}),"loose",{get:function(){return this}})},T=function(){return{type:null}};function A(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var f=((i={})[r?"get":"value"]=function(){return c(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return o(t,e,f)}function N(t,e,n){void 0===n&&(n={});var r=c(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r}var P=function(t,e){return c(t,e,!0)},x=function(t,e){return c(t,e)},D=/*#__PURE__*/function(){var e,r;return r=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var n=this;if(f(e))return e.forEach(function(t){return n.extend(t)}),this;var r=e.validate,u=e.getter,i=void 0!==u&&u,o=e.type,c=void 0===o?null:o;return A(this,e.name,{type:t(c)&&c.type?null:c},i,!!r)},n(e,null,[{key:"any",get:function(){return a()}},{key:"func",get:function(){return s().def(this.defaults.func)}},{key:"bool",get:function(){return l().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return y().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return b().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return g().def(this.defaults.integer)}},{key:"nullable",get:function(){return{type:null}}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=i,e.oneOf=h,e.custom=O,e.instanceOf=j,e.oneOfType=m,e.arrayOf=k,e.objectOf=_,e.shape=w,e.utils={toType:c,validate:function(){return!![].slice.call(arguments)}},r}();function E(t){var e,u;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),u=e=/*#__PURE__*/function(e){function u(){return e.apply(this,arguments)||this}return r(u,e),n(u,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),u}(D),e.defaults=Object.assign({},t),u}"production"!==process.env.NODE_ENV&&!1===i.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");var V=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(E());export{a as any,p as array,k as arrayOf,l as bool,i as config,E as createTypes,O as custom,V as default,N as fromType,s as func,j as instanceOf,g as integer,T as nullable,y as number,b as object,_ as objectOf,h as oneOf,m as oneOfType,w as shape,d as string,v as symbol,x as toType,P as toValidableType}; | ||
//# sourceMappingURL=shim.m.js.map |
@@ -1,2 +0,2 @@ | ||
import{isPlainObject as t}from"is-plain-object";const e={silent:!1,logLevel:"warn"},s=Object.defineProperty,r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function n(e,s={},n=!1){const i={_vueTypes_name:{value:e,writable:!0},def:{value(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=r(e)?()=>[].concat(e):t(e)?()=>Object.assign({},e):e,this)}},isRequired:{get(){return this.required=!0,this}}};return n&&(i.validate={value(){}}),s.validator||(s.validator=()=>!0),Object.defineProperties(s,i)}const i=()=>n("any",{},!0),a=()=>n("func",{type:Function},!0),u=()=>n("bool",{type:Boolean},!0),o=()=>n("string",{type:String},!0),l=()=>n("number",{type:Number},!0),c=()=>n("array",{type:Array},!0),f=()=>n("object",{type:Object},!0),d=()=>n("symbol"),b=()=>n("integer",{type:Number}),g=t=>n("oneOf"),y=t=>n("custom"),p=t=>n("instanceOf",{type:t}),h=t=>n("oneOfType"),v=t=>n("arrayOf",{type:Array}),O=t=>n("objectOf",{type:Object}),j=t=>s(n("shape",{type:Object}),"loose",{get(){return this}});function m(t,e,r,i=!1,a=!1){return s(t,e,{[i?"get":"value"]:()=>n(e,Object.assign({},r),a).def(i?t.defaults[e]:void 0)})}function T(t,e,s={}){const r=n(t,Object.assign({},e,s),!!e.validable);return r.validator&&delete r.validator,r}const w=(t,e)=>n(t,e,!0),x=(t,e)=>n(t,e),A=/*#__PURE__*/(()=>{var s,T;return T=s=class{static get any(){return i()}static get func(){return a().def(this.defaults.func)}static get bool(){return u().def(this.defaults.bool)}static get string(){return o().def(this.defaults.string)}static get number(){return l().def(this.defaults.number)}static get array(){return c().def(this.defaults.array)}static get object(){return f().def(this.defaults.object)}static get symbol(){return d()}static get integer(){return b().def(this.defaults.integer)}static extend(e){if(r(e))return e.forEach(t=>this.extend(t)),this;const{name:s,validate:n,getter:i=!1,type:a=null}=e;return m(this,s,{type:t(a)&&a.type?null:a},i,!!n)}},s.defaults={},s.sensibleDefaults=void 0,s.config=e,s.oneOf=g,s.custom=y,s.instanceOf=p,s.oneOfType=h,s.arrayOf=v,s.objectOf=O,s.shape=j,s.utils={toType:n,validate:(...t)=>!!t},T})();function D(t={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var e,s;return s=e=class extends A{static get sensibleDefaults(){return Object.assign({},this.defaults)}static set sensibleDefaults(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}},e.defaults=Object.assign({},t),s}"production"!==process.env.NODE_ENV&&!1===e.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");class N extends(D()){}export{i as any,c as array,v as arrayOf,u as bool,e as config,D as createTypes,y as custom,N as default,T as fromType,a as func,p as instanceOf,b as integer,l as number,f as object,O as objectOf,g as oneOf,h as oneOfType,j as shape,o as string,d as symbol,x as toType,w as toValidableType}; | ||
import{isPlainObject as t}from"is-plain-object";const e={silent:!1,logLevel:"warn"},n=Object.defineProperty,s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(e,n={},r=!1){const i={_vueTypes_name:{value:e,writable:!0},def:{value(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=s(e)?()=>[].concat(e):t(e)?()=>Object.assign({},e):e,this)}},isRequired:{get(){return this.required=!0,this}}};return r&&(i.validate={value(){}}),n.validator||(n.validator=()=>!0),Object.defineProperties(n,i)}const i=()=>r("any",{},!0),a=()=>r("func",{type:Function},!0),u=()=>r("bool",{type:Boolean},!0),o=()=>r("string",{type:String},!0),l=()=>r("number",{type:Number},!0),c=()=>r("array",{type:Array},!0),f=()=>r("object",{type:Object},!0),d=()=>r("symbol"),b=()=>r("integer",{type:Number}),y=t=>r("oneOf"),g=t=>r("custom"),p=t=>r("instanceOf",{type:t}),h=t=>r("oneOfType"),v=t=>r("arrayOf",{type:Array}),O=t=>r("objectOf",{type:Object}),j=t=>n(r("shape",{type:Object}),"loose",{get(){return this}}),m=()=>({type:null});function T(t,e,s,i=!1,a=!1){return n(t,e,{[i?"get":"value"]:()=>r(e,Object.assign({},s),a).def(i?t.defaults[e]:void 0)})}function w(t,e,n={}){const s=r(t,Object.assign({},e,n),!!e.validable);return s.validator&&delete s.validator,s}const x=(t,e)=>r(t,e,!0),A=(t,e)=>r(t,e),D=/*#__PURE__*/(()=>{var n,m;return m=n=class{static get any(){return i()}static get func(){return a().def(this.defaults.func)}static get bool(){return u().def(this.defaults.bool)}static get string(){return o().def(this.defaults.string)}static get number(){return l().def(this.defaults.number)}static get array(){return c().def(this.defaults.array)}static get object(){return f().def(this.defaults.object)}static get symbol(){return d()}static get integer(){return b().def(this.defaults.integer)}static get nullable(){return{type:null}}static extend(e){if(s(e))return e.forEach(t=>this.extend(t)),this;const{name:n,validate:r,getter:i=!1,type:a=null}=e;return T(this,n,{type:t(a)&&a.type?null:a},i,!!r)}},n.defaults={},n.sensibleDefaults=void 0,n.config=e,n.oneOf=y,n.custom=g,n.instanceOf=p,n.oneOfType=h,n.arrayOf=v,n.objectOf=O,n.shape=j,n.utils={toType:r,validate:(...t)=>!!t},m})();function N(t={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var e,n;return n=e=class extends D{static get sensibleDefaults(){return Object.assign({},this.defaults)}static set sensibleDefaults(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}},e.defaults=Object.assign({},t),n}"production"!==process.env.NODE_ENV&&!1===e.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");class E extends(N()){}export{i as any,c as array,v as arrayOf,u as bool,e as config,N as createTypes,g as custom,E as default,w as fromType,a as func,p as instanceOf,b as integer,m as nullable,l as number,f as object,O as objectOf,y as oneOf,h as oneOfType,j as shape,o as string,d as symbol,A as toType,x as toValidableType}; | ||
//# sourceMappingURL=shim.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("is-plain-object")):"function"==typeof define&&define.amd?define(["exports","is-plain-object"],e):e((t||self).VueTypes={},t.isPlainObject)}(this,function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}function u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}var o={silent:!1,logLevel:"warn"},f=Object.defineProperty,c=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function a(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:t,writable:!0},def:{value:function(t){return void 0===t?("default"in this&&delete this.default,this):(this.default=c(t)?function(){return[].concat(t)}:e.isPlainObject(t)?function(){return Object.assign({},t)}:t,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var s=function(){return a("any",{},!0)},l=function(){return a("func",{type:Function},!0)},y=function(){return a("bool",{type:Boolean},!0)},d=function(){return a("string",{type:String},!0)},b=function(){return a("number",{type:Number},!0)},p=function(){return a("array",{type:Array},!0)},v=function(){return a("object",{type:Object},!0)},g=function(){return a("symbol")},O=function(){return a("integer",{type:Number})},h=function(t){return a("oneOf")},j=function(t){return a("custom")},m=function(t){return a("instanceOf",{type:t})},T=function(t){return a("oneOfType")},k=function(t){return a("arrayOf",{type:Array})},P=function(t){return a("objectOf",{type:Object})},_=function(t){return f(a("shape",{type:Object}),"loose",{get:function(){return this}})};function x(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var o=((i={})[r?"get":"value"]=function(){return a(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return f(t,e,o)}var A=/*#__PURE__*/function(){var t,n;return n=t=/*#__PURE__*/function(){function t(){}return t.extend=function(t){var n=this;if(c(t))return t.forEach(function(t){return n.extend(t)}),this;var r=t.validate,u=t.getter,i=void 0!==u&&u,o=t.type,f=void 0===o?null:o;return x(this,t.name,{type:e.isPlainObject(f)&&f.type?null:f},i,!!r)},r(t,null,[{key:"any",get:function(){return s()}},{key:"func",get:function(){return l().def(this.defaults.func)}},{key:"bool",get:function(){return y().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return b().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return v().def(this.defaults.object)}},{key:"symbol",get:function(){return g()}},{key:"integer",get:function(){return O().def(this.defaults.integer)}}]),t}(),t.defaults={},t.sensibleDefaults=void 0,t.config=o,t.oneOf=h,t.custom=j,t.instanceOf=m,t.oneOfType=T,t.arrayOf=k,t.objectOf=P,t.shape=_,t.utils={toType:a,validate:function(){return!![].slice.call(arguments)}},n}();function q(t){var e,n;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),n=e=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}return u(n,e),r(n,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),n}(A),e.defaults=Object.assign({},t),n}var w=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e}(/*#__PURE__*/ /*#__PURE__*/q());t.any=s,t.array=p,t.arrayOf=k,t.bool=y,t.config=o,t.createTypes=q,t.custom=j,t.default=w,t.fromType=function(t,e,n){void 0===n&&(n={});var r=a(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r},t.func=l,t.instanceOf=m,t.integer=O,t.number=b,t.object=v,t.objectOf=P,t.oneOf=h,t.oneOfType=T,t.shape=_,t.string=d,t.symbol=g,t.toType=function(t,e){return a(t,e)},t.toValidableType=function(t,e){return a(t,e,!0)}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("is-plain-object")):"function"==typeof define&&define.amd?define(["exports","is-plain-object"],e):e((t||self).VueTypes={},t.isPlainObject)}(this,function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}function u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}var o={silent:!1,logLevel:"warn"},f=Object.defineProperty,c=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function a(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:t,writable:!0},def:{value:function(t){return void 0===t?("default"in this&&delete this.default,this):(this.default=c(t)?function(){return[].concat(t)}:e.isPlainObject(t)?function(){return Object.assign({},t)}:t,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var s=function(){return a("any",{},!0)},l=function(){return a("func",{type:Function},!0)},y=function(){return a("bool",{type:Boolean},!0)},d=function(){return a("string",{type:String},!0)},b=function(){return a("number",{type:Number},!0)},p=function(){return a("array",{type:Array},!0)},g=function(){return a("object",{type:Object},!0)},v=function(){return a("symbol")},O=function(){return a("integer",{type:Number})},h=function(t){return a("oneOf")},j=function(t){return a("custom")},m=function(t){return a("instanceOf",{type:t})},k=function(t){return a("oneOfType")},T=function(t){return a("arrayOf",{type:Array})},P=function(t){return a("objectOf",{type:Object})},_=function(t){return f(a("shape",{type:Object}),"loose",{get:function(){return this}})};function x(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var o=((i={})[r?"get":"value"]=function(){return a(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return f(t,e,o)}var A=/*#__PURE__*/function(){var t,n;return n=t=/*#__PURE__*/function(){function t(){}return t.extend=function(t){var n=this;if(c(t))return t.forEach(function(t){return n.extend(t)}),this;var r=t.validate,u=t.getter,i=void 0!==u&&u,o=t.type,f=void 0===o?null:o;return x(this,t.name,{type:e.isPlainObject(f)&&f.type?null:f},i,!!r)},r(t,null,[{key:"any",get:function(){return s()}},{key:"func",get:function(){return l().def(this.defaults.func)}},{key:"bool",get:function(){return y().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return b().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return g().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return O().def(this.defaults.integer)}},{key:"nullable",get:function(){return{type:null}}}]),t}(),t.defaults={},t.sensibleDefaults=void 0,t.config=o,t.oneOf=h,t.custom=j,t.instanceOf=m,t.oneOfType=k,t.arrayOf=T,t.objectOf=P,t.shape=_,t.utils={toType:a,validate:function(){return!![].slice.call(arguments)}},n}();function q(t){var e,n;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),n=e=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}return u(n,e),r(n,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),n}(A),e.defaults=Object.assign({},t),n}var w=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e}(q());t.any=s,t.array=p,t.arrayOf=T,t.bool=y,t.config=o,t.createTypes=q,t.custom=j,t.default=w,t.fromType=function(t,e,n){void 0===n&&(n={});var r=a(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r},t.func=l,t.instanceOf=m,t.integer=O,t.nullable=function(){return{type:null}},t.number=b,t.object=g,t.objectOf=P,t.oneOf=h,t.oneOfType=k,t.shape=_,t.string=d,t.symbol=v,t.toType=function(t,e){return a(t,e)},t.toValidableType=function(t,e){return a(t,e,!0)}}); | ||
//# sourceMappingURL=shim.umd.js.map |
@@ -0,1 +1,2 @@ | ||
import { PropType } from '../types'; | ||
export declare const any: <T = any>() => import("../types").VueTypeValidableDef<T>; | ||
@@ -12,1 +13,4 @@ export declare const func: <T extends (...args: any[]) => any>() => import("../types").VueTypeValidableDef<T>; | ||
export declare const symbol: () => import("../types").VueTypeDef<symbol>; | ||
export declare const nullable: () => { | ||
type: PropType<null>; | ||
}; |
@@ -1,2 +0,2 @@ | ||
import{isPlainObject as e}from"is-plain-object";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},r.apply(this,arguments)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,o(e,t)}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function u(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}var a={silent:!1,logLevel:"warn"},f=["validator"],c=Object.prototype,l=c.toString,s=c.hasOwnProperty,v=/^\s*function (\w+)/;function p(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(v);return r?r[1]:""}return""}var y=e,d=function(e){return e},h=d;if("production"!==process.env.NODE_ENV){var b="undefined"!=typeof console;h=b?function(e,t){void 0===t&&(t=a.logLevel),!1===a.silent&&console[t]("[VueTypes warn]: "+e)}:d}var g=function(e,t){return s.call(e,t)},O=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},m=Array.isArray||function(e){return"[object Array]"===l.call(e)},j=function(e){return"[object Function]"===l.call(e)},_=function(e){return y(e)&&g(e,"_vueTypes_name")},T=function(e){return y(e)&&(g(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return g(e,t)}))};function w(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function k(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=y(e)?e:{type:e};var u=_(r)?r._vueTypes_name+" - ":"";if(T(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;m(r.type)?(i=r.type.some(function(e){return!0===k(e,t,!0)}),o=r.type.map(function(e){return p(e)}).join(" or ")):i="Array"===(o=p(r))?m(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(v);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?(h(a),!1):a}if(g(r,"validator")&&j(r.validator)){var f=h,c=[];if(h=function(e){c.push(e)},i=r.validator(t),h=f,!i){var l=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===n?(h(l),i):l}}return i}function P(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?(g(this,"default")&&delete this.default,this):j(e)||!0===k(this,e,!0)?(this.default=m(e)?function(){return[].concat(e)}:y(e)?function(){return Object.assign({},e)}:e,this):(h(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),r=n.validator;return j(r)&&(n.validator=w(r,n)),n}function x(e,t){var n=P(e,t);return Object.defineProperty(n,"validate",{value:function(e){return j(this.validator)&&h(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=w(e,this),this}})}function E(e,t,n){var r,i,o=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(o._vueTypes_name=e,!y(n))return o;var a,c,l=n.validator,s=u(n,f);if(j(l)){var v=o.validator;v&&(v=null!==(c=(a=v).__original)&&void 0!==c?c:a),o.validator=w(v?function(e){return v.call(this,e)&&l.call(this,e)}:l,o)}return Object.assign(o,s)}function N(e){return e.replace(/^(?!\s*$)/gm," ")}var q=function(){return x("any",{})},A=function(){return x("function",{type:Function})},V=function(){return x("boolean",{type:Boolean})},S=function(){return x("string",{type:String})},L=function(){return x("number",{type:Number})},D=function(){return x("array",{type:Array})},F=function(){return x("object",{type:Object})},Y=function(){return P("integer",{type:Number,validator:function(e){return O(e)}})},B=function(){return P("symbol",{validator:function(e){return"symbol"==typeof e}})};function I(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 P(e.name||"<<anonymous function>>",{type:null,validator:function(n){var r=e(n);return r||h(this._vueTypes_name+" - "+t),r}})}function J(e){if(!m(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 P("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||h(t),r}})}function M(e){if(!m(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(T(i)){if(_(i)&&"oneOf"===i._vueTypes_name&&i.type){n=n.concat(i.type);continue}if(j(i.validator)&&(t=!0),!0===i.type||!i.type){h('oneOfType - invalid usage of "true" or "null" as types.');continue}n=n.concat(i.type)}else n.push(i)}n=n.filter(function(e,t){return n.indexOf(e)===t});var o=n.length>0?n:null;return P("oneOfType",t?{type:o,validator:function(t){var n=[],r=e.some(function(e){var r=k(_(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||h("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+N(n.join("\n"))),r}}:{type:o})}function R(e){return P("arrayOf",{type:Array,validator:function(t){var n="",r=t.every(function(t){return!0===(n=k(e,t,!0))});return r||h("arrayOf - value validation error:\n"+N(n)),r}})}function $(e){return P("instanceOf",{type:e})}function z(e){return P("objectOf",{type:Object,validator:function(t){var n="",r=Object.keys(t).every(function(r){return!0===(n=k(e,t[r],!0))});return r||h("objectOf - value validation error:\n"+N(n)),r}})}function C(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!(null===(n=e[t])||void 0===n||!n.required)}),r=P("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 h(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||(h('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=k(e[n],r[n],!0);return"string"==typeof o&&h('shape - "'+n+'" property validation error:\n '+N(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 G=["name","validate","getter"],H=/*#__PURE__*/function(){var e,t;return t=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var t=this;if(m(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,o=e.getter,a=void 0!==o&&o,f=u(e,G);if(g(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return _(l)?(delete f.type,Object.defineProperty(this,n,a?{get:function(){return E(n,l,f)}}:{value:function(){var e,t=E(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?x(n,e):P(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=i?x(n,r):P(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 q()}},{key:"func",get:function(){return A().def(this.defaults.func)}},{key:"bool",get:function(){return V().def(this.defaults.bool)}},{key:"string",get:function(){return S().def(this.defaults.string)}},{key:"number",get:function(){return L().def(this.defaults.number)}},{key:"array",get:function(){return D().def(this.defaults.array)}},{key:"object",get:function(){return F().def(this.defaults.object)}},{key:"integer",get:function(){return Y().def(this.defaults.integer)}},{key:"symbol",get:function(){return B()}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=a,e.custom=I,e.oneOf=J,e.instanceOf=$,e.oneOfType=M,e.arrayOf=R,e.objectOf=z,e.shape=C,e.utils={validate:function(e,t){return!0===k(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?x(e,t):P(e,t)}},t}();function K(e){var t,o;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),o=t=/*#__PURE__*/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}(H),t.defaults=r({},e),o}var Q=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(/*#__PURE__*/ /*#__PURE__*/K());export{q as any,D as array,R as arrayOf,V as bool,a as config,K as createTypes,I as custom,Q as default,E as fromType,A as func,$ as instanceOf,Y as integer,L as number,F as object,z as objectOf,J as oneOf,M as oneOfType,C as shape,S as string,B as symbol,P as toType,x as toValidableType,k as validateType}; | ||
import{isPlainObject as e}from"is-plain-object";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},r.apply(this,arguments)}function i(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,o(e,t)}function o(e,t){return o=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},o(e,t)}function u(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}var a={silent:!1,logLevel:"warn"},f=["validator"],c=Object.prototype,l=c.toString,s=c.hasOwnProperty,v=/^\s*function (\w+)/;function y(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(v);return r?r[1]:""}return""}var p=e,d=function(e){return e},h=d;if("production"!==process.env.NODE_ENV){var b="undefined"!=typeof console;h=b?function(e,t){void 0===t&&(t=a.logLevel),!1===a.silent&&console[t]("[VueTypes warn]: "+e)}:d}var g=function(e,t){return s.call(e,t)},O=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},m=Array.isArray||function(e){return"[object Array]"===l.call(e)},j=function(e){return"[object Function]"===l.call(e)},_=function(e){return p(e)&&g(e,"_vueTypes_name")},T=function(e){return p(e)&&(g(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return g(e,t)}))};function w(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function k(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=p(e)?e:{type:e};var u=_(r)?r._vueTypes_name+" - ":"";if(T(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;m(r.type)?(i=r.type.some(function(e){return!0===k(e,t,!0)}),o=r.type.map(function(e){return y(e)}).join(" or ")):i="Array"===(o=y(r))?m(t):"Object"===o?p(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(v);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?(h(a),!1):a}if(g(r,"validator")&&j(r.validator)){var f=h,c=[];if(h=function(e){c.push(e)},i=r.validator(t),h=f,!i){var l=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===n?(h(l),i):l}}return i}function P(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?(g(this,"default")&&delete this.default,this):j(e)||!0===k(this,e,!0)?(this.default=m(e)?function(){return[].concat(e)}:p(e)?function(){return Object.assign({},e)}:e,this):(h(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),r=n.validator;return j(r)&&(n.validator=w(r,n)),n}function x(e,t){var n=P(e,t);return Object.defineProperty(n,"validate",{value:function(e){return j(this.validator)&&h(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=w(e,this),this}})}function E(e,t,n){var r,i,o=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(o._vueTypes_name=e,!p(n))return o;var a,c,l=n.validator,s=u(n,f);if(j(l)){var v=o.validator;v&&(v=null!==(c=(a=v).__original)&&void 0!==c?c:a),o.validator=w(v?function(e){return v.call(this,e)&&l.call(this,e)}:l,o)}return Object.assign(o,s)}function N(e){return e.replace(/^(?!\s*$)/gm," ")}var q=function(){return x("any",{})},A=function(){return x("function",{type:Function})},V=function(){return x("boolean",{type:Boolean})},S=function(){return x("string",{type:String})},L=function(){return x("number",{type:Number})},D=function(){return x("array",{type:Array})},F=function(){return x("object",{type:Object})},Y=function(){return P("integer",{type:Number,validator:function(e){return O(e)}})},B=function(){return P("symbol",{validator:function(e){return"symbol"==typeof e}})},I=function(){return{type:null}};function J(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 P(e.name||"<<anonymous function>>",{type:null,validator:function(n){var r=e(n);return r||h(this._vueTypes_name+" - "+t),r}})}function M(e){if(!m(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 P("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||h(t),r}})}function R(e){if(!m(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(T(i)){if(_(i)&&"oneOf"===i._vueTypes_name&&i.type){n=n.concat(i.type);continue}if(j(i.validator)&&(t=!0),!0===i.type||!i.type){h('oneOfType - invalid usage of "true" or "null" as types.');continue}n=n.concat(i.type)}else n.push(i)}n=n.filter(function(e,t){return n.indexOf(e)===t});var o=n.length>0?n:null;return P("oneOfType",t?{type:o,validator:function(t){var n=[],r=e.some(function(e){var r=k(_(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||h("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+N(n.join("\n"))),r}}:{type:o})}function $(e){return P("arrayOf",{type:Array,validator:function(t){var n="",r=t.every(function(t){return!0===(n=k(e,t,!0))});return r||h("arrayOf - value validation error:\n"+N(n)),r}})}function z(e){return P("instanceOf",{type:e})}function C(e){return P("objectOf",{type:Object,validator:function(t){var n="",r=Object.keys(t).every(function(r){return!0===(n=k(e,t[r],!0))});return r||h("objectOf - value validation error:\n"+N(n)),r}})}function G(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!(null===(n=e[t])||void 0===n||!n.required)}),r=P("shape",{type:Object,validator:function(r){var i=this;if(!p(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 h(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||(h('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=k(e[n],r[n],!0);return"string"==typeof o&&h('shape - "'+n+'" property validation error:\n '+N(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 H=["name","validate","getter"],K=/*#__PURE__*/function(){var e,t;return t=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var t=this;if(m(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,o=e.getter,a=void 0!==o&&o,f=u(e,H);if(g(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return _(l)?(delete f.type,Object.defineProperty(this,n,a?{get:function(){return E(n,l,f)}}:{value:function(){var e,t=E(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?x(n,e):P(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=i?x(n,r):P(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 q()}},{key:"func",get:function(){return A().def(this.defaults.func)}},{key:"bool",get:function(){return V().def(this.defaults.bool)}},{key:"string",get:function(){return S().def(this.defaults.string)}},{key:"number",get:function(){return L().def(this.defaults.number)}},{key:"array",get:function(){return D().def(this.defaults.array)}},{key:"object",get:function(){return F().def(this.defaults.object)}},{key:"integer",get:function(){return Y().def(this.defaults.integer)}},{key:"symbol",get:function(){return B()}},{key:"nullable",get:function(){return{type:null}}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=a,e.custom=J,e.oneOf=M,e.instanceOf=z,e.oneOfType=R,e.arrayOf=$,e.objectOf=C,e.shape=G,e.utils={validate:function(e,t){return!0===k(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?x(e,t):P(e,t)}},t}();function Q(e){var t,o;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),o=t=/*#__PURE__*/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}(K),t.defaults=r({},e),o}var U=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return i(t,e),t}(Q());export{q as any,D as array,$ as arrayOf,V as bool,a as config,Q as createTypes,J as custom,U as default,E as fromType,A as func,z as instanceOf,Y as integer,I as nullable,L as number,F as object,C as objectOf,M as oneOf,R as oneOfType,G as shape,S as string,B as symbol,P as toType,x as toValidableType,k as validateType}; | ||
//# sourceMappingURL=vue-types.m.js.map |
@@ -1,2 +0,2 @@ | ||
import{isPlainObject as e}from"is-plain-object";function t(){return t=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},t.apply(this,arguments)}function r(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}const n={silent:!1,logLevel:"warn"},i=["validator"],o=Object.prototype,a=o.toString,s=o.hasOwnProperty,u=/^\s*function (\w+)/;function l(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(u);return e?e[1]:""}return""}const c=e,f=e=>e;let d=f;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;d=e?function(e,t=n.logLevel){!1===n.silent&&console[t](`[VueTypes warn]: ${e}`)}:f}const p=(e,t)=>s.call(e,t),y=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},v=Array.isArray||function(e){return"[object Array]"===a.call(e)},h=e=>"[object Function]"===a.call(e),b=e=>c(e)&&p(e,"_vueTypes_name"),g=e=>c(e)&&(p(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>p(e,t)));function O(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function m(e,t,r=!1){let n,i=!0,o="";n=c(e)?e:{type:e};const a=b(n)?n._vueTypes_name+" - ":"";if(g(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return i;if(!n.required&&void 0===t)return i;v(n.type)?(i=n.type.some(e=>!0===m(e,t,!0)),o=n.type.map(e=>l(e)).join(" or ")):(o=l(n),i="Array"===o?v(t):"Object"===o?c(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";const t=e.constructor.toString().match(u);return t?t[1]:""}(t)===o:t instanceof n.type)}if(!i){const e=`${a}value "${t}" should be of type "${o}"`;return!1===r?(d(e),!1):e}if(p(n,"validator")&&h(n.validator)){const e=d,o=[];if(d=e=>{o.push(e)},i=n.validator(t),d=e,!i){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(d(e),i):e}}return i}function j(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?(p(this,"default")&&delete this.default,this):h(e)||!0===m(this,e,!0)?(this.default=v(e)?()=>[...e]:c(e)?()=>Object.assign({},e):e,this):(d(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return h(n)&&(r.validator=O(n,r)),r}function _(e,t){const r=j(e,t);return Object.defineProperty(r,"validate",{value(e){return h(this.validator)&&d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=O(e,this),this}})}function T(e,t,n){const o=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r)}),Object.defineProperties({},t)}(t);if(o._vueTypes_name=e,!c(n))return o;const{validator:a}=n,s=r(n,i);if(h(a)){let{validator:e}=o;e&&(e=null!==(l=(u=e).__original)&&void 0!==l?l:u),o.validator=O(e?function(t){return e.call(this,t)&&a.call(this,t)}:a,o)}var u,l;return Object.assign(o,s)}function $(e){return e.replace(/^(?!\s*$)/gm," ")}const w=()=>_("any",{}),P=()=>_("function",{type:Function}),x=()=>_("boolean",{type:Boolean}),E=()=>_("string",{type:String}),N=()=>_("number",{type:Number}),q=()=>_("array",{type:Array}),A=()=>_("object",{type:Object}),V=()=>j("integer",{type:Number,validator:e=>y(e)}),S=()=>j("symbol",{validator:e=>"symbol"==typeof e});function k(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return j(e.name||"<<anonymous function>>",{type:null,validator(r){const n=e(r);return n||d(`${this._vueTypes_name} - ${t}`),n}})}function D(e){if(!v(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 j("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||d(t),n}})}function L(e){if(!v(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 i=e[n];if(g(i)){if(b(i)&&"oneOf"===i._vueTypes_name&&i.type){r=r.concat(i.type);continue}if(h(i.validator)&&(t=!0),!0===i.type||!i.type){d('oneOfType - invalid usage of "true" or "null" as types.');continue}r=r.concat(i.type)}else r.push(i)}r=r.filter((e,t)=>r.indexOf(e)===t);const n=r.length>0?r:null;return j("oneOfType",t?{type:n,validator(t){const r=[],n=e.some(e=>{const n=m(b(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||d(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${$(r.join("\n"))}`),n}}:{type:n})}function F(e){return j("arrayOf",{type:Array,validator(t){let r="";const n=t.every(t=>(r=m(e,t,!0),!0===r));return n||d(`arrayOf - value validation error:\n${$(r)}`),n}})}function Y(e){return j("instanceOf",{type:e})}function B(e){return j("objectOf",{type:Object,validator(t){let r="";const n=Object.keys(t).every(n=>(r=m(e,t[n],!0),!0===r));return n||d(`objectOf - value validation error:\n${$(r)}`),n}})}function I(e){const t=Object.keys(e),r=t.filter(t=>{var r;return!(null===(r=e[t])||void 0===r||!r.required)}),n=j("shape",{type:Object,validator(n){if(!c(n))return!1;const i=Object.keys(n);if(r.length>0&&r.some(e=>-1===i.indexOf(e))){const e=r.filter(e=>-1===i.indexOf(e));return d(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return i.every(r=>{if(-1===t.indexOf(r))return!0===this._vueTypes_isLoose||(d(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const i=m(e[r],n[r],!0);return"string"==typeof i&&d(`shape - "${r}" property validation error:\n ${$(i)}`),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const J=["name","validate","getter"],M=/*#__PURE__*/(()=>{var e,t;return t=e=class{static get any(){return w()}static get func(){return P().def(this.defaults.func)}static get bool(){return x().def(this.defaults.bool)}static get string(){return E().def(this.defaults.string)}static get number(){return N().def(this.defaults.number)}static get array(){return q().def(this.defaults.array)}static get object(){return A().def(this.defaults.object)}static get integer(){return V().def(this.defaults.integer)}static get symbol(){return S()}static extend(e){if(v(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:n=!1,getter:i=!1}=e,o=r(e,J);if(p(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:a}=o;if(b(a))return delete o.type,Object.defineProperty(this,t,i?{get:()=>T(t,a,o)}:{value(...e){const r=T(t,a,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let s;return s=i?{get(){const e=Object.assign({},o);return n?_(t,e):j(t,e)},enumerable:!0}:{value(...e){const r=Object.assign({},o);let i;return i=n?_(t,r):j(t,r),r.validator&&(i.validator=r.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,s)}},e.defaults={},e.sensibleDefaults=void 0,e.config=n,e.custom=k,e.oneOf=D,e.instanceOf=Y,e.oneOfType=L,e.arrayOf=F,e.objectOf=B,e.shape=I,e.utils={validate:(e,t)=>!0===m(t,e,!0),toType:(e,t,r=!1)=>r?_(e,t):j(e,t)},t})();function R(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var r,n;return n=r=class extends M{static get sensibleDefaults(){return t({},this.defaults)}static set sensibleDefaults(r){this.defaults=!1!==r?t({},!0!==r?r:e):{}}},r.defaults=t({},e),n}class z extends(R()){}export{w as any,q as array,F as arrayOf,x as bool,n as config,R as createTypes,k as custom,z as default,T as fromType,P as func,Y as instanceOf,V as integer,N as number,A as object,B as objectOf,D as oneOf,L as oneOfType,I as shape,E as string,S as symbol,j as toType,_ as toValidableType,m as validateType}; | ||
import{isPlainObject as e}from"is-plain-object";function t(){return t=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},t.apply(this,arguments)}function r(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)t.indexOf(r=o[n])>=0||(i[r]=e[r]);return i}const n={silent:!1,logLevel:"warn"},i=["validator"],o=Object.prototype,a=o.toString,s=o.hasOwnProperty,u=/^\s*function (\w+)/;function l(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(u);return e?e[1]:""}return""}const c=e,f=e=>e;let d=f;if("production"!==process.env.NODE_ENV){const e="undefined"!=typeof console;d=e?function(e,t=n.logLevel){!1===n.silent&&console[t](`[VueTypes warn]: ${e}`)}:f}const p=(e,t)=>s.call(e,t),y=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},v=Array.isArray||function(e){return"[object Array]"===a.call(e)},h=e=>"[object Function]"===a.call(e),b=e=>c(e)&&p(e,"_vueTypes_name"),g=e=>c(e)&&(p(e,"type")||["_vueTypes_name","validator","default","required"].some(t=>p(e,t)));function O(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function m(e,t,r=!1){let n,i=!0,o="";n=c(e)?e:{type:e};const a=b(n)?n._vueTypes_name+" - ":"";if(g(n)&&null!==n.type){if(void 0===n.type||!0===n.type)return i;if(!n.required&&void 0===t)return i;v(n.type)?(i=n.type.some(e=>!0===m(e,t,!0)),o=n.type.map(e=>l(e)).join(" or ")):(o=l(n),i="Array"===o?v(t):"Object"===o?c(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";const t=e.constructor.toString().match(u);return t?t[1]:""}(t)===o:t instanceof n.type)}if(!i){const e=`${a}value "${t}" should be of type "${o}"`;return!1===r?(d(e),!1):e}if(p(n,"validator")&&h(n.validator)){const e=d,o=[];if(d=e=>{o.push(e)},i=n.validator(t),d=e,!i){const e=(o.length>1?"* ":"")+o.join("\n* ");return o.length=0,!1===r?(d(e),i):e}}return i}function j(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?(p(this,"default")&&delete this.default,this):h(e)||!0===m(this,e,!0)?(this.default=v(e)?()=>[...e]:c(e)?()=>Object.assign({},e):e,this):(d(`${this._vueTypes_name} - invalid default value: "${e}"`),this)}}}),{validator:n}=r;return h(n)&&(r.validator=O(n,r)),r}function _(e,t){const r=j(e,t);return Object.defineProperty(r,"validate",{value(e){return h(this.validator)&&d(`${this._vueTypes_name} - calling .validate() will overwrite the current custom validator function. Validator info:\n${JSON.stringify(this)}`),this.validator=O(e,this),this}})}function T(e,t,n){const o=function(e){const t={};return Object.getOwnPropertyNames(e).forEach(r=>{t[r]=Object.getOwnPropertyDescriptor(e,r)}),Object.defineProperties({},t)}(t);if(o._vueTypes_name=e,!c(n))return o;const{validator:a}=n,s=r(n,i);if(h(a)){let{validator:e}=o;e&&(e=null!==(l=(u=e).__original)&&void 0!==l?l:u),o.validator=O(e?function(t){return e.call(this,t)&&a.call(this,t)}:a,o)}var u,l;return Object.assign(o,s)}function $(e){return e.replace(/^(?!\s*$)/gm," ")}const w=()=>_("any",{}),P=()=>_("function",{type:Function}),x=()=>_("boolean",{type:Boolean}),E=()=>_("string",{type:String}),N=()=>_("number",{type:Number}),q=()=>_("array",{type:Array}),A=()=>_("object",{type:Object}),V=()=>j("integer",{type:Number,validator:e=>y(e)}),S=()=>j("symbol",{validator:e=>"symbol"==typeof e}),k=()=>({type:null});function D(e,t="custom validation failed"){if("function"!=typeof e)throw new TypeError("[VueTypes error]: You must provide a function as argument");return j(e.name||"<<anonymous function>>",{type:null,validator(r){const n=e(r);return n||d(`${this._vueTypes_name} - ${t}`),n}})}function L(e){if(!v(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 j("oneOf",{type:r.length>0?r:void 0,validator(r){const n=-1!==e.indexOf(r);return n||d(t),n}})}function F(e){if(!v(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 i=e[n];if(g(i)){if(b(i)&&"oneOf"===i._vueTypes_name&&i.type){r=r.concat(i.type);continue}if(h(i.validator)&&(t=!0),!0===i.type||!i.type){d('oneOfType - invalid usage of "true" or "null" as types.');continue}r=r.concat(i.type)}else r.push(i)}r=r.filter((e,t)=>r.indexOf(e)===t);const n=r.length>0?r:null;return j("oneOfType",t?{type:n,validator(t){const r=[],n=e.some(e=>{const n=m(b(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof n&&r.push(n),!0===n});return n||d(`oneOfType - provided value does not match any of the ${r.length} passed-in validators:\n${$(r.join("\n"))}`),n}}:{type:n})}function Y(e){return j("arrayOf",{type:Array,validator(t){let r="";const n=t.every(t=>(r=m(e,t,!0),!0===r));return n||d(`arrayOf - value validation error:\n${$(r)}`),n}})}function B(e){return j("instanceOf",{type:e})}function I(e){return j("objectOf",{type:Object,validator(t){let r="";const n=Object.keys(t).every(n=>(r=m(e,t[n],!0),!0===r));return n||d(`objectOf - value validation error:\n${$(r)}`),n}})}function J(e){const t=Object.keys(e),r=t.filter(t=>{var r;return!(null===(r=e[t])||void 0===r||!r.required)}),n=j("shape",{type:Object,validator(n){if(!c(n))return!1;const i=Object.keys(n);if(r.length>0&&r.some(e=>-1===i.indexOf(e))){const e=r.filter(e=>-1===i.indexOf(e));return d(1===e.length?`shape - required property "${e[0]}" is not defined.`:`shape - required properties "${e.join('", "')}" are not defined.`),!1}return i.every(r=>{if(-1===t.indexOf(r))return!0===this._vueTypes_isLoose||(d(`shape - shape definition does not include a "${r}" property. Allowed keys: "${t.join('", "')}".`),!1);const i=m(e[r],n[r],!0);return"string"==typeof i&&d(`shape - "${r}" property validation error:\n ${$(i)}`),!0===i})}});return Object.defineProperty(n,"_vueTypes_isLoose",{writable:!0,value:!1}),Object.defineProperty(n,"loose",{get(){return this._vueTypes_isLoose=!0,this}}),n}const M=["name","validate","getter"],R=/*#__PURE__*/(()=>{var e,t;return t=e=class{static get any(){return w()}static get func(){return P().def(this.defaults.func)}static get bool(){return x().def(this.defaults.bool)}static get string(){return E().def(this.defaults.string)}static get number(){return N().def(this.defaults.number)}static get array(){return q().def(this.defaults.array)}static get object(){return A().def(this.defaults.object)}static get integer(){return V().def(this.defaults.integer)}static get symbol(){return S()}static get nullable(){return{type:null}}static extend(e){if(v(e))return e.forEach(e=>this.extend(e)),this;const{name:t,validate:n=!1,getter:i=!1}=e,o=r(e,M);if(p(this,t))throw new TypeError(`[VueTypes error]: Type "${t}" already defined`);const{type:a}=o;if(b(a))return delete o.type,Object.defineProperty(this,t,i?{get:()=>T(t,a,o)}:{value(...e){const r=T(t,a,o);return r.validator&&(r.validator=r.validator.bind(r,...e)),r}});let s;return s=i?{get(){const e=Object.assign({},o);return n?_(t,e):j(t,e)},enumerable:!0}:{value(...e){const r=Object.assign({},o);let i;return i=n?_(t,r):j(t,r),r.validator&&(i.validator=r.validator.bind(i,...e)),i},enumerable:!0},Object.defineProperty(this,t,s)}},e.defaults={},e.sensibleDefaults=void 0,e.config=n,e.custom=D,e.oneOf=L,e.instanceOf=B,e.oneOfType=F,e.arrayOf=Y,e.objectOf=I,e.shape=J,e.utils={validate:(e,t)=>!0===m(t,e,!0),toType:(e,t,r=!1)=>r?_(e,t):j(e,t)},t})();function z(e={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var r,n;return n=r=class extends R{static get sensibleDefaults(){return t({},this.defaults)}static set sensibleDefaults(r){this.defaults=!1!==r?t({},!0!==r?r:e):{}}},r.defaults=t({},e),n}class C extends(z()){}export{w as any,q as array,Y as arrayOf,x as bool,n as config,z as createTypes,D as custom,C as default,T as fromType,P as func,B as instanceOf,V as integer,k as nullable,N as number,A as object,I as objectOf,L as oneOf,F as oneOfType,J as shape,E as string,S as symbol,j as toType,_ as toValidableType,m as validateType}; | ||
//# sourceMappingURL=vue-types.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("is-plain-object")):"function"==typeof define&&define.amd?define(["exports","is-plain-object"],t):t((e||self).VueTypes={},e.isPlainObject)}(this,function(e,t){function n(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 r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(){return i=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},i.apply(this,arguments)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function a(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}var f={silent:!1,logLevel:"warn"},c=["validator"],l=Object.prototype,s=l.toString,y=l.hasOwnProperty,p=/^\s*function (\w+)/;function d(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(p);return r?r[1]:""}return""}var v=t.isPlainObject,h=function(e){return e},b=function(e,t){return y.call(e,t)},g=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},O=Array.isArray||function(e){return"[object Array]"===s.call(e)},m=function(e){return"[object Function]"===s.call(e)},j=function(e){return v(e)&&b(e,"_vueTypes_name")},T=function(e){return v(e)&&(b(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return b(e,t)}))};function _(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function w(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=v(e)?e:{type:e};var u=j(r)?r._vueTypes_name+" - ":"";if(T(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;O(r.type)?(i=r.type.some(function(e){return!0===w(e,t,!0)}),o=r.type.map(function(e){return d(e)}).join(" or ")):i="Array"===(o=d(r))?O(t):"Object"===o?v(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(p);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?(h(a),!1):a}if(b(r,"validator")&&m(r.validator)){var f=h,c=[];if(h=function(e){c.push(e)},i=r.validator(t),h=f,!i){var l=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===n?(h(l),i):l}}return i}function k(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?(b(this,"default")&&delete this.default,this):m(e)||!0===w(this,e,!0)?(this.default=O(e)?function(){return[].concat(e)}:v(e)?function(){return Object.assign({},e)}:e,this):(h(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),r=n.validator;return m(r)&&(n.validator=_(r,n)),n}function P(e,t){var n=k(e,t);return Object.defineProperty(n,"validate",{value:function(e){return m(this.validator)&&h(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=_(e,this),this}})}function x(e,t,n){var r,i,o=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(o._vueTypes_name=e,!v(n))return o;var u,f,l=n.validator,s=a(n,c);if(m(l)){var y=o.validator;y&&(y=null!==(f=(u=y).__original)&&void 0!==f?f:u),o.validator=_(y?function(e){return y.call(this,e)&&l.call(this,e)}:l,o)}return Object.assign(o,s)}function q(e){return e.replace(/^(?!\s*$)/gm," ")}var A=function(){return P("any",{})},V=function(){return P("function",{type:Function})},E=function(){return P("boolean",{type:Boolean})},N=function(){return P("string",{type:String})},S=function(){return P("number",{type:Number})},F=function(){return P("array",{type:Array})},L=function(){return P("object",{type:Object})},D=function(){return k("integer",{type:Number,validator:function(e){return g(e)}})},Y=function(){return k("symbol",{validator:function(e){return"symbol"==typeof e}})};function B(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 k(e.name||"<<anonymous function>>",{type:null,validator:function(n){var r=e(n);return r||h(this._vueTypes_name+" - "+t),r}})}function I(e){if(!O(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 k("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||h(t),r}})}function J(e){if(!O(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(T(i)){if(j(i)&&"oneOf"===i._vueTypes_name&&i.type){n=n.concat(i.type);continue}if(m(i.validator)&&(t=!0),!0===i.type||!i.type){h('oneOfType - invalid usage of "true" or "null" as types.');continue}n=n.concat(i.type)}else n.push(i)}n=n.filter(function(e,t){return n.indexOf(e)===t});var o=n.length>0?n:null;return k("oneOfType",t?{type:o,validator:function(t){var n=[],r=e.some(function(e){var r=w(j(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||h("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+q(n.join("\n"))),r}}:{type:o})}function M(e){return k("arrayOf",{type:Array,validator:function(t){var n="",r=t.every(function(t){return!0===(n=w(e,t,!0))});return r||h("arrayOf - value validation error:\n"+q(n)),r}})}function R(e){return k("instanceOf",{type:e})}function $(e){return k("objectOf",{type:Object,validator:function(t){var n="",r=Object.keys(t).every(function(r){return!0===(n=w(e,t[r],!0))});return r||h("objectOf - value validation error:\n"+q(n)),r}})}function z(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!(null===(n=e[t])||void 0===n||!n.required)}),r=k("shape",{type:Object,validator:function(r){var i=this;if(!v(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 h(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||(h('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=w(e[n],r[n],!0);return"string"==typeof o&&h('shape - "'+n+'" property validation error:\n '+q(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 C=["name","validate","getter"],G=/*#__PURE__*/function(){var e,t;return t=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var t=this;if(O(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,o=e.getter,u=void 0!==o&&o,f=a(e,C);if(b(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return j(l)?(delete f.type,Object.defineProperty(this,n,u?{get:function(){return x(n,l,f)}}:{value:function(){var e,t=x(n,l,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=u?{get:function(){var e=Object.assign({},f);return i?P(n,e):k(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=i?P(n,r):k(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))},r(e,null,[{key:"any",get:function(){return A()}},{key:"func",get:function(){return V().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 S().def(this.defaults.number)}},{key:"array",get:function(){return F().def(this.defaults.array)}},{key:"object",get:function(){return L().def(this.defaults.object)}},{key:"integer",get:function(){return D().def(this.defaults.integer)}},{key:"symbol",get:function(){return Y()}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=f,e.custom=B,e.oneOf=I,e.instanceOf=R,e.oneOfType=J,e.arrayOf=M,e.objectOf=$,e.shape=z,e.utils={validate:function(e,t){return!0===w(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?P(e,t):k(e,t)}},t}();function H(e){var t,n;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),n=t=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),r(n,null,[{key:"sensibleDefaults",get:function(){return i({},this.defaults)},set:function(t){this.defaults=!1!==t?i({},!0!==t?t:e):{}}}]),n}(G),t.defaults=i({},e),n}var K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t}(/*#__PURE__*/ /*#__PURE__*/H());e.any=A,e.array=F,e.arrayOf=M,e.bool=E,e.config=f,e.createTypes=H,e.custom=B,e.default=K,e.fromType=x,e.func=V,e.instanceOf=R,e.integer=D,e.number=S,e.object=L,e.objectOf=$,e.oneOf=I,e.oneOfType=J,e.shape=z,e.string=N,e.symbol=Y,e.toType=k,e.toValidableType=P,e.validateType=w}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("is-plain-object")):"function"==typeof define&&define.amd?define(["exports","is-plain-object"],t):t((e||self).VueTypes={},e.isPlainObject)}(this,function(e,t){function n(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 r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(){return i=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},i.apply(this,arguments)}function o(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,u(e,t)}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function a(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}var f={silent:!1,logLevel:"warn"},c=["validator"],l=Object.prototype,s=l.toString,y=l.hasOwnProperty,p=/^\s*function (\w+)/;function d(e){var t,n=null!==(t=null==e?void 0:e.type)&&void 0!==t?t:e;if(n){var r=n.toString().match(p);return r?r[1]:""}return""}var v=t.isPlainObject,b=function(e){return e},h=function(e,t){return y.call(e,t)},g=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},O=Array.isArray||function(e){return"[object Array]"===s.call(e)},m=function(e){return"[object Function]"===s.call(e)},j=function(e){return v(e)&&h(e,"_vueTypes_name")},T=function(e){return v(e)&&(h(e,"type")||["_vueTypes_name","validator","default","required"].some(function(t){return h(e,t)}))};function _(e,t){return Object.defineProperty(e.bind(t),"__original",{value:e})}function w(e,t,n){var r;void 0===n&&(n=!1);var i=!0,o="";r=v(e)?e:{type:e};var u=j(r)?r._vueTypes_name+" - ":"";if(T(r)&&null!==r.type){if(void 0===r.type||!0===r.type)return i;if(!r.required&&void 0===t)return i;O(r.type)?(i=r.type.some(function(e){return!0===w(e,t,!0)}),o=r.type.map(function(e){return d(e)}).join(" or ")):i="Array"===(o=d(r))?O(t):"Object"===o?v(t):"String"===o||"Number"===o||"Boolean"===o||"Function"===o?function(e){if(null==e)return"";var t=e.constructor.toString().match(p);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?(b(a),!1):a}if(h(r,"validator")&&m(r.validator)){var f=b,c=[];if(b=function(e){c.push(e)},i=r.validator(t),b=f,!i){var l=(c.length>1?"* ":"")+c.join("\n* ");return c.length=0,!1===n?(b(l),i):l}}return i}function k(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?(h(this,"default")&&delete this.default,this):m(e)||!0===w(this,e,!0)?(this.default=O(e)?function(){return[].concat(e)}:v(e)?function(){return Object.assign({},e)}:e,this):(b(this._vueTypes_name+' - invalid default value: "'+e+'"'),this)}}}),r=n.validator;return m(r)&&(n.validator=_(r,n)),n}function P(e,t){var n=k(e,t);return Object.defineProperty(n,"validate",{value:function(e){return m(this.validator)&&b(this._vueTypes_name+" - calling .validate() will overwrite the current custom validator function. Validator info:\n"+JSON.stringify(this)),this.validator=_(e,this),this}})}function x(e,t,n){var r,i,o=(r=t,i={},Object.getOwnPropertyNames(r).forEach(function(e){i[e]=Object.getOwnPropertyDescriptor(r,e)}),Object.defineProperties({},i));if(o._vueTypes_name=e,!v(n))return o;var u,f,l=n.validator,s=a(n,c);if(m(l)){var y=o.validator;y&&(y=null!==(f=(u=y).__original)&&void 0!==f?f:u),o.validator=_(y?function(e){return y.call(this,e)&&l.call(this,e)}:l,o)}return Object.assign(o,s)}function q(e){return e.replace(/^(?!\s*$)/gm," ")}var A=function(){return P("any",{})},V=function(){return P("function",{type:Function})},E=function(){return P("boolean",{type:Boolean})},N=function(){return P("string",{type:String})},S=function(){return P("number",{type:Number})},F=function(){return P("array",{type:Array})},L=function(){return P("object",{type:Object})},D=function(){return k("integer",{type:Number,validator:function(e){return g(e)}})},Y=function(){return k("symbol",{validator:function(e){return"symbol"==typeof e}})};function B(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 k(e.name||"<<anonymous function>>",{type:null,validator:function(n){var r=e(n);return r||b(this._vueTypes_name+" - "+t),r}})}function I(e){if(!O(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 k("oneOf",{type:n.length>0?n:void 0,validator:function(n){var r=-1!==e.indexOf(n);return r||b(t),r}})}function J(e){if(!O(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(T(i)){if(j(i)&&"oneOf"===i._vueTypes_name&&i.type){n=n.concat(i.type);continue}if(m(i.validator)&&(t=!0),!0===i.type||!i.type){b('oneOfType - invalid usage of "true" or "null" as types.');continue}n=n.concat(i.type)}else n.push(i)}n=n.filter(function(e,t){return n.indexOf(e)===t});var o=n.length>0?n:null;return k("oneOfType",t?{type:o,validator:function(t){var n=[],r=e.some(function(e){var r=w(j(e)&&"oneOf"===e._vueTypes_name?e.type||null:e,t,!0);return"string"==typeof r&&n.push(r),!0===r});return r||b("oneOfType - provided value does not match any of the "+n.length+" passed-in validators:\n"+q(n.join("\n"))),r}}:{type:o})}function M(e){return k("arrayOf",{type:Array,validator:function(t){var n="",r=t.every(function(t){return!0===(n=w(e,t,!0))});return r||b("arrayOf - value validation error:\n"+q(n)),r}})}function R(e){return k("instanceOf",{type:e})}function $(e){return k("objectOf",{type:Object,validator:function(t){var n="",r=Object.keys(t).every(function(r){return!0===(n=w(e,t[r],!0))});return r||b("objectOf - value validation error:\n"+q(n)),r}})}function z(e){var t=Object.keys(e),n=t.filter(function(t){var n;return!(null===(n=e[t])||void 0===n||!n.required)}),r=k("shape",{type:Object,validator:function(r){var i=this;if(!v(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 b(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||(b('shape - shape definition does not include a "'+n+'" property. Allowed keys: "'+t.join('", "')+'".'),!1);var o=w(e[n],r[n],!0);return"string"==typeof o&&b('shape - "'+n+'" property validation error:\n '+q(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 C=["name","validate","getter"],G=/*#__PURE__*/function(){var e,t;return t=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var t=this;if(O(e))return e.forEach(function(e){return t.extend(e)}),this;var n=e.name,r=e.validate,i=void 0!==r&&r,o=e.getter,u=void 0!==o&&o,f=a(e,C);if(h(this,n))throw new TypeError('[VueTypes error]: Type "'+n+'" already defined');var c,l=f.type;return j(l)?(delete f.type,Object.defineProperty(this,n,u?{get:function(){return x(n,l,f)}}:{value:function(){var e,t=x(n,l,f);return t.validator&&(t.validator=(e=t.validator).bind.apply(e,[t].concat([].slice.call(arguments)))),t}})):(c=u?{get:function(){var e=Object.assign({},f);return i?P(n,e):k(n,e)},enumerable:!0}:{value:function(){var e,t,r=Object.assign({},f);return e=i?P(n,r):k(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))},r(e,null,[{key:"any",get:function(){return A()}},{key:"func",get:function(){return V().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 S().def(this.defaults.number)}},{key:"array",get:function(){return F().def(this.defaults.array)}},{key:"object",get:function(){return L().def(this.defaults.object)}},{key:"integer",get:function(){return D().def(this.defaults.integer)}},{key:"symbol",get:function(){return Y()}},{key:"nullable",get:function(){return{type:null}}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=f,e.custom=B,e.oneOf=I,e.instanceOf=R,e.oneOfType=J,e.arrayOf=M,e.objectOf=$,e.shape=z,e.utils={validate:function(e,t){return!0===w(t,e,!0)},toType:function(e,t,n){return void 0===n&&(n=!1),n?P(e,t):k(e,t)}},t}();function H(e){var t,n;return void 0===e&&(e={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),n=t=/*#__PURE__*/function(t){function n(){return t.apply(this,arguments)||this}return o(n,t),r(n,null,[{key:"sensibleDefaults",get:function(){return i({},this.defaults)},set:function(t){this.defaults=!1!==t?i({},!0!==t?t:e):{}}}]),n}(G),t.defaults=i({},e),n}var K=/*#__PURE__*/function(e){function t(){return e.apply(this,arguments)||this}return o(t,e),t}(H());e.any=A,e.array=F,e.arrayOf=M,e.bool=E,e.config=f,e.createTypes=H,e.custom=B,e.default=K,e.fromType=x,e.func=V,e.instanceOf=R,e.integer=D,e.nullable=function(){return{type:null}},e.number=S,e.object=L,e.objectOf=$,e.oneOf=I,e.oneOfType=J,e.shape=z,e.string=N,e.symbol=Y,e.toType=k,e.toValidableType=P,e.validateType=w}); | ||
//# sourceMappingURL=vue-types.umd.js.map |
{ | ||
"name": "vue-types", | ||
"version": "4.1.1", | ||
"version": "4.2.0-rc.1", | ||
"description": "Prop types utility for Vue", | ||
@@ -73,9 +73,9 @@ "author": "Marco Solazzi", | ||
"devDependencies": { | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.14.5", | ||
"@babel/plugin-proposal-optional-chaining": "7.14.5", | ||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.16.7", | ||
"@babel/plugin-proposal-optional-chaining": "7.16.7", | ||
"@nuxt/types": "2.15.8", | ||
"@types/jest": "27.0.2", | ||
"@types/node": "14.17.26", | ||
"@typescript-eslint/eslint-plugin": "5.0.0", | ||
"@typescript-eslint/parser": "5.0.0", | ||
"@types/jest": "27.4.0", | ||
"@types/node": "16.11.21", | ||
"@typescript-eslint/eslint-plugin": "5.10.0", | ||
"@typescript-eslint/parser": "5.10.0", | ||
"babel-plugin-transform-node-env-inline": "0.4.3", | ||
@@ -86,17 +86,17 @@ "cpy-cli": "3.1.1", | ||
"del-cli": "4.0.1", | ||
"eslint": "8.0.0", | ||
"eslint": "8.7.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-node": "11.1.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"eslint-plugin-vue": "7.19.1", | ||
"jest": "27.2.5", | ||
"microbundle": "0.14.0", | ||
"eslint-plugin-vue": "8.3.0", | ||
"jest": "27.4.7", | ||
"microbundle": "0.14.2", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.4.1", | ||
"ts-jest": "27.0.5", | ||
"typescript": "4.4.4", | ||
"vite": "2.6.7", | ||
"prettier": "2.5.1", | ||
"ts-jest": "27.1.3", | ||
"typescript": "4.5.5", | ||
"vite": "2.7.13", | ||
"vue2": "npm:vue@2.6.14", | ||
"vue3": "npm:vue@3.2.20", | ||
"vuepress": "1.8.2" | ||
"vue3": "npm:vue@3.2.28", | ||
"vuepress": "1.9.7" | ||
}, | ||
@@ -103,0 +103,0 @@ "dependencies": { |
@@ -1,1 +0,1 @@ | ||
var t=require("is-plain-object");function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}var u={silent:!1,logLevel:"warn"},i=Object.defineProperty,s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function f(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var o={_vueTypes_name:{value:e,writable:!0},def:{value:function(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=s(e)?function(){return[].concat(e)}:t.isPlainObject(e)?function(){return Object.assign({},e)}:e,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(o.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,o)}var a=function(){return f("any",{},!0)},c=function(){return f("func",{type:Function},!0)},l=function(){return f("bool",{type:Boolean},!0)},p=function(){return f("string",{type:String},!0)},y=function(){return f("number",{type:Number},!0)},d=function(){return f("array",{type:Array},!0)},b=function(){return f("object",{type:Object},!0)},v=function(){return f("symbol")},g=function(){return f("integer",{type:Number})},h=function(t){return f("oneOf")},O=function(t){return f("custom")},j=function(t){return f("instanceOf",{type:t})},x=function(t){return f("oneOfType")},m=function(t){return f("arrayOf",{type:Array})},k=function(t){return f("objectOf",{type:Object})},T=function(t){return i(f("shape",{type:Object}),"loose",{get:function(){return this}})};function _(t,e,n,r,o){var u;void 0===r&&(r=!1),void 0===o&&(o=!1);var s=((u={})[r?"get":"value"]=function(){return f(e,Object.assign({},n),o).def(r?t.defaults[e]:void 0)},u);return i(t,e,s)}var P=/*#__PURE__*/function(){var e,r;return r=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var n=this;if(s(e))return e.forEach(function(t){return n.extend(t)}),this;var r=e.validate,o=e.getter,u=void 0!==o&&o,i=e.type,f=void 0===i?null:i;return _(this,e.name,{type:t.isPlainObject(f)&&f.type?null:f},u,!!r)},n(e,null,[{key:"any",get:function(){return a()}},{key:"func",get:function(){return c().def(this.defaults.func)}},{key:"bool",get:function(){return l().def(this.defaults.bool)}},{key:"string",get:function(){return p().def(this.defaults.string)}},{key:"number",get:function(){return y().def(this.defaults.number)}},{key:"array",get:function(){return d().def(this.defaults.array)}},{key:"object",get:function(){return b().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return g().def(this.defaults.integer)}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=u,e.oneOf=h,e.custom=O,e.instanceOf=j,e.oneOfType=x,e.arrayOf=m,e.objectOf=k,e.shape=T,e.utils={toType:f,validate:function(){return!![].slice.call(arguments)}},r}();function w(t){var e,o;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),o=e=/*#__PURE__*/function(e){function o(){return e.apply(this,arguments)||this}return r(o,e),n(o,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),o}(P),e.defaults=Object.assign({},t),o}"production"!==process.env.NODE_ENV&&!1===u.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");var A=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(/*#__PURE__*/ /*#__PURE__*/w());Object.defineProperty(exports,"__esModule",{value:!0}),exports.any=a,exports.array=d,exports.arrayOf=m,exports.bool=l,exports.config=u,exports.createTypes=w,exports.custom=O,exports.default=A,exports.fromType=function(t,e,n){void 0===n&&(n={});var r=f(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r},exports.func=c,exports.instanceOf=j,exports.integer=g,exports.number=y,exports.object=b,exports.objectOf=k,exports.oneOf=h,exports.oneOfType=x,exports.shape=T,exports.string=p,exports.symbol=v,exports.toType=function(t,e){return f(t,e)},exports.toValidableType=function(t,e){return f(t,e,!0)}; | ||
var t=require("is-plain-object");function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,o(t,e)}function o(t,e){return o=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},o(t,e)}var u={silent:!1,logLevel:"warn"},i=Object.defineProperty,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function s(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var o={_vueTypes_name:{value:e,writable:!0},def:{value:function(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=f(e)?function(){return[].concat(e)}:t.isPlainObject(e)?function(){return Object.assign({},e)}:e,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(o.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,o)}var a=function(){return s("any",{},!0)},c=function(){return s("func",{type:Function},!0)},l=function(){return s("bool",{type:Boolean},!0)},p=function(){return s("string",{type:String},!0)},y=function(){return s("number",{type:Number},!0)},d=function(){return s("array",{type:Array},!0)},b=function(){return s("object",{type:Object},!0)},v=function(){return s("symbol")},g=function(){return s("integer",{type:Number})},h=function(t){return s("oneOf")},O=function(t){return s("custom")},j=function(t){return s("instanceOf",{type:t})},x=function(t){return s("oneOfType")},m=function(t){return s("arrayOf",{type:Array})},k=function(t){return s("objectOf",{type:Object})},T=function(t){return i(s("shape",{type:Object}),"loose",{get:function(){return this}})};function _(t,e,n,r,o){var u;void 0===r&&(r=!1),void 0===o&&(o=!1);var f=((u={})[r?"get":"value"]=function(){return s(e,Object.assign({},n),o).def(r?t.defaults[e]:void 0)},u);return i(t,e,f)}var P=/*#__PURE__*/function(){var e,r;return r=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var n=this;if(f(e))return e.forEach(function(t){return n.extend(t)}),this;var r=e.validate,o=e.getter,u=void 0!==o&&o,i=e.type,s=void 0===i?null:i;return _(this,e.name,{type:t.isPlainObject(s)&&s.type?null:s},u,!!r)},n(e,null,[{key:"any",get:function(){return a()}},{key:"func",get:function(){return c().def(this.defaults.func)}},{key:"bool",get:function(){return l().def(this.defaults.bool)}},{key:"string",get:function(){return p().def(this.defaults.string)}},{key:"number",get:function(){return y().def(this.defaults.number)}},{key:"array",get:function(){return d().def(this.defaults.array)}},{key:"object",get:function(){return b().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return g().def(this.defaults.integer)}},{key:"nullable",get:function(){return{type:null}}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=u,e.oneOf=h,e.custom=O,e.instanceOf=j,e.oneOfType=x,e.arrayOf=m,e.objectOf=k,e.shape=T,e.utils={toType:s,validate:function(){return!![].slice.call(arguments)}},r}();function w(t){var e,o;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),o=e=/*#__PURE__*/function(e){function o(){return e.apply(this,arguments)||this}return r(o,e),n(o,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),o}(P),e.defaults=Object.assign({},t),o}"production"!==process.env.NODE_ENV&&!1===u.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");var A=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(w());Object.defineProperty(exports,"__esModule",{value:!0}),exports.any=a,exports.array=d,exports.arrayOf=m,exports.bool=l,exports.config=u,exports.createTypes=w,exports.custom=O,exports.default=A,exports.fromType=function(t,e,n){void 0===n&&(n={});var r=s(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r},exports.func=c,exports.instanceOf=j,exports.integer=g,exports.nullable=function(){return{type:null}},exports.number=y,exports.object=b,exports.objectOf=k,exports.oneOf=h,exports.oneOfType=x,exports.shape=T,exports.string=p,exports.symbol=v,exports.toType=function(t,e){return s(t,e)},exports.toValidableType=function(t,e){return s(t,e,!0)}; |
@@ -1,1 +0,1 @@ | ||
import{isPlainObject as t}from"is-plain-object";function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}var i={silent:!1,logLevel:"warn"},o=Object.defineProperty,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function c(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:e,writable:!0},def:{value:function(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=f(e)?function(){return[].concat(e)}:t(e)?function(){return Object.assign({},e)}:e,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var a=function(){return c("any",{},!0)},s=function(){return c("func",{type:Function},!0)},l=function(){return c("bool",{type:Boolean},!0)},d=function(){return c("string",{type:String},!0)},y=function(){return c("number",{type:Number},!0)},p=function(){return c("array",{type:Array},!0)},b=function(){return c("object",{type:Object},!0)},v=function(){return c("symbol")},g=function(){return c("integer",{type:Number})},h=function(t){return c("oneOf")},O=function(t){return c("custom")},j=function(t){return c("instanceOf",{type:t})},m=function(t){return c("oneOfType")},k=function(t){return c("arrayOf",{type:Array})},_=function(t){return c("objectOf",{type:Object})},w=function(t){return o(c("shape",{type:Object}),"loose",{get:function(){return this}})};function T(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var f=((i={})[r?"get":"value"]=function(){return c(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return o(t,e,f)}function A(t,e,n){void 0===n&&(n={});var r=c(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r}var N=function(t,e){return c(t,e,!0)},P=function(t,e){return c(t,e)},x=/*#__PURE__*/function(){var e,r;return r=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var n=this;if(f(e))return e.forEach(function(t){return n.extend(t)}),this;var r=e.validate,u=e.getter,i=void 0!==u&&u,o=e.type,c=void 0===o?null:o;return T(this,e.name,{type:t(c)&&c.type?null:c},i,!!r)},n(e,null,[{key:"any",get:function(){return a()}},{key:"func",get:function(){return s().def(this.defaults.func)}},{key:"bool",get:function(){return l().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return y().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return b().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return g().def(this.defaults.integer)}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=i,e.oneOf=h,e.custom=O,e.instanceOf=j,e.oneOfType=m,e.arrayOf=k,e.objectOf=_,e.shape=w,e.utils={toType:c,validate:function(){return!![].slice.call(arguments)}},r}();function D(t){var e,u;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),u=e=/*#__PURE__*/function(e){function u(){return e.apply(this,arguments)||this}return r(u,e),n(u,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),u}(x),e.defaults=Object.assign({},t),u}"production"!==process.env.NODE_ENV&&!1===i.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");var E=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(/*#__PURE__*/ /*#__PURE__*/D());export{a as any,p as array,k as arrayOf,l as bool,i as config,D as createTypes,O as custom,E as default,A as fromType,s as func,j as instanceOf,g as integer,y as number,b as object,_ as objectOf,h as oneOf,m as oneOfType,w as shape,d as string,v as symbol,P as toType,N as toValidableType}; | ||
import{isPlainObject as t}from"is-plain-object";function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,u(t,e)}function u(t,e){return u=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},u(t,e)}var i={silent:!1,logLevel:"warn"},o=Object.defineProperty,f=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function c(e,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:e,writable:!0},def:{value:function(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=f(e)?function(){return[].concat(e)}:t(e)?function(){return Object.assign({},e)}:e,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var a=function(){return c("any",{},!0)},s=function(){return c("func",{type:Function},!0)},l=function(){return c("bool",{type:Boolean},!0)},d=function(){return c("string",{type:String},!0)},y=function(){return c("number",{type:Number},!0)},p=function(){return c("array",{type:Array},!0)},b=function(){return c("object",{type:Object},!0)},v=function(){return c("symbol")},g=function(){return c("integer",{type:Number})},h=function(t){return c("oneOf")},O=function(t){return c("custom")},j=function(t){return c("instanceOf",{type:t})},m=function(t){return c("oneOfType")},k=function(t){return c("arrayOf",{type:Array})},_=function(t){return c("objectOf",{type:Object})},w=function(t){return o(c("shape",{type:Object}),"loose",{get:function(){return this}})},T=function(){return{type:null}};function A(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var f=((i={})[r?"get":"value"]=function(){return c(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return o(t,e,f)}function N(t,e,n){void 0===n&&(n={});var r=c(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r}var P=function(t,e){return c(t,e,!0)},x=function(t,e){return c(t,e)},D=/*#__PURE__*/function(){var e,r;return r=e=/*#__PURE__*/function(){function e(){}return e.extend=function(e){var n=this;if(f(e))return e.forEach(function(t){return n.extend(t)}),this;var r=e.validate,u=e.getter,i=void 0!==u&&u,o=e.type,c=void 0===o?null:o;return A(this,e.name,{type:t(c)&&c.type?null:c},i,!!r)},n(e,null,[{key:"any",get:function(){return a()}},{key:"func",get:function(){return s().def(this.defaults.func)}},{key:"bool",get:function(){return l().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return y().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return b().def(this.defaults.object)}},{key:"symbol",get:function(){return v()}},{key:"integer",get:function(){return g().def(this.defaults.integer)}},{key:"nullable",get:function(){return{type:null}}}]),e}(),e.defaults={},e.sensibleDefaults=void 0,e.config=i,e.oneOf=h,e.custom=O,e.instanceOf=j,e.oneOfType=m,e.arrayOf=k,e.objectOf=_,e.shape=w,e.utils={toType:c,validate:function(){return!![].slice.call(arguments)}},r}();function E(t){var e,u;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),u=e=/*#__PURE__*/function(e){function u(){return e.apply(this,arguments)||this}return r(u,e),n(u,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),u}(D),e.defaults=Object.assign({},t),u}"production"!==process.env.NODE_ENV&&!1===i.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");var V=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(E());export{a as any,p as array,k as arrayOf,l as bool,i as config,E as createTypes,O as custom,V as default,N as fromType,s as func,j as instanceOf,g as integer,T as nullable,y as number,b as object,_ as objectOf,h as oneOf,m as oneOfType,w as shape,d as string,v as symbol,x as toType,P as toValidableType}; |
@@ -1,1 +0,1 @@ | ||
import{isPlainObject as t}from"is-plain-object";const e={silent:!1,logLevel:"warn"},s=Object.defineProperty,r=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function n(e,s={},n=!1){const i={_vueTypes_name:{value:e,writable:!0},def:{value(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=r(e)?()=>[].concat(e):t(e)?()=>Object.assign({},e):e,this)}},isRequired:{get(){return this.required=!0,this}}};return n&&(i.validate={value(){}}),s.validator||(s.validator=()=>!0),Object.defineProperties(s,i)}const i=()=>n("any",{},!0),a=()=>n("func",{type:Function},!0),u=()=>n("bool",{type:Boolean},!0),o=()=>n("string",{type:String},!0),l=()=>n("number",{type:Number},!0),c=()=>n("array",{type:Array},!0),f=()=>n("object",{type:Object},!0),d=()=>n("symbol"),b=()=>n("integer",{type:Number}),g=t=>n("oneOf"),y=t=>n("custom"),p=t=>n("instanceOf",{type:t}),h=t=>n("oneOfType"),v=t=>n("arrayOf",{type:Array}),O=t=>n("objectOf",{type:Object}),j=t=>s(n("shape",{type:Object}),"loose",{get(){return this}});function m(t,e,r,i=!1,a=!1){return s(t,e,{[i?"get":"value"]:()=>n(e,Object.assign({},r),a).def(i?t.defaults[e]:void 0)})}function T(t,e,s={}){const r=n(t,Object.assign({},e,s),!!e.validable);return r.validator&&delete r.validator,r}const w=(t,e)=>n(t,e,!0),x=(t,e)=>n(t,e),A=/*#__PURE__*/(()=>{var s,T;return T=s=class{static get any(){return i()}static get func(){return a().def(this.defaults.func)}static get bool(){return u().def(this.defaults.bool)}static get string(){return o().def(this.defaults.string)}static get number(){return l().def(this.defaults.number)}static get array(){return c().def(this.defaults.array)}static get object(){return f().def(this.defaults.object)}static get symbol(){return d()}static get integer(){return b().def(this.defaults.integer)}static extend(e){if(r(e))return e.forEach(t=>this.extend(t)),this;const{name:s,validate:n,getter:i=!1,type:a=null}=e;return m(this,s,{type:t(a)&&a.type?null:a},i,!!n)}},s.defaults={},s.sensibleDefaults=void 0,s.config=e,s.oneOf=g,s.custom=y,s.instanceOf=p,s.oneOfType=h,s.arrayOf=v,s.objectOf=O,s.shape=j,s.utils={toType:n,validate:(...t)=>!!t},T})();function D(t={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var e,s;return s=e=class extends A{static get sensibleDefaults(){return Object.assign({},this.defaults)}static set sensibleDefaults(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}},e.defaults=Object.assign({},t),s}"production"!==process.env.NODE_ENV&&!1===e.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");class N extends(D()){}export{i as any,c as array,v as arrayOf,u as bool,e as config,D as createTypes,y as custom,N as default,T as fromType,a as func,p as instanceOf,b as integer,l as number,f as object,O as objectOf,g as oneOf,h as oneOfType,j as shape,o as string,d as symbol,x as toType,w as toValidableType}; | ||
import{isPlainObject as t}from"is-plain-object";const e={silent:!1,logLevel:"warn"},n=Object.defineProperty,s=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(e,n={},r=!1){const i={_vueTypes_name:{value:e,writable:!0},def:{value(e){return void 0===e?("default"in this&&delete this.default,this):(this.default=s(e)?()=>[].concat(e):t(e)?()=>Object.assign({},e):e,this)}},isRequired:{get(){return this.required=!0,this}}};return r&&(i.validate={value(){}}),n.validator||(n.validator=()=>!0),Object.defineProperties(n,i)}const i=()=>r("any",{},!0),a=()=>r("func",{type:Function},!0),u=()=>r("bool",{type:Boolean},!0),o=()=>r("string",{type:String},!0),l=()=>r("number",{type:Number},!0),c=()=>r("array",{type:Array},!0),f=()=>r("object",{type:Object},!0),d=()=>r("symbol"),b=()=>r("integer",{type:Number}),y=t=>r("oneOf"),g=t=>r("custom"),p=t=>r("instanceOf",{type:t}),h=t=>r("oneOfType"),v=t=>r("arrayOf",{type:Array}),O=t=>r("objectOf",{type:Object}),j=t=>n(r("shape",{type:Object}),"loose",{get(){return this}}),m=()=>({type:null});function T(t,e,s,i=!1,a=!1){return n(t,e,{[i?"get":"value"]:()=>r(e,Object.assign({},s),a).def(i?t.defaults[e]:void 0)})}function w(t,e,n={}){const s=r(t,Object.assign({},e,n),!!e.validable);return s.validator&&delete s.validator,s}const x=(t,e)=>r(t,e,!0),A=(t,e)=>r(t,e),D=/*#__PURE__*/(()=>{var n,m;return m=n=class{static get any(){return i()}static get func(){return a().def(this.defaults.func)}static get bool(){return u().def(this.defaults.bool)}static get string(){return o().def(this.defaults.string)}static get number(){return l().def(this.defaults.number)}static get array(){return c().def(this.defaults.array)}static get object(){return f().def(this.defaults.object)}static get symbol(){return d()}static get integer(){return b().def(this.defaults.integer)}static get nullable(){return{type:null}}static extend(e){if(s(e))return e.forEach(t=>this.extend(t)),this;const{name:n,validate:r,getter:i=!1,type:a=null}=e;return T(this,n,{type:t(a)&&a.type?null:a},i,!!r)}},n.defaults={},n.sensibleDefaults=void 0,n.config=e,n.oneOf=y,n.custom=g,n.instanceOf=p,n.oneOfType=h,n.arrayOf=v,n.objectOf=O,n.shape=j,n.utils={toType:r,validate:(...t)=>!!t},m})();function N(t={func:()=>{},bool:!0,string:"",number:0,array:()=>[],object:()=>({}),integer:0}){var e,n;return n=e=class extends D{static get sensibleDefaults(){return Object.assign({},this.defaults)}static set sensibleDefaults(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}},e.defaults=Object.assign({},t),n}"production"!==process.env.NODE_ENV&&!1===e.silent&&console.warn("You are using the production shimmed version of VueTypes in a development build. Refer to https://dwightjack.github.io/vue-types/guide/installation.html#production-build to learn how to configure VueTypes for usage in multiple environments.");class E extends(N()){}export{i as any,c as array,v as arrayOf,u as bool,e as config,N as createTypes,g as custom,E as default,w as fromType,a as func,p as instanceOf,b as integer,m as nullable,l as number,f as object,O as objectOf,y as oneOf,h as oneOfType,j as shape,o as string,d as symbol,A as toType,x as toValidableType}; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("is-plain-object")):"function"==typeof define&&define.amd?define(["exports","is-plain-object"],e):e((t||self).VueTypes={},t.isPlainObject)}(this,function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}function u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}var o={silent:!1,logLevel:"warn"},f=Object.defineProperty,c=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function a(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:t,writable:!0},def:{value:function(t){return void 0===t?("default"in this&&delete this.default,this):(this.default=c(t)?function(){return[].concat(t)}:e.isPlainObject(t)?function(){return Object.assign({},t)}:t,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var s=function(){return a("any",{},!0)},l=function(){return a("func",{type:Function},!0)},y=function(){return a("bool",{type:Boolean},!0)},d=function(){return a("string",{type:String},!0)},b=function(){return a("number",{type:Number},!0)},p=function(){return a("array",{type:Array},!0)},v=function(){return a("object",{type:Object},!0)},g=function(){return a("symbol")},O=function(){return a("integer",{type:Number})},h=function(t){return a("oneOf")},j=function(t){return a("custom")},m=function(t){return a("instanceOf",{type:t})},T=function(t){return a("oneOfType")},k=function(t){return a("arrayOf",{type:Array})},P=function(t){return a("objectOf",{type:Object})},_=function(t){return f(a("shape",{type:Object}),"loose",{get:function(){return this}})};function x(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var o=((i={})[r?"get":"value"]=function(){return a(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return f(t,e,o)}var A=/*#__PURE__*/function(){var t,n;return n=t=/*#__PURE__*/function(){function t(){}return t.extend=function(t){var n=this;if(c(t))return t.forEach(function(t){return n.extend(t)}),this;var r=t.validate,u=t.getter,i=void 0!==u&&u,o=t.type,f=void 0===o?null:o;return x(this,t.name,{type:e.isPlainObject(f)&&f.type?null:f},i,!!r)},r(t,null,[{key:"any",get:function(){return s()}},{key:"func",get:function(){return l().def(this.defaults.func)}},{key:"bool",get:function(){return y().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return b().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return v().def(this.defaults.object)}},{key:"symbol",get:function(){return g()}},{key:"integer",get:function(){return O().def(this.defaults.integer)}}]),t}(),t.defaults={},t.sensibleDefaults=void 0,t.config=o,t.oneOf=h,t.custom=j,t.instanceOf=m,t.oneOfType=T,t.arrayOf=k,t.objectOf=P,t.shape=_,t.utils={toType:a,validate:function(){return!![].slice.call(arguments)}},n}();function q(t){var e,n;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),n=e=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}return u(n,e),r(n,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),n}(A),e.defaults=Object.assign({},t),n}var w=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e}(/*#__PURE__*/ /*#__PURE__*/q());Object.defineProperty(t,"__esModule",{value:!0}),t.any=s,t.array=p,t.arrayOf=k,t.bool=y,t.config=o,t.createTypes=q,t.custom=j,t.default=w,t.fromType=function(t,e,n){void 0===n&&(n={});var r=a(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r},t.func=l,t.instanceOf=m,t.integer=O,t.number=b,t.object=v,t.objectOf=P,t.oneOf=h,t.oneOfType=T,t.shape=_,t.string=d,t.symbol=g,t.toType=function(t,e){return a(t,e)},t.toValidableType=function(t,e){return a(t,e,!0)}}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("is-plain-object")):"function"==typeof define&&define.amd?define(["exports","is-plain-object"],e):e((t||self).VueTypes={},t.isPlainObject)}(this,function(t,e){function n(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function r(t,e,r){return e&&n(t.prototype,e),r&&n(t,r),t}function u(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,i(t,e)}function i(t,e){return i=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t},i(t,e)}var o={silent:!1,logLevel:"warn"},f=Object.defineProperty,c=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function a(t,n,r){void 0===n&&(n={}),void 0===r&&(r=!1);var u={_vueTypes_name:{value:t,writable:!0},def:{value:function(t){return void 0===t?("default"in this&&delete this.default,this):(this.default=c(t)?function(){return[].concat(t)}:e.isPlainObject(t)?function(){return Object.assign({},t)}:t,this)}},isRequired:{get:function(){return this.required=!0,this}}};return r&&(u.validate={value:function(){}}),n.validator||(n.validator=function(){return!0}),Object.defineProperties(n,u)}var s=function(){return a("any",{},!0)},l=function(){return a("func",{type:Function},!0)},y=function(){return a("bool",{type:Boolean},!0)},d=function(){return a("string",{type:String},!0)},b=function(){return a("number",{type:Number},!0)},p=function(){return a("array",{type:Array},!0)},v=function(){return a("object",{type:Object},!0)},g=function(){return a("symbol")},O=function(){return a("integer",{type:Number})},h=function(t){return a("oneOf")},j=function(t){return a("custom")},m=function(t){return a("instanceOf",{type:t})},k=function(t){return a("oneOfType")},T=function(t){return a("arrayOf",{type:Array})},P=function(t){return a("objectOf",{type:Object})},_=function(t){return f(a("shape",{type:Object}),"loose",{get:function(){return this}})};function x(t,e,n,r,u){var i;void 0===r&&(r=!1),void 0===u&&(u=!1);var o=((i={})[r?"get":"value"]=function(){return a(e,Object.assign({},n),u).def(r?t.defaults[e]:void 0)},i);return f(t,e,o)}var A=/*#__PURE__*/function(){var t,n;return n=t=/*#__PURE__*/function(){function t(){}return t.extend=function(t){var n=this;if(c(t))return t.forEach(function(t){return n.extend(t)}),this;var r=t.validate,u=t.getter,i=void 0!==u&&u,o=t.type,f=void 0===o?null:o;return x(this,t.name,{type:e.isPlainObject(f)&&f.type?null:f},i,!!r)},r(t,null,[{key:"any",get:function(){return s()}},{key:"func",get:function(){return l().def(this.defaults.func)}},{key:"bool",get:function(){return y().def(this.defaults.bool)}},{key:"string",get:function(){return d().def(this.defaults.string)}},{key:"number",get:function(){return b().def(this.defaults.number)}},{key:"array",get:function(){return p().def(this.defaults.array)}},{key:"object",get:function(){return v().def(this.defaults.object)}},{key:"symbol",get:function(){return g()}},{key:"integer",get:function(){return O().def(this.defaults.integer)}},{key:"nullable",get:function(){return{type:null}}}]),t}(),t.defaults={},t.sensibleDefaults=void 0,t.config=o,t.oneOf=h,t.custom=j,t.instanceOf=m,t.oneOfType=k,t.arrayOf=T,t.objectOf=P,t.shape=_,t.utils={toType:a,validate:function(){return!![].slice.call(arguments)}},n}();function q(t){var e,n;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),n=e=/*#__PURE__*/function(e){function n(){return e.apply(this,arguments)||this}return u(n,e),r(n,null,[{key:"sensibleDefaults",get:function(){return Object.assign({},this.defaults)},set:function(e){this.defaults=!1!==e?Object.assign({},!0!==e?e:t):{}}}]),n}(A),e.defaults=Object.assign({},t),n}var w=/*#__PURE__*/function(t){function e(){return t.apply(this,arguments)||this}return u(e,t),e}(q());Object.defineProperty(t,"__esModule",{value:!0}),t.any=s,t.array=p,t.arrayOf=T,t.bool=y,t.config=o,t.createTypes=q,t.custom=j,t.default=w,t.fromType=function(t,e,n){void 0===n&&(n={});var r=a(t,Object.assign({},e,n),!!e.validable);return r.validator&&delete r.validator,r},t.func=l,t.instanceOf=m,t.integer=O,t.nullable=function(){return{type:null}},t.number=b,t.object=v,t.objectOf=P,t.oneOf=h,t.oneOfType=k,t.shape=_,t.string=d,t.symbol=g,t.toType=function(t,e){return a(t,e)},t.toValidableType=function(t,e){return a(t,e,!0)}}); |
@@ -32,2 +32,3 @@ import { | ||
object, | ||
nullable, | ||
} from './validators/native' | ||
@@ -79,2 +80,6 @@ import custom from './validators/custom' | ||
static get nullable() { | ||
return nullable() | ||
} | ||
static readonly custom = custom | ||
@@ -216,2 +221,3 @@ static readonly oneOf = oneOf | ||
shape, | ||
nullable, | ||
createTypes, | ||
@@ -218,0 +224,0 @@ toType, |
@@ -89,2 +89,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
}) | ||
export const nullable: TypeShim = () => ({ | ||
type: null, | ||
}) | ||
/* eslint-enable @typescript-eslint/no-unused-vars */ | ||
@@ -157,2 +160,5 @@ | ||
} | ||
static get nullable() { | ||
return nullable() | ||
} | ||
static oneOf = oneOf | ||
@@ -159,0 +165,0 @@ static custom = custom |
@@ -50,1 +50,5 @@ import { toType, toValidableType, isInteger } from '../utils' | ||
}) | ||
export const nullable = () => ({ | ||
type: null as unknown as PropType<null>, | ||
}) |
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
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
312424
2020
6