vue-types
Version:
Prop types utility for Vue
3 lines (2 loc) • 4.5 kB
JavaScript
function t(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 e(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}function n(){return(n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}).apply(this,arguments)}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})(t,e)}function u(t){return"[object Object]"===Object.prototype.toString.call(t)}function i(t){var e,n;return!1!==u(t)&&(void 0===(e=t.constructor)||!1!==u(n=e.prototype)&&!1!==n.hasOwnProperty("isPrototypeOf"))}var c={silent:!1},f=Object.defineProperty,a=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function s(t,e,n){void 0===e&&(e={}),void 0===n&&(n=!1);var r={_vueTypes_name:{value:t,writable:!0},def:{value:function(t){var e=this;return void 0!==t||e.default?(e.default=a(t)?function(){return[].concat(t)}:i(t)?function(){return Object.assign({},t)}:t,e):e}},isRequired:{get:function(){return this.required=!0,this}}};return n&&(r.validate={value:function(){}}),Object.assign(Object.defineProperties({validator:function(){return!0}},r),e)}var p=function(){return s("any",{},!0)},l=function(){return s("func",{type:Function},!0)},y=function(){return s("bool",{type:Boolean},!0)},d=function(){return s("string",{type:String},!0)},b=function(){return s("number",{type:Number},!0)},v=function(){return s("array",{type:Array},!0)},g=function(){return s("object",{type:Object},!0)},O=function(){return s("symbol")},h=function(){return s("integer",{type:Number})},j=function(t){return s("oneOf")},m=function(t){return s("custom")},x=function(t){return s("instanceOf",{type:t})},k=function(t){return s("oneOfType")},_=function(t){return s("arrayOf",{type:Array})},P=function(t){return s("objectOf",{type:Object})},T=function(t){return f(s("shape",{type:Object}),"loose",{get:function(){return this}})};function w(t,e,n,r,o){var u;void 0===r&&(r=!1),void 0===o&&(o=!1);var i=((u={})[r?"get":"value"]=function(){return s(e,n,o).def(r?t.defaults[e]:void 0)},u);return f(t,e,i)}var A=function(){var t;return(t=function(){function t(){}return t.extend=function(t){var e=t.validate,n=t.getter,r=void 0!==n&&n,o=t.type,u=void 0===o?null:o;return w(this,t.name,{type:i(u)&&u.type?null:u},r,!!e)},e(t,null,[{key:"any",get:function(){return p()}},{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 v().def(this.defaults.array)}},{key:"object",get:function(){return g().def(this.defaults.object)}},{key:"symbol",get:function(){return O()}},{key:"integer",get:function(){return h().def(this.defaults.integer)}}]),t}()).defaults={},t.config=c,t.oneOf=j,t.custom=m,t.instanceOf=x,t.oneOfType=k,t.arrayOf=_,t.objectOf=P,t.shape=T,t.utils={toType:s,validate:function(){return!![].slice.call(arguments)}},t}();function N(t){var o;return void 0===t&&(t={func:function(){},bool:!0,string:"",number:0,array:function(){return[]},object:function(){return{}},integer:0}),(o=function(o){function u(){return o.apply(this,arguments)||this}return r(u,o),e(u,null,[{key:"sensibleDefaults",get:function(){return n({},this.defaults)},set:function(e){this.defaults=!1!==e?n({},!0!==e?e:t):{}}}]),u}(A)).defaults=n({},t),o}"production"!==process.env.NODE_ENV&&!1===c.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 S=function(t){function e(){return t.apply(this,arguments)||this}return r(e,t),e}(N());Object.defineProperty(exports,"__esModule",{value:!0}),exports.any=p,exports.array=v,exports.arrayOf=_,exports.bool=y,exports.config=c,exports.createTypes=N,exports.custom=m,exports.default=S,exports.func=l,exports.instanceOf=x,exports.integer=h,exports.number=b,exports.object=g,exports.objectOf=P,exports.oneOf=j,exports.oneOfType=k,exports.shape=T,exports.string=d,exports.symbol=O;
//# sourceMappingURL=shim.cjs.map