@marcelohmdias/vue-typed
Version:
The easiest way to define types in Vue props
8 lines (7 loc) • 1.39 kB
JavaScript
/*!
* @marcelohmdias/vue-typed v0.2.0
* (c) Marcelo H M Dias <marcelohmdias@gmail.com> (https://github.com/marcelohmdias)
* Released under the MIT License.
*/
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)}}export default(function(){function e(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),this.props={}}var n,r,i;return n=e,i=[{key:"is",get:function(){return new e}}],(r=[{key:"def",value:function(){return this.props}},{key:"with",value:function(t){return this.props.default=function(){return t},this}},{key:"type",value:function(t){return this.props.type=t,this}},{key:"check",value:function(t){return this.props.validator=t,this}},{key:"required",get:function(){return this.props.required=!0,this}},{key:"array",get:function(){return this.type(Array)}},{key:"bool",get:function(){return this.type(Boolean)}},{key:"date",get:function(){return this.type(Date)}},{key:"func",get:function(){return this.type(Function)}},{key:"num",get:function(){return this.type(Number)}},{key:"obj",get:function(){return this.type(Object)}},{key:"str",get:function(){return this.type(String)}},{key:"sym",get:function(){return this.type(Symbol)}}])&&t(n.prototype,r),i&&t(n,i),e}());
//# sourceMappingURL=Typed.esm.min.js.map