Comparing version 0.4.0 to 0.5.0
@@ -37,7 +37,3 @@ 'use strict'; | ||
(0, _classCallCheck3.default)(this, BoolBuilder); | ||
var _this = (0, _possibleConstructorReturn3.default)(this, (BoolBuilder.__proto__ || (0, _getPrototypeOf2.default)(BoolBuilder)).call(this, 'boolean', defaultValue)); | ||
_this.required(); | ||
return _this; | ||
return (0, _possibleConstructorReturn3.default)(this, (BoolBuilder.__proto__ || (0, _getPrototypeOf2.default)(BoolBuilder)).call(this, 'boolean', defaultValue)); | ||
} | ||
@@ -44,0 +40,0 @@ |
@@ -35,3 +35,4 @@ 'use strict'; | ||
this.errorMessage = ''; | ||
this.nullable = true; | ||
this.isNullable = false; | ||
this.isRequired = false; | ||
@@ -131,2 +132,11 @@ if ("production" !== process.env.NODE_ENV) { | ||
}, { | ||
key: 'nullable', | ||
value: function nullable() { | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
this.isNullable = state; | ||
return this; | ||
} | ||
}, { | ||
key: 'only', | ||
@@ -143,4 +153,6 @@ value: function only() { | ||
value: function required() { | ||
this.nullable = false; | ||
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
this.isRequired = state; | ||
return this; | ||
@@ -157,8 +169,20 @@ } | ||
var value = typeof initialValue === 'undefined' ? this.defaultValue : initialValue; | ||
var value = initialValue; | ||
if (value === null && this.nullable) { | ||
return value; | ||
if (typeof value === 'undefined') { | ||
if (!this.isRequired) { | ||
value = this.defaultValue; | ||
} else if ("production" !== process.env.NODE_ENV) { | ||
this.invariant(false, 'Field is required and must be defined.', path); | ||
} | ||
} | ||
if (value === null) { | ||
if (this.isNullable) { | ||
return value; | ||
} else if ("production" !== process.env.NODE_ENV) { | ||
this.invariant(false, 'Null is not allowed.', path); | ||
} | ||
} | ||
if ("production" !== process.env.NODE_ENV) { | ||
@@ -165,0 +189,0 @@ this.checks.forEach(function (checker) { |
@@ -1,1 +0,1 @@ | ||
"use strict";function unwrapExports(e){return e&&e.__esModule?e.default:e}function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}function isObject$1(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e&&!Array.isArray(e)}function arrayOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new ArrayBuilder(e,t)}function bool(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new BoolBuilder(e)}function custom(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new CustomBuilder(e,t)}function func(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new FuncBuilder(e)}function instanceOf(e){return new InstanceBuilder(e)}function regex(){return instanceOf(RegExp)}function date(){return instanceOf(Date)}function number(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new NumberBuilder(e)}function objectOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new ObjectBuilder(e,t)}function shape(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new ShapeBuilder(e,t)}function string(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return new StringBuilder(e)}function union(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new UnionBuilder(e,t)}function buildAndCheckOptions(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=_extends$1({},e),i={};return _Object$keys(t).forEach(function(c){var u=t[c],s=e[c],a=o?o+"."+c:c;u instanceof Builder?i[c]=u.runChecks(a,s,r):isObject$1(u)&&(i[c]=buildAndCheckOptions(s||{},u,r,a)),delete n[c]}),i}function Options(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return buildAndCheckOptions(e,t({arrayOf:arrayOf,bool:bool,custom:custom,date:date,func:func,instanceOf:instanceOf,number:number,objectOf:objectOf,regex:regex,shape:shape,string:string,union:union}),r)}var _defined=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e},_toObject=function(e){return Object(_defined(e))},hasOwnProperty={}.hasOwnProperty,_has=function(e,t){return hasOwnProperty.call(e,t)},toString={}.toString,_cof=function(e){return toString.call(e).slice(8,-1)},_iobject=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==_cof(e)?e.split(""):Object(e)},_toIobject=function(e){return _iobject(_defined(e))},ceil=Math.ceil,floor=Math.floor,_toInteger=function(e){return isNaN(e=+e)?0:(e>0?floor:ceil)(e)},min=Math.min,_toLength=function(e){return e>0?min(_toInteger(e),9007199254740991):0},max=Math.max,min$1=Math.min,_toIndex=function(e,t){return e=_toInteger(e),e<0?max(e+t,0):min$1(e,t)},_arrayIncludes=function(e){return function(t,r,o){var n,i=_toIobject(t),c=_toLength(i.length),u=_toIndex(o,c);if(e&&r!=r){for(;c>u;)if((n=i[u++])!=n)return!0}else for(;c>u;u++)if((e||u in i)&&i[u]===r)return e||u||0;return!e&&-1}},_global=createCommonjsModule(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),SHARED="__core-js_shared__",store=_global[SHARED]||(_global[SHARED]={}),_shared=function(e){return store[e]||(store[e]={})},id=0,px=Math.random(),_uid=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++id+px).toString(36))},shared=_shared("keys"),_sharedKey=function(e){return shared[e]||(shared[e]=_uid(e))},arrayIndexOf=_arrayIncludes(!1),IE_PROTO=_sharedKey("IE_PROTO"),_objectKeysInternal=function(e,t){var r,o=_toIobject(e),n=0,i=[];for(r in o)r!=IE_PROTO&&_has(o,r)&&i.push(r);for(;t.length>n;)_has(o,r=t[n++])&&(~arrayIndexOf(i,r)||i.push(r));return i},_enumBugKeys="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),_objectKeys=Object.keys||function(e){return _objectKeysInternal(e,_enumBugKeys)},_core=createCommonjsModule(function(e){var t=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=t)}),_aFunction=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e},_ctx=function(e,t,r){if(_aFunction(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,o){return e.call(t,r,o)};case 3:return function(r,o,n){return e.call(t,r,o,n)}}return function(){return e.apply(t,arguments)}},_isObject=function(e){return"object"==typeof e?null!==e:"function"==typeof e},_anObject=function(e){if(!_isObject(e))throw TypeError(e+" is not an object!");return e},_fails=function(e){try{return!!e()}catch(e){return!0}},_descriptors=!_fails(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),document$1=_global.document,is=_isObject(document$1)&&_isObject(document$1.createElement),_domCreate=function(e){return is?document$1.createElement(e):{}},_ie8DomDefine=!_descriptors&&!_fails(function(){return 7!=Object.defineProperty(_domCreate("div"),"a",{get:function(){return 7}}).a}),_toPrimitive=function(e,t){if(!_isObject(e))return e;var r,o;if(t&&"function"==typeof(r=e.toString)&&!_isObject(o=r.call(e)))return o;if("function"==typeof(r=e.valueOf)&&!_isObject(o=r.call(e)))return o;if(!t&&"function"==typeof(r=e.toString)&&!_isObject(o=r.call(e)))return o;throw TypeError("Can't convert object to primitive value")},dP=Object.defineProperty,f=_descriptors?Object.defineProperty:function(e,t,r){if(_anObject(e),t=_toPrimitive(t,!0),_anObject(r),_ie8DomDefine)try{return dP(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e},_objectDp={f:f},_propertyDesc=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},_hide=_descriptors?function(e,t,r){return _objectDp.f(e,t,_propertyDesc(1,r))}:function(e,t,r){return e[t]=r,e},PROTOTYPE="prototype",$export=function(e,t,r){var o,n,i,c=e&$export.F,u=e&$export.G,s=e&$export.S,a=e&$export.P,l=e&$export.B,f=e&$export.W,_=u?_core:_core[t]||(_core[t]={}),p=_[PROTOTYPE],d=u?_global:s?_global[t]:(_global[t]||{})[PROTOTYPE];u&&(r=t);for(o in r)(n=!c&&d&&void 0!==d[o])&&o in _||(i=n?d[o]:r[o],_[o]=u&&"function"!=typeof d[o]?r[o]:l&&n?_ctx(i,_global):f&&d[o]==i?function(e){var t=function(t,r,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,o)}return e.apply(this,arguments)};return t[PROTOTYPE]=e[PROTOTYPE],t}(i):a&&"function"==typeof i?_ctx(Function.call,i):i,a&&((_.virtual||(_.virtual={}))[o]=i,e&$export.R&&p&&!p[o]&&_hide(p,o,i)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128;var _export=$export,_objectSap=function(e,t){var r=(_core.Object||{})[e]||Object[e],o={};o[e]=t(r),_export(_export.S+_export.F*_fails(function(){r(1)}),"Object",o)};_objectSap("keys",function(){return function(e){return _objectKeys(_toObject(e))}});var keys$1=_core.Object.keys,keys=createCommonjsModule(function(e){e.exports={default:keys$1,__esModule:!0}}),_Object$keys=unwrapExports(keys),f$1=Object.getOwnPropertySymbols,_objectGops={f:f$1},f$2={}.propertyIsEnumerable,_objectPie={f:f$2},$assign=Object.assign,_objectAssign=!$assign||_fails(function(){var e={},t={},r=Symbol(),o="abcdefghijklmnopqrst";return e[r]=7,o.split("").forEach(function(e){t[e]=e}),7!=$assign({},e)[r]||Object.keys($assign({},t)).join("")!=o})?function(e,t){for(var r=_toObject(e),o=arguments.length,n=1,i=_objectGops.f,c=_objectPie.f;o>n;)for(var u,s=_iobject(arguments[n++]),a=i?_objectKeys(s).concat(i(s)):_objectKeys(s),l=a.length,f=0;l>f;)c.call(s,u=a[f++])&&(r[u]=s[u]);return r}:$assign;_export(_export.S+_export.F,"Object",{assign:_objectAssign});var assign$2=_core.Object.assign,assign=createCommonjsModule(function(e){e.exports={default:assign$2,__esModule:!0}}),_extends=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(assign);t.default=r.default||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}}),_extends$1=unwrapExports(_extends),_stringAt=function(e){return function(t,r){var o,n,i=String(_defined(t)),c=_toInteger(r),u=i.length;return c<0||c>=u?e?"":void 0:(o=i.charCodeAt(c),o<55296||o>56319||c+1===u||(n=i.charCodeAt(c+1))<56320||n>57343?e?i.charAt(c):o:e?i.slice(c,c+2):n-56320+(o-55296<<10)+65536)}},_library=!0,_redefine=_hide,_iterators={},_objectDps=_descriptors?Object.defineProperties:function(e,t){_anObject(e);for(var r,o=_objectKeys(t),n=o.length,i=0;n>i;)_objectDp.f(e,r=o[i++],t[r]);return e},_html=_global.document&&document.documentElement,IE_PROTO$1=_sharedKey("IE_PROTO"),Empty=function(){},PROTOTYPE$1="prototype",createDict=function(){var e,t=_domCreate("iframe"),r=_enumBugKeys.length;for(t.style.display="none",_html.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),createDict=e.F;r--;)delete createDict[PROTOTYPE$1][_enumBugKeys[r]];return createDict()},_objectCreate=Object.create||function(e,t){var r;return null!==e?(Empty[PROTOTYPE$1]=_anObject(e),r=new Empty,Empty[PROTOTYPE$1]=null,r[IE_PROTO$1]=e):r=createDict(),void 0===t?r:_objectDps(r,t)},_wks=createCommonjsModule(function(e){var t=_shared("wks"),r=_global.Symbol,o="function"==typeof r;(e.exports=function(e){return t[e]||(t[e]=o&&r[e]||(o?r:_uid)("Symbol."+e))}).store=t}),def=_objectDp.f,TAG=_wks("toStringTag"),_setToStringTag=function(e,t,r){e&&!_has(e=r?e:e.prototype,TAG)&&def(e,TAG,{configurable:!0,value:t})},IteratorPrototype={};_hide(IteratorPrototype,_wks("iterator"),function(){return this});var _iterCreate=function(e,t,r){e.prototype=_objectCreate(IteratorPrototype,{next:_propertyDesc(1,r)}),_setToStringTag(e,t+" Iterator")},IE_PROTO$2=_sharedKey("IE_PROTO"),ObjectProto=Object.prototype,_objectGpo=Object.getPrototypeOf||function(e){return e=_toObject(e),_has(e,IE_PROTO$2)?e[IE_PROTO$2]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?ObjectProto:null},ITERATOR=_wks("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",returnThis=function(){return this},_iterDefine=function(e,t,r,o,n,i,c){_iterCreate(r,t,o);var u,s,a,l=function(e){if(!BUGGY&&e in d)return d[e];switch(e){case KEYS:case VALUES:return function(){return new r(this,e)}}return function(){return new r(this,e)}},f=t+" Iterator",_=n==VALUES,p=!1,d=e.prototype,y=d[ITERATOR]||d[FF_ITERATOR]||n&&d[n],h=y||l(n),b=n?_?l("entries"):h:void 0,O="Array"==t?d.entries||y:y;if(O&&(a=_objectGpo(O.call(new e)))!==Object.prototype&&(_setToStringTag(a,f,!0),_library||_has(a,ITERATOR)||_hide(a,ITERATOR,returnThis)),_&&y&&y.name!==VALUES&&(p=!0,h=function(){return y.call(this)}),_library&&!c||!BUGGY&&!p&&d[ITERATOR]||_hide(d,ITERATOR,h),_iterators[t]=h,_iterators[f]=returnThis,n)if(u={values:_?h:l(VALUES),keys:i?h:l(KEYS),entries:b},c)for(s in u)s in d||_redefine(d,s,u[s]);else _export(_export.P+_export.F*(BUGGY||p),t,u);return u},$at=_stringAt(!0);_iterDefine(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=$at(t,r),this._i+=e.length,{value:e,done:!1})});var _iterCall=function(e,t,r,o){try{return o?t(_anObject(r)[0],r[1]):t(r)}catch(t){var n=e.return;throw void 0!==n&&_anObject(n.call(e)),t}},ITERATOR$1=_wks("iterator"),ArrayProto=Array.prototype,_isArrayIter=function(e){return void 0!==e&&(_iterators.Array===e||ArrayProto[ITERATOR$1]===e)},_createProperty=function(e,t,r){t in e?_objectDp.f(e,t,_propertyDesc(0,r)):e[t]=r},TAG$1=_wks("toStringTag"),ARG="Arguments"==_cof(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},_classof=function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=Object(e),TAG$1))?r:ARG?_cof(t):"Object"==(o=_cof(t))&&"function"==typeof t.callee?"Arguments":o},ITERATOR$2=_wks("iterator"),core_getIteratorMethod=_core.getIteratorMethod=function(e){if(void 0!=e)return e[ITERATOR$2]||e["@@iterator"]||_iterators[_classof(e)]},ITERATOR$3=_wks("iterator"),SAFE_CLOSING=!1;try{var riter=[7][ITERATOR$3]();riter.return=function(){SAFE_CLOSING=!0},Array.from(riter,function(){throw 2})}catch(e){}var _iterDetect=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var o=[7],n=o[ITERATOR$3]();n.next=function(){return{done:r=!0}},o[ITERATOR$3]=function(){return n},e(o)}catch(e){}return r};_export(_export.S+_export.F*!_iterDetect(function(e){Array.from(e)}),"Array",{from:function(e){var t,r,o,n,i=_toObject(e),c="function"==typeof this?this:Array,u=arguments.length,s=u>1?arguments[1]:void 0,a=void 0!==s,l=0,f=core_getIteratorMethod(i);if(a&&(s=_ctx(s,u>2?arguments[2]:void 0,2)),void 0==f||c==Array&&_isArrayIter(f))for(r=new c(t=_toLength(i.length));t>l;l++)_createProperty(r,l,a?s(i[l],l):i[l]);else for(n=f.call(i),r=new c;!(o=n.next()).done;l++)_createProperty(r,l,a?_iterCall(n,s,[o.value,l],!0):o.value);return r.length=l,r}});var from$2=_core.Array.from,from=createCommonjsModule(function(e){e.exports={default:from$2,__esModule:!0}}),toConsumableArray=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(from);t.default=function(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return(0,r.default)(e)}}),_addToUnscopables=function(){},_iterStep=function(e,t){return{value:t,done:!!e}},es6_array_iterator=_iterDefine(Array,"Array",function(e,t){this._t=_toIobject(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,_iterStep(1)):"keys"==t?_iterStep(0,r):"values"==t?_iterStep(0,e[r]):_iterStep(0,[r,e[r]])},"values");_iterators.Arguments=_iterators.Array,_addToUnscopables("keys"),_addToUnscopables("values"),_addToUnscopables("entries");for(var TO_STRING_TAG=_wks("toStringTag"),collections=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],i=0;i<5;i++){var NAME=collections[i],Collection=_global[NAME],proto=Collection&&Collection.prototype;proto&&!proto[TO_STRING_TAG]&&_hide(proto,TO_STRING_TAG,NAME),_iterators[NAME]=_iterators.Array}var f$3=_wks,_wksExt={f:f$3},iterator$2=_wksExt.f("iterator"),iterator=createCommonjsModule(function(e){e.exports={default:iterator$2,__esModule:!0}}),_meta=createCommonjsModule(function(e){var t=_uid("meta"),r=_objectDp.f,o=0,n=Object.isExtensible||function(){return!0},i=!_fails(function(){return n(Object.preventExtensions({}))}),c=function(e){r(e,t,{value:{i:"O"+ ++o,w:{}}})},u=e.exports={KEY:t,NEED:!1,fastKey:function(e,r){if(!_isObject(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!_has(e,t)){if(!n(e))return"F";if(!r)return"E";c(e)}return e[t].i},getWeak:function(e,r){if(!_has(e,t)){if(!n(e))return!0;if(!r)return!1;c(e)}return e[t].w},onFreeze:function(e){return i&&u.NEED&&n(e)&&!_has(e,t)&&c(e),e}}}),defineProperty=_objectDp.f,_wksDefine=function(e){var t=_core.Symbol||(_core.Symbol=_library?{}:_global.Symbol||{});"_"==e.charAt(0)||e in t||defineProperty(t,e,{value:_wksExt.f(e)})},_keyof=function(e,t){for(var r,o=_toIobject(e),n=_objectKeys(o),i=n.length,c=0;i>c;)if(o[r=n[c++]]===t)return r},_enumKeys=function(e){var t=_objectKeys(e),r=_objectGops.f;if(r)for(var o,n=r(e),i=_objectPie.f,c=0;n.length>c;)i.call(e,o=n[c++])&&t.push(o);return t},_isArray=Array.isArray||function(e){return"Array"==_cof(e)},hiddenKeys=_enumBugKeys.concat("length","prototype"),f$5=Object.getOwnPropertyNames||function(e){return _objectKeysInternal(e,hiddenKeys)},_objectGopn={f:f$5},gOPN$1=_objectGopn.f,toString$1={}.toString,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return gOPN$1(e)}catch(e){return windowNames.slice()}},f$4=function(e){return windowNames&&"[object Window]"==toString$1.call(e)?getWindowNames(e):gOPN$1(_toIobject(e))},_objectGopnExt={f:f$4},gOPD$1=Object.getOwnPropertyDescriptor,f$6=_descriptors?gOPD$1:function(e,t){if(e=_toIobject(e),t=_toPrimitive(t,!0),_ie8DomDefine)try{return gOPD$1(e,t)}catch(e){}if(_has(e,t))return _propertyDesc(!_objectPie.f.call(e,t),e[t])},_objectGopd={f:f$6},META=_meta.KEY,gOPD=_objectGopd.f,dP$1=_objectDp.f,gOPN=_objectGopnExt.f,$Symbol=_global.Symbol,$JSON=_global.JSON,_stringify=$JSON&&$JSON.stringify,PROTOTYPE$2="prototype",HIDDEN=_wks("_hidden"),TO_PRIMITIVE=_wks("toPrimitive"),isEnum={}.propertyIsEnumerable,SymbolRegistry=_shared("symbol-registry"),AllSymbols=_shared("symbols"),OPSymbols=_shared("op-symbols"),ObjectProto$1=Object[PROTOTYPE$2],USE_NATIVE="function"==typeof $Symbol,QObject=_global.QObject,setter=!QObject||!QObject[PROTOTYPE$2]||!QObject[PROTOTYPE$2].findChild,setSymbolDesc=_descriptors&&_fails(function(){return 7!=_objectCreate(dP$1({},"a",{get:function(){return dP$1(this,"a",{value:7}).a}})).a})?function(e,t,r){var o=gOPD(ObjectProto$1,t);o&&delete ObjectProto$1[t],dP$1(e,t,r),o&&e!==ObjectProto$1&&dP$1(ObjectProto$1,t,o)}:dP$1,wrap=function(e){var t=AllSymbols[e]=_objectCreate($Symbol[PROTOTYPE$2]);return t._k=e,t},isSymbol=USE_NATIVE&&"symbol"==typeof $Symbol.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof $Symbol},$defineProperty=function(e,t,r){return e===ObjectProto$1&&$defineProperty(OPSymbols,t,r),_anObject(e),t=_toPrimitive(t,!0),_anObject(r),_has(AllSymbols,t)?(r.enumerable?(_has(e,HIDDEN)&&e[HIDDEN][t]&&(e[HIDDEN][t]=!1),r=_objectCreate(r,{enumerable:_propertyDesc(0,!1)})):(_has(e,HIDDEN)||dP$1(e,HIDDEN,_propertyDesc(1,{})),e[HIDDEN][t]=!0),setSymbolDesc(e,t,r)):dP$1(e,t,r)},$defineProperties=function(e,t){_anObject(e);for(var r,o=_enumKeys(t=_toIobject(t)),n=0,i=o.length;i>n;)$defineProperty(e,r=o[n++],t[r]);return e},$create=function(e,t){return void 0===t?_objectCreate(e):$defineProperties(_objectCreate(e),t)},$propertyIsEnumerable=function(e){var t=isEnum.call(this,e=_toPrimitive(e,!0));return!(this===ObjectProto$1&&_has(AllSymbols,e)&&!_has(OPSymbols,e))&&(!(t||!_has(this,e)||!_has(AllSymbols,e)||_has(this,HIDDEN)&&this[HIDDEN][e])||t)},$getOwnPropertyDescriptor=function(e,t){if(e=_toIobject(e),t=_toPrimitive(t,!0),e!==ObjectProto$1||!_has(AllSymbols,t)||_has(OPSymbols,t)){var r=gOPD(e,t);return!r||!_has(AllSymbols,t)||_has(e,HIDDEN)&&e[HIDDEN][t]||(r.enumerable=!0),r}},$getOwnPropertyNames=function(e){for(var t,r=gOPN(_toIobject(e)),o=[],n=0;r.length>n;)_has(AllSymbols,t=r[n++])||t==HIDDEN||t==META||o.push(t);return o},$getOwnPropertySymbols=function(e){for(var t,r=e===ObjectProto$1,o=gOPN(r?OPSymbols:_toIobject(e)),n=[],i=0;o.length>i;)!_has(AllSymbols,t=o[i++])||r&&!_has(ObjectProto$1,t)||n.push(AllSymbols[t]);return n};USE_NATIVE||(_redefine(($Symbol=function(){if(this instanceof $Symbol)throw TypeError("Symbol is not a constructor!");var e=_uid(arguments.length>0?arguments[0]:void 0),t=function(r){this===ObjectProto$1&&t.call(OPSymbols,r),_has(this,HIDDEN)&&_has(this[HIDDEN],e)&&(this[HIDDEN][e]=!1),setSymbolDesc(this,e,_propertyDesc(1,r))};return _descriptors&&setter&&setSymbolDesc(ObjectProto$1,e,{configurable:!0,set:t}),wrap(e)})[PROTOTYPE$2],"toString",function(){return this._k}),_objectGopd.f=$getOwnPropertyDescriptor,_objectDp.f=$defineProperty,_objectGopn.f=_objectGopnExt.f=$getOwnPropertyNames,_objectPie.f=$propertyIsEnumerable,_objectGops.f=$getOwnPropertySymbols,_descriptors&&!_library&&_redefine(ObjectProto$1,"propertyIsEnumerable",$propertyIsEnumerable,!0),_wksExt.f=function(e){return wrap(_wks(e))}),_export(_export.G+_export.W+_export.F*!USE_NATIVE,{Symbol:$Symbol});for(var symbols="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),i$1=0;symbols.length>i$1;)_wks(symbols[i$1++]);for(var symbols=_objectKeys(_wks.store),i$1=0;symbols.length>i$1;)_wksDefine(symbols[i$1++]);_export(_export.S+_export.F*!USE_NATIVE,"Symbol",{for:function(e){return _has(SymbolRegistry,e+="")?SymbolRegistry[e]:SymbolRegistry[e]=$Symbol(e)},keyFor:function(e){if(isSymbol(e))return _keyof(SymbolRegistry,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){setter=!0},useSimple:function(){setter=!1}}),_export(_export.S+_export.F*!USE_NATIVE,"Object",{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor,getOwnPropertyNames:$getOwnPropertyNames,getOwnPropertySymbols:$getOwnPropertySymbols}),$JSON&&_export(_export.S+_export.F*(!USE_NATIVE||_fails(function(){var e=$Symbol();return"[null]"!=_stringify([e])||"{}"!=_stringify({a:e})||"{}"!=_stringify(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!isSymbol(e)){for(var t,r,o=[e],n=1;arguments.length>n;)o.push(arguments[n++]);return"function"==typeof(t=o[1])&&(r=t),!r&&_isArray(t)||(t=function(e,t){if(r&&(t=r.call(this,e,t)),!isSymbol(t))return t}),o[1]=t,_stringify.apply($JSON,o)}}}),$Symbol[PROTOTYPE$2][TO_PRIMITIVE]||_hide($Symbol[PROTOTYPE$2],TO_PRIMITIVE,$Symbol[PROTOTYPE$2].valueOf),_setToStringTag($Symbol,"Symbol"),_setToStringTag(Math,"Math",!0),_setToStringTag(_global.JSON,"JSON",!0),_wksDefine("asyncIterator"),_wksDefine("observable");var index=_core.Symbol,symbol=createCommonjsModule(function(e){e.exports={default:index,__esModule:!0}}),_typeof_1=createCommonjsModule(function(e,t){function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=r(iterator),n=r(symbol),i="function"==typeof n.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof n.default&&e.constructor===n.default&&e!==n.default.prototype?"symbol":typeof e};t.default="function"==typeof n.default&&"symbol"===i(o.default)?function(e){return void 0===e?"undefined":i(e)}:function(e){return e&&"function"==typeof n.default&&e.constructor===n.default&&e!==n.default.prototype?"symbol":void 0===e?"undefined":i(e)}}),_typeof=unwrapExports(_typeof_1),classCallCheck=createCommonjsModule(function(e,t){t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}}),_classCallCheck=unwrapExports(classCallCheck);_export(_export.S+_export.F*!_descriptors,"Object",{defineProperty:_objectDp.f});var $Object=_core.Object,defineProperty$3=function(e,t,r){return $Object.defineProperty(e,t,r)},defineProperty$1=createCommonjsModule(function(e){e.exports={default:defineProperty$3,__esModule:!0}}),createClass=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(defineProperty$1);t.default=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),(0,r.default)(e,n.key,n)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}()}),_createClass=unwrapExports(createClass),Builder=function(){function e(t,r){_classCallCheck(this,e),this.checks=[],this.currentConfig={},this.errorMessage="",this.nullable=!0,this.defaultValue=r,this.type=t,this.addCheck(this.checkTypeOf)}return _createClass(e,[{key:"addCheck",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return this.checks.push({args:r,func:e}),this}},{key:"checkOnly",value:function(e,t){}},{key:"checkTypeOf",value:function(e,t){}},{key:"invariant",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]}},{key:"message",value:function(e){return this.errorMessage=e,this}},{key:"only",value:function(){return this.addCheck(this.checkOnly)}},{key:"required",value:function(){return this.nullable=!1,this}},{key:"runChecks",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.currentConfig=r;var o=void 0===t?this.defaultValue:t;return null===o&&this.nullable,o}}]),e}();_objectSap("getPrototypeOf",function(){return function(e){return _objectGpo(_toObject(e))}});var getPrototypeOf$1=_core.Object.getPrototypeOf,getPrototypeOf=createCommonjsModule(function(e){e.exports={default:getPrototypeOf$1,__esModule:!0}}),_Object$getPrototypeOf=unwrapExports(getPrototypeOf),possibleConstructorReturn=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(_typeof_1);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,r.default)(t))&&"function"!=typeof t?e:t}}),_possibleConstructorReturn=unwrapExports(possibleConstructorReturn),check=function(e,t){if(_anObject(e),!_isObject(t)&&null!==t)throw TypeError(t+": can't set as prototype!")},_setProto={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=_ctx(Function.call,_objectGopd.f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,o){return check(e,o),t?e.__proto__=o:r(e,o),e}}({},!1):void 0),check:check};_export(_export.S,"Object",{setPrototypeOf:_setProto.set});var setPrototypeOf$2=_core.Object.setPrototypeOf,setPrototypeOf=createCommonjsModule(function(e){e.exports={default:setPrototypeOf$2,__esModule:!0}});_export(_export.S,"Object",{create:_objectCreate});var $Object$1=_core.Object,create$2=function(e,t){return $Object$1.create(e,t)},create=createCommonjsModule(function(e){e.exports={default:create$2,__esModule:!0}}),inherits=createCommonjsModule(function(e,t){function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=r(setPrototypeOf),n=r(create),i=r(_typeof_1);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,i.default)(t)));e.prototype=(0,n.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o.default?(0,o.default)(e,t):e.__proto__=t)}}),_inherits=unwrapExports(inherits),ArrayBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"array",r));return o.addCheck(o.checkContents,e),o}return _inherits(t,e),_createClass(t,[{key:"checkContents",value:function(e,t,r){}},{key:"notEmpty",value:function(){return this.addCheck(this.checkNotEmpty)}},{key:"checkNotEmpty",value:function(e,t){}}]),t}(Builder),BoolBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"boolean",e));return r.required(),r}return _inherits(t,e),t}(Builder),CustomBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"custom",r));return o.addCheck(o.checkCallback,e),o}return _inherits(t,e),_createClass(t,[{key:"checkCallback",value:function(e,t,r){r.call(this,e,t)}}]),t}(Builder),FuncBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"function",e))}return _inherits(t,e),t}(Builder),InstanceBuilder=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"instance",null));return r.refClass=e,r.addCheck(r.checkInstance,e),r}return _inherits(t,e),_createClass(t,[{key:"checkInstance",value:function(e,t,r){}}]),t}(Builder),NumberBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"number",e));return r.required(),r}return _inherits(t,e),_createClass(t,[{key:"between",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.addCheck(this.checkBetween,e,t,r)}},{key:"checkBetween",value:function(e,t,r,o){arguments.length>4&&void 0!==arguments[4]&&arguments[4]}},{key:"oneOf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.addCheck(this.checkOneOf,e)}},{key:"checkOneOf",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]}}]),t}(Builder),ObjectBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"object",r));return o.addCheck(o.checkContents,e),o}return _inherits(t,e),_createClass(t,[{key:"checkContents",value:function(e,t,r){}},{key:"notEmpty",value:function(){return this.addCheck(this.checkNotEmpty)}},{key:"checkNotEmpty",value:function(e,t){}}]),t}(Builder),ShapeBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"shape",r));return o.addCheck(o.checkContents,e),o}return _inherits(t,e),_createClass(t,[{key:"checkContents",value:function(e,t,r){}}]),t}(Builder),StringBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"string",e));return r.allowEmpty=!1,r.required(),r.addCheck(r.checkNotEmpty),r}return _inherits(t,e),_createClass(t,[{key:"contains",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.addCheck(this.checkContains,e,t)}},{key:"checkContains",value:function(e,t,r){arguments.length>3&&void 0!==arguments[3]&&arguments[3]}},{key:"match",value:function(e){return this.addCheck(this.checkMatch,e)}},{key:"checkMatch",value:function(e,t,r){}},{key:"empty",value:function(){return this.allowEmpty=!0,this}},{key:"checkNotEmpty",value:function(e,t){}},{key:"oneOf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.addCheck(this.checkOneOf,e)}},{key:"checkOneOf",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]}}]),t}(Builder),UnionBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"union",r));return o.addCheck(o.checkUnions,e),o}return _inherits(t,e),_createClass(t,[{key:"checkUnions",value:function(e,t,r){}}]),t}(Builder);module.exports=Options; | ||
"use strict";function unwrapExports(e){return e&&e.__esModule?e.default:e}function createCommonjsModule(e,t){return t={exports:{}},e(t,t.exports),t.exports}function isObject$1(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e&&!Array.isArray(e)}function arrayOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return new ArrayBuilder(e,t)}function bool(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return new BoolBuilder(e)}function custom(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new CustomBuilder(e,t)}function func(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return new FuncBuilder(e)}function instanceOf(e){return new InstanceBuilder(e)}function regex(){return instanceOf(RegExp)}function date(){return instanceOf(Date)}function number(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new NumberBuilder(e)}function objectOf(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new ObjectBuilder(e,t)}function shape(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new ShapeBuilder(e,t)}function string(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return new StringBuilder(e)}function union(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return new UnionBuilder(e,t)}function buildAndCheckOptions(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",n=_extends$1({},e),i={};return _Object$keys(t).forEach(function(c){var s=t[c],u=e[c],a=o?o+"."+c:c;s instanceof Builder?i[c]=s.runChecks(a,u,r):isObject$1(s)&&(i[c]=buildAndCheckOptions(u||{},s,r,a)),delete n[c]}),i}function Options(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return buildAndCheckOptions(e,t({arrayOf:arrayOf,bool:bool,custom:custom,date:date,func:func,instanceOf:instanceOf,number:number,objectOf:objectOf,regex:regex,shape:shape,string:string,union:union}),r)}var _defined=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e},_toObject=function(e){return Object(_defined(e))},hasOwnProperty={}.hasOwnProperty,_has=function(e,t){return hasOwnProperty.call(e,t)},toString={}.toString,_cof=function(e){return toString.call(e).slice(8,-1)},_iobject=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==_cof(e)?e.split(""):Object(e)},_toIobject=function(e){return _iobject(_defined(e))},ceil=Math.ceil,floor=Math.floor,_toInteger=function(e){return isNaN(e=+e)?0:(e>0?floor:ceil)(e)},min=Math.min,_toLength=function(e){return e>0?min(_toInteger(e),9007199254740991):0},max=Math.max,min$1=Math.min,_toIndex=function(e,t){return e=_toInteger(e),e<0?max(e+t,0):min$1(e,t)},_arrayIncludes=function(e){return function(t,r,o){var n,i=_toIobject(t),c=_toLength(i.length),s=_toIndex(o,c);if(e&&r!=r){for(;c>s;)if((n=i[s++])!=n)return!0}else for(;c>s;s++)if((e||s in i)&&i[s]===r)return e||s||0;return!e&&-1}},_global=createCommonjsModule(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),SHARED="__core-js_shared__",store=_global[SHARED]||(_global[SHARED]={}),_shared=function(e){return store[e]||(store[e]={})},id=0,px=Math.random(),_uid=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++id+px).toString(36))},shared=_shared("keys"),_sharedKey=function(e){return shared[e]||(shared[e]=_uid(e))},arrayIndexOf=_arrayIncludes(!1),IE_PROTO=_sharedKey("IE_PROTO"),_objectKeysInternal=function(e,t){var r,o=_toIobject(e),n=0,i=[];for(r in o)r!=IE_PROTO&&_has(o,r)&&i.push(r);for(;t.length>n;)_has(o,r=t[n++])&&(~arrayIndexOf(i,r)||i.push(r));return i},_enumBugKeys="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),_objectKeys=Object.keys||function(e){return _objectKeysInternal(e,_enumBugKeys)},_core=createCommonjsModule(function(e){var t=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=t)}),_aFunction=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e},_ctx=function(e,t,r){if(_aFunction(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,o){return e.call(t,r,o)};case 3:return function(r,o,n){return e.call(t,r,o,n)}}return function(){return e.apply(t,arguments)}},_isObject=function(e){return"object"==typeof e?null!==e:"function"==typeof e},_anObject=function(e){if(!_isObject(e))throw TypeError(e+" is not an object!");return e},_fails=function(e){try{return!!e()}catch(e){return!0}},_descriptors=!_fails(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),document$1=_global.document,is=_isObject(document$1)&&_isObject(document$1.createElement),_domCreate=function(e){return is?document$1.createElement(e):{}},_ie8DomDefine=!_descriptors&&!_fails(function(){return 7!=Object.defineProperty(_domCreate("div"),"a",{get:function(){return 7}}).a}),_toPrimitive=function(e,t){if(!_isObject(e))return e;var r,o;if(t&&"function"==typeof(r=e.toString)&&!_isObject(o=r.call(e)))return o;if("function"==typeof(r=e.valueOf)&&!_isObject(o=r.call(e)))return o;if(!t&&"function"==typeof(r=e.toString)&&!_isObject(o=r.call(e)))return o;throw TypeError("Can't convert object to primitive value")},dP=Object.defineProperty,f=_descriptors?Object.defineProperty:function(e,t,r){if(_anObject(e),t=_toPrimitive(t,!0),_anObject(r),_ie8DomDefine)try{return dP(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e},_objectDp={f:f},_propertyDesc=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},_hide=_descriptors?function(e,t,r){return _objectDp.f(e,t,_propertyDesc(1,r))}:function(e,t,r){return e[t]=r,e},PROTOTYPE="prototype",$export=function(e,t,r){var o,n,i,c=e&$export.F,s=e&$export.G,u=e&$export.S,a=e&$export.P,l=e&$export.B,f=e&$export.W,_=s?_core:_core[t]||(_core[t]={}),p=_[PROTOTYPE],d=s?_global:u?_global[t]:(_global[t]||{})[PROTOTYPE];s&&(r=t);for(o in r)(n=!c&&d&&void 0!==d[o])&&o in _||(i=n?d[o]:r[o],_[o]=s&&"function"!=typeof d[o]?r[o]:l&&n?_ctx(i,_global):f&&d[o]==i?function(e){var t=function(t,r,o){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,o)}return e.apply(this,arguments)};return t[PROTOTYPE]=e[PROTOTYPE],t}(i):a&&"function"==typeof i?_ctx(Function.call,i):i,a&&((_.virtual||(_.virtual={}))[o]=i,e&$export.R&&p&&!p[o]&&_hide(p,o,i)))};$export.F=1,$export.G=2,$export.S=4,$export.P=8,$export.B=16,$export.W=32,$export.U=64,$export.R=128;var _export=$export,_objectSap=function(e,t){var r=(_core.Object||{})[e]||Object[e],o={};o[e]=t(r),_export(_export.S+_export.F*_fails(function(){r(1)}),"Object",o)};_objectSap("keys",function(){return function(e){return _objectKeys(_toObject(e))}});var keys$1=_core.Object.keys,keys=createCommonjsModule(function(e){e.exports={default:keys$1,__esModule:!0}}),_Object$keys=unwrapExports(keys),f$1=Object.getOwnPropertySymbols,_objectGops={f:f$1},f$2={}.propertyIsEnumerable,_objectPie={f:f$2},$assign=Object.assign,_objectAssign=!$assign||_fails(function(){var e={},t={},r=Symbol(),o="abcdefghijklmnopqrst";return e[r]=7,o.split("").forEach(function(e){t[e]=e}),7!=$assign({},e)[r]||Object.keys($assign({},t)).join("")!=o})?function(e,t){for(var r=_toObject(e),o=arguments.length,n=1,i=_objectGops.f,c=_objectPie.f;o>n;)for(var s,u=_iobject(arguments[n++]),a=i?_objectKeys(u).concat(i(u)):_objectKeys(u),l=a.length,f=0;l>f;)c.call(u,s=a[f++])&&(r[s]=u[s]);return r}:$assign;_export(_export.S+_export.F,"Object",{assign:_objectAssign});var assign$2=_core.Object.assign,assign=createCommonjsModule(function(e){e.exports={default:assign$2,__esModule:!0}}),_extends=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(assign);t.default=r.default||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}}),_extends$1=unwrapExports(_extends),_stringAt=function(e){return function(t,r){var o,n,i=String(_defined(t)),c=_toInteger(r),s=i.length;return c<0||c>=s?e?"":void 0:(o=i.charCodeAt(c),o<55296||o>56319||c+1===s||(n=i.charCodeAt(c+1))<56320||n>57343?e?i.charAt(c):o:e?i.slice(c,c+2):n-56320+(o-55296<<10)+65536)}},_library=!0,_redefine=_hide,_iterators={},_objectDps=_descriptors?Object.defineProperties:function(e,t){_anObject(e);for(var r,o=_objectKeys(t),n=o.length,i=0;n>i;)_objectDp.f(e,r=o[i++],t[r]);return e},_html=_global.document&&document.documentElement,IE_PROTO$1=_sharedKey("IE_PROTO"),Empty=function(){},PROTOTYPE$1="prototype",createDict=function(){var e,t=_domCreate("iframe"),r=_enumBugKeys.length;for(t.style.display="none",_html.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),createDict=e.F;r--;)delete createDict[PROTOTYPE$1][_enumBugKeys[r]];return createDict()},_objectCreate=Object.create||function(e,t){var r;return null!==e?(Empty[PROTOTYPE$1]=_anObject(e),r=new Empty,Empty[PROTOTYPE$1]=null,r[IE_PROTO$1]=e):r=createDict(),void 0===t?r:_objectDps(r,t)},_wks=createCommonjsModule(function(e){var t=_shared("wks"),r=_global.Symbol,o="function"==typeof r;(e.exports=function(e){return t[e]||(t[e]=o&&r[e]||(o?r:_uid)("Symbol."+e))}).store=t}),def=_objectDp.f,TAG=_wks("toStringTag"),_setToStringTag=function(e,t,r){e&&!_has(e=r?e:e.prototype,TAG)&&def(e,TAG,{configurable:!0,value:t})},IteratorPrototype={};_hide(IteratorPrototype,_wks("iterator"),function(){return this});var _iterCreate=function(e,t,r){e.prototype=_objectCreate(IteratorPrototype,{next:_propertyDesc(1,r)}),_setToStringTag(e,t+" Iterator")},IE_PROTO$2=_sharedKey("IE_PROTO"),ObjectProto=Object.prototype,_objectGpo=Object.getPrototypeOf||function(e){return e=_toObject(e),_has(e,IE_PROTO$2)?e[IE_PROTO$2]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?ObjectProto:null},ITERATOR=_wks("iterator"),BUGGY=!([].keys&&"next"in[].keys()),FF_ITERATOR="@@iterator",KEYS="keys",VALUES="values",returnThis=function(){return this},_iterDefine=function(e,t,r,o,n,i,c){_iterCreate(r,t,o);var s,u,a,l=function(e){if(!BUGGY&&e in d)return d[e];switch(e){case KEYS:case VALUES:return function(){return new r(this,e)}}return function(){return new r(this,e)}},f=t+" Iterator",_=n==VALUES,p=!1,d=e.prototype,y=d[ITERATOR]||d[FF_ITERATOR]||n&&d[n],h=y||l(n),b=n?_?l("entries"):h:void 0,O="Array"==t?d.entries||y:y;if(O&&(a=_objectGpo(O.call(new e)))!==Object.prototype&&(_setToStringTag(a,f,!0),_library||_has(a,ITERATOR)||_hide(a,ITERATOR,returnThis)),_&&y&&y.name!==VALUES&&(p=!0,h=function(){return y.call(this)}),_library&&!c||!BUGGY&&!p&&d[ITERATOR]||_hide(d,ITERATOR,h),_iterators[t]=h,_iterators[f]=returnThis,n)if(s={values:_?h:l(VALUES),keys:i?h:l(KEYS),entries:b},c)for(u in s)u in d||_redefine(d,u,s[u]);else _export(_export.P+_export.F*(BUGGY||p),t,s);return s},$at=_stringAt(!0);_iterDefine(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=$at(t,r),this._i+=e.length,{value:e,done:!1})});var _iterCall=function(e,t,r,o){try{return o?t(_anObject(r)[0],r[1]):t(r)}catch(t){var n=e.return;throw void 0!==n&&_anObject(n.call(e)),t}},ITERATOR$1=_wks("iterator"),ArrayProto=Array.prototype,_isArrayIter=function(e){return void 0!==e&&(_iterators.Array===e||ArrayProto[ITERATOR$1]===e)},_createProperty=function(e,t,r){t in e?_objectDp.f(e,t,_propertyDesc(0,r)):e[t]=r},TAG$1=_wks("toStringTag"),ARG="Arguments"==_cof(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},_classof=function(e){var t,r,o;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=Object(e),TAG$1))?r:ARG?_cof(t):"Object"==(o=_cof(t))&&"function"==typeof t.callee?"Arguments":o},ITERATOR$2=_wks("iterator"),core_getIteratorMethod=_core.getIteratorMethod=function(e){if(void 0!=e)return e[ITERATOR$2]||e["@@iterator"]||_iterators[_classof(e)]},ITERATOR$3=_wks("iterator"),SAFE_CLOSING=!1;try{var riter=[7][ITERATOR$3]();riter.return=function(){SAFE_CLOSING=!0},Array.from(riter,function(){throw 2})}catch(e){}var _iterDetect=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var o=[7],n=o[ITERATOR$3]();n.next=function(){return{done:r=!0}},o[ITERATOR$3]=function(){return n},e(o)}catch(e){}return r};_export(_export.S+_export.F*!_iterDetect(function(e){Array.from(e)}),"Array",{from:function(e){var t,r,o,n,i=_toObject(e),c="function"==typeof this?this:Array,s=arguments.length,u=s>1?arguments[1]:void 0,a=void 0!==u,l=0,f=core_getIteratorMethod(i);if(a&&(u=_ctx(u,s>2?arguments[2]:void 0,2)),void 0==f||c==Array&&_isArrayIter(f))for(r=new c(t=_toLength(i.length));t>l;l++)_createProperty(r,l,a?u(i[l],l):i[l]);else for(n=f.call(i),r=new c;!(o=n.next()).done;l++)_createProperty(r,l,a?_iterCall(n,u,[o.value,l],!0):o.value);return r.length=l,r}});var from$2=_core.Array.from,from=createCommonjsModule(function(e){e.exports={default:from$2,__esModule:!0}}),toConsumableArray=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(from);t.default=function(e){if(Array.isArray(e)){for(var t=0,o=Array(e.length);t<e.length;t++)o[t]=e[t];return o}return(0,r.default)(e)}}),_addToUnscopables=function(){},_iterStep=function(e,t){return{value:t,done:!!e}},es6_array_iterator=_iterDefine(Array,"Array",function(e,t){this._t=_toIobject(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,_iterStep(1)):"keys"==t?_iterStep(0,r):"values"==t?_iterStep(0,e[r]):_iterStep(0,[r,e[r]])},"values");_iterators.Arguments=_iterators.Array,_addToUnscopables("keys"),_addToUnscopables("values"),_addToUnscopables("entries");for(var TO_STRING_TAG=_wks("toStringTag"),collections=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],i=0;i<5;i++){var NAME=collections[i],Collection=_global[NAME],proto=Collection&&Collection.prototype;proto&&!proto[TO_STRING_TAG]&&_hide(proto,TO_STRING_TAG,NAME),_iterators[NAME]=_iterators.Array}var f$3=_wks,_wksExt={f:f$3},iterator$2=_wksExt.f("iterator"),iterator=createCommonjsModule(function(e){e.exports={default:iterator$2,__esModule:!0}}),_meta=createCommonjsModule(function(e){var t=_uid("meta"),r=_objectDp.f,o=0,n=Object.isExtensible||function(){return!0},i=!_fails(function(){return n(Object.preventExtensions({}))}),c=function(e){r(e,t,{value:{i:"O"+ ++o,w:{}}})},s=e.exports={KEY:t,NEED:!1,fastKey:function(e,r){if(!_isObject(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!_has(e,t)){if(!n(e))return"F";if(!r)return"E";c(e)}return e[t].i},getWeak:function(e,r){if(!_has(e,t)){if(!n(e))return!0;if(!r)return!1;c(e)}return e[t].w},onFreeze:function(e){return i&&s.NEED&&n(e)&&!_has(e,t)&&c(e),e}}}),defineProperty=_objectDp.f,_wksDefine=function(e){var t=_core.Symbol||(_core.Symbol=_library?{}:_global.Symbol||{});"_"==e.charAt(0)||e in t||defineProperty(t,e,{value:_wksExt.f(e)})},_keyof=function(e,t){for(var r,o=_toIobject(e),n=_objectKeys(o),i=n.length,c=0;i>c;)if(o[r=n[c++]]===t)return r},_enumKeys=function(e){var t=_objectKeys(e),r=_objectGops.f;if(r)for(var o,n=r(e),i=_objectPie.f,c=0;n.length>c;)i.call(e,o=n[c++])&&t.push(o);return t},_isArray=Array.isArray||function(e){return"Array"==_cof(e)},hiddenKeys=_enumBugKeys.concat("length","prototype"),f$5=Object.getOwnPropertyNames||function(e){return _objectKeysInternal(e,hiddenKeys)},_objectGopn={f:f$5},gOPN$1=_objectGopn.f,toString$1={}.toString,windowNames="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],getWindowNames=function(e){try{return gOPN$1(e)}catch(e){return windowNames.slice()}},f$4=function(e){return windowNames&&"[object Window]"==toString$1.call(e)?getWindowNames(e):gOPN$1(_toIobject(e))},_objectGopnExt={f:f$4},gOPD$1=Object.getOwnPropertyDescriptor,f$6=_descriptors?gOPD$1:function(e,t){if(e=_toIobject(e),t=_toPrimitive(t,!0),_ie8DomDefine)try{return gOPD$1(e,t)}catch(e){}if(_has(e,t))return _propertyDesc(!_objectPie.f.call(e,t),e[t])},_objectGopd={f:f$6},META=_meta.KEY,gOPD=_objectGopd.f,dP$1=_objectDp.f,gOPN=_objectGopnExt.f,$Symbol=_global.Symbol,$JSON=_global.JSON,_stringify=$JSON&&$JSON.stringify,PROTOTYPE$2="prototype",HIDDEN=_wks("_hidden"),TO_PRIMITIVE=_wks("toPrimitive"),isEnum={}.propertyIsEnumerable,SymbolRegistry=_shared("symbol-registry"),AllSymbols=_shared("symbols"),OPSymbols=_shared("op-symbols"),ObjectProto$1=Object[PROTOTYPE$2],USE_NATIVE="function"==typeof $Symbol,QObject=_global.QObject,setter=!QObject||!QObject[PROTOTYPE$2]||!QObject[PROTOTYPE$2].findChild,setSymbolDesc=_descriptors&&_fails(function(){return 7!=_objectCreate(dP$1({},"a",{get:function(){return dP$1(this,"a",{value:7}).a}})).a})?function(e,t,r){var o=gOPD(ObjectProto$1,t);o&&delete ObjectProto$1[t],dP$1(e,t,r),o&&e!==ObjectProto$1&&dP$1(ObjectProto$1,t,o)}:dP$1,wrap=function(e){var t=AllSymbols[e]=_objectCreate($Symbol[PROTOTYPE$2]);return t._k=e,t},isSymbol=USE_NATIVE&&"symbol"==typeof $Symbol.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof $Symbol},$defineProperty=function(e,t,r){return e===ObjectProto$1&&$defineProperty(OPSymbols,t,r),_anObject(e),t=_toPrimitive(t,!0),_anObject(r),_has(AllSymbols,t)?(r.enumerable?(_has(e,HIDDEN)&&e[HIDDEN][t]&&(e[HIDDEN][t]=!1),r=_objectCreate(r,{enumerable:_propertyDesc(0,!1)})):(_has(e,HIDDEN)||dP$1(e,HIDDEN,_propertyDesc(1,{})),e[HIDDEN][t]=!0),setSymbolDesc(e,t,r)):dP$1(e,t,r)},$defineProperties=function(e,t){_anObject(e);for(var r,o=_enumKeys(t=_toIobject(t)),n=0,i=o.length;i>n;)$defineProperty(e,r=o[n++],t[r]);return e},$create=function(e,t){return void 0===t?_objectCreate(e):$defineProperties(_objectCreate(e),t)},$propertyIsEnumerable=function(e){var t=isEnum.call(this,e=_toPrimitive(e,!0));return!(this===ObjectProto$1&&_has(AllSymbols,e)&&!_has(OPSymbols,e))&&(!(t||!_has(this,e)||!_has(AllSymbols,e)||_has(this,HIDDEN)&&this[HIDDEN][e])||t)},$getOwnPropertyDescriptor=function(e,t){if(e=_toIobject(e),t=_toPrimitive(t,!0),e!==ObjectProto$1||!_has(AllSymbols,t)||_has(OPSymbols,t)){var r=gOPD(e,t);return!r||!_has(AllSymbols,t)||_has(e,HIDDEN)&&e[HIDDEN][t]||(r.enumerable=!0),r}},$getOwnPropertyNames=function(e){for(var t,r=gOPN(_toIobject(e)),o=[],n=0;r.length>n;)_has(AllSymbols,t=r[n++])||t==HIDDEN||t==META||o.push(t);return o},$getOwnPropertySymbols=function(e){for(var t,r=e===ObjectProto$1,o=gOPN(r?OPSymbols:_toIobject(e)),n=[],i=0;o.length>i;)!_has(AllSymbols,t=o[i++])||r&&!_has(ObjectProto$1,t)||n.push(AllSymbols[t]);return n};USE_NATIVE||(_redefine(($Symbol=function(){if(this instanceof $Symbol)throw TypeError("Symbol is not a constructor!");var e=_uid(arguments.length>0?arguments[0]:void 0),t=function(r){this===ObjectProto$1&&t.call(OPSymbols,r),_has(this,HIDDEN)&&_has(this[HIDDEN],e)&&(this[HIDDEN][e]=!1),setSymbolDesc(this,e,_propertyDesc(1,r))};return _descriptors&&setter&&setSymbolDesc(ObjectProto$1,e,{configurable:!0,set:t}),wrap(e)})[PROTOTYPE$2],"toString",function(){return this._k}),_objectGopd.f=$getOwnPropertyDescriptor,_objectDp.f=$defineProperty,_objectGopn.f=_objectGopnExt.f=$getOwnPropertyNames,_objectPie.f=$propertyIsEnumerable,_objectGops.f=$getOwnPropertySymbols,_descriptors&&!_library&&_redefine(ObjectProto$1,"propertyIsEnumerable",$propertyIsEnumerable,!0),_wksExt.f=function(e){return wrap(_wks(e))}),_export(_export.G+_export.W+_export.F*!USE_NATIVE,{Symbol:$Symbol});for(var symbols="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),i$1=0;symbols.length>i$1;)_wks(symbols[i$1++]);for(var symbols=_objectKeys(_wks.store),i$1=0;symbols.length>i$1;)_wksDefine(symbols[i$1++]);_export(_export.S+_export.F*!USE_NATIVE,"Symbol",{for:function(e){return _has(SymbolRegistry,e+="")?SymbolRegistry[e]:SymbolRegistry[e]=$Symbol(e)},keyFor:function(e){if(isSymbol(e))return _keyof(SymbolRegistry,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){setter=!0},useSimple:function(){setter=!1}}),_export(_export.S+_export.F*!USE_NATIVE,"Object",{create:$create,defineProperty:$defineProperty,defineProperties:$defineProperties,getOwnPropertyDescriptor:$getOwnPropertyDescriptor,getOwnPropertyNames:$getOwnPropertyNames,getOwnPropertySymbols:$getOwnPropertySymbols}),$JSON&&_export(_export.S+_export.F*(!USE_NATIVE||_fails(function(){var e=$Symbol();return"[null]"!=_stringify([e])||"{}"!=_stringify({a:e})||"{}"!=_stringify(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!isSymbol(e)){for(var t,r,o=[e],n=1;arguments.length>n;)o.push(arguments[n++]);return"function"==typeof(t=o[1])&&(r=t),!r&&_isArray(t)||(t=function(e,t){if(r&&(t=r.call(this,e,t)),!isSymbol(t))return t}),o[1]=t,_stringify.apply($JSON,o)}}}),$Symbol[PROTOTYPE$2][TO_PRIMITIVE]||_hide($Symbol[PROTOTYPE$2],TO_PRIMITIVE,$Symbol[PROTOTYPE$2].valueOf),_setToStringTag($Symbol,"Symbol"),_setToStringTag(Math,"Math",!0),_setToStringTag(_global.JSON,"JSON",!0),_wksDefine("asyncIterator"),_wksDefine("observable");var index=_core.Symbol,symbol=createCommonjsModule(function(e){e.exports={default:index,__esModule:!0}}),_typeof_1=createCommonjsModule(function(e,t){function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=r(iterator),n=r(symbol),i="function"==typeof n.default&&"symbol"==typeof o.default?function(e){return typeof e}:function(e){return e&&"function"==typeof n.default&&e.constructor===n.default&&e!==n.default.prototype?"symbol":typeof e};t.default="function"==typeof n.default&&"symbol"===i(o.default)?function(e){return void 0===e?"undefined":i(e)}:function(e){return e&&"function"==typeof n.default&&e.constructor===n.default&&e!==n.default.prototype?"symbol":void 0===e?"undefined":i(e)}}),_typeof=unwrapExports(_typeof_1),classCallCheck=createCommonjsModule(function(e,t){t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}}),_classCallCheck=unwrapExports(classCallCheck);_export(_export.S+_export.F*!_descriptors,"Object",{defineProperty:_objectDp.f});var $Object=_core.Object,defineProperty$3=function(e,t,r){return $Object.defineProperty(e,t,r)},defineProperty$1=createCommonjsModule(function(e){e.exports={default:defineProperty$3,__esModule:!0}}),createClass=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(defineProperty$1);t.default=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),(0,r.default)(e,n.key,n)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}()}),_createClass=unwrapExports(createClass),Builder=function(){function e(t,r){_classCallCheck(this,e),this.checks=[],this.currentConfig={},this.errorMessage="",this.isNullable=!1,this.isRequired=!1,this.defaultValue=r,this.type=t,this.addCheck(this.checkTypeOf)}return _createClass(e,[{key:"addCheck",value:function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];return this.checks.push({args:r,func:e}),this}},{key:"checkOnly",value:function(e,t){}},{key:"checkTypeOf",value:function(e,t){}},{key:"invariant",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]}},{key:"message",value:function(e){return this.errorMessage=e,this}},{key:"nullable",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.isNullable=e,this}},{key:"only",value:function(){return this.addCheck(this.checkOnly)}},{key:"required",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.isRequired=e,this}},{key:"runChecks",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.currentConfig=r;var o=t;return void 0===o&&(this.isRequired||(o=this.defaultValue)),null===o&&this.isNullable,o}}]),e}();_objectSap("getPrototypeOf",function(){return function(e){return _objectGpo(_toObject(e))}});var getPrototypeOf$1=_core.Object.getPrototypeOf,getPrototypeOf=createCommonjsModule(function(e){e.exports={default:getPrototypeOf$1,__esModule:!0}}),_Object$getPrototypeOf=unwrapExports(getPrototypeOf),possibleConstructorReturn=createCommonjsModule(function(e,t){t.__esModule=!0;var r=function(e){return e&&e.__esModule?e:{default:e}}(_typeof_1);t.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==(void 0===t?"undefined":(0,r.default)(t))&&"function"!=typeof t?e:t}}),_possibleConstructorReturn=unwrapExports(possibleConstructorReturn),check=function(e,t){if(_anObject(e),!_isObject(t)&&null!==t)throw TypeError(t+": can't set as prototype!")},_setProto={set:Object.setPrototypeOf||("__proto__"in{}?function(e,t,r){try{(r=_ctx(Function.call,_objectGopd.f(Object.prototype,"__proto__").set,2))(e,[]),t=!(e instanceof Array)}catch(e){t=!0}return function(e,o){return check(e,o),t?e.__proto__=o:r(e,o),e}}({},!1):void 0),check:check};_export(_export.S,"Object",{setPrototypeOf:_setProto.set});var setPrototypeOf$2=_core.Object.setPrototypeOf,setPrototypeOf=createCommonjsModule(function(e){e.exports={default:setPrototypeOf$2,__esModule:!0}});_export(_export.S,"Object",{create:_objectCreate});var $Object$1=_core.Object,create$2=function(e,t){return $Object$1.create(e,t)},create=createCommonjsModule(function(e){e.exports={default:create$2,__esModule:!0}}),inherits=createCommonjsModule(function(e,t){function r(e){return e&&e.__esModule?e:{default:e}}t.__esModule=!0;var o=r(setPrototypeOf),n=r(create),i=r(_typeof_1);t.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+(void 0===t?"undefined":(0,i.default)(t)));e.prototype=(0,n.default)(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(o.default?(0,o.default)(e,t):e.__proto__=t)}}),_inherits=unwrapExports(inherits),ArrayBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"array",r));return o.addCheck(o.checkContents,e),o}return _inherits(t,e),_createClass(t,[{key:"checkContents",value:function(e,t,r){}},{key:"notEmpty",value:function(){return this.addCheck(this.checkNotEmpty)}},{key:"checkNotEmpty",value:function(e,t){}}]),t}(Builder),BoolBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"boolean",e))}return _inherits(t,e),t}(Builder),CustomBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"custom",r));return o.addCheck(o.checkCallback,e),o}return _inherits(t,e),_createClass(t,[{key:"checkCallback",value:function(e,t,r){r.call(this,e,t)}}]),t}(Builder),FuncBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"function",e));return r.nullable(),r}return _inherits(t,e),t}(Builder),InstanceBuilder=function(e){function t(e){_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"instance",null));return r.nullable(),r.refClass=e,r.addCheck(r.checkInstance,e),r}return _inherits(t,e),_createClass(t,[{key:"checkInstance",value:function(e,t,r){}}]),t}(Builder),NumberBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return _classCallCheck(this,t),_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"number",e))}return _inherits(t,e),_createClass(t,[{key:"between",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.addCheck(this.checkBetween,e,t,r)}},{key:"checkBetween",value:function(e,t,r,o){arguments.length>4&&void 0!==arguments[4]&&arguments[4]}},{key:"oneOf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.addCheck(this.checkOneOf,e)}},{key:"checkOneOf",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]}}]),t}(Builder),ObjectBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"object",r));return o.addCheck(o.checkContents,e),o}return _inherits(t,e),_createClass(t,[{key:"checkContents",value:function(e,t,r){}},{key:"notEmpty",value:function(){return this.addCheck(this.checkNotEmpty)}},{key:"checkNotEmpty",value:function(e,t){}}]),t}(Builder),ShapeBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"shape",r));return o.addCheck(o.checkContents,e),o}return _inherits(t,e),_createClass(t,[{key:"checkContents",value:function(e,t,r){}}]),t}(Builder),StringBuilder=function(e){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";_classCallCheck(this,t);var r=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"string",e));return r.allowEmpty=!1,r.addCheck(r.checkNotEmpty),r}return _inherits(t,e),_createClass(t,[{key:"contains",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.addCheck(this.checkContains,e,t)}},{key:"checkContains",value:function(e,t,r){arguments.length>3&&void 0!==arguments[3]&&arguments[3]}},{key:"match",value:function(e){return this.addCheck(this.checkMatch,e)}},{key:"checkMatch",value:function(e,t,r){}},{key:"empty",value:function(){return this.allowEmpty=!0,this}},{key:"checkNotEmpty",value:function(e,t){}},{key:"oneOf",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.addCheck(this.checkOneOf,e)}},{key:"checkOneOf",value:function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2]}}]),t}(Builder),UnionBuilder=function(e){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;_classCallCheck(this,t);var o=_possibleConstructorReturn(this,(t.__proto__||_Object$getPrototypeOf(t)).call(this,"union",r));return o.addCheck(o.checkUnions,e),o}return _inherits(t,e),_createClass(t,[{key:"checkUnions",value:function(e,t,r){}}]),t}(Builder);module.exports=Options; |
@@ -37,3 +37,7 @@ 'use strict'; | ||
(0, _classCallCheck3.default)(this, FuncBuilder); | ||
return (0, _possibleConstructorReturn3.default)(this, (FuncBuilder.__proto__ || (0, _getPrototypeOf2.default)(FuncBuilder)).call(this, 'function', defaultValue)); | ||
var _this = (0, _possibleConstructorReturn3.default)(this, (FuncBuilder.__proto__ || (0, _getPrototypeOf2.default)(FuncBuilder)).call(this, 'function', defaultValue)); | ||
_this.nullable(); | ||
return _this; | ||
} | ||
@@ -40,0 +44,0 @@ |
@@ -45,2 +45,4 @@ 'use strict'; | ||
_this.nullable(); | ||
if ("production" !== process.env.NODE_ENV) { | ||
@@ -47,0 +49,0 @@ _this.invariant(typeof refClass === 'function', 'A class reference is required.'); |
@@ -49,7 +49,3 @@ 'use strict'; | ||
(0, _classCallCheck3.default)(this, NumberBuilder); | ||
var _this = (0, _possibleConstructorReturn3.default)(this, (NumberBuilder.__proto__ || (0, _getPrototypeOf2.default)(NumberBuilder)).call(this, 'number', defaultValue)); | ||
_this.required(); | ||
return _this; | ||
return (0, _possibleConstructorReturn3.default)(this, (NumberBuilder.__proto__ || (0, _getPrototypeOf2.default)(NumberBuilder)).call(this, 'number', defaultValue)); | ||
} | ||
@@ -56,0 +52,0 @@ |
@@ -72,5 +72,7 @@ 'use strict'; | ||
if ("production" !== process.env.NODE_ENV) { | ||
(0, _keys2.default)(object).forEach(function (key) { | ||
if (contents[key]) { | ||
contents[key].runChecks(path + '.' + key, object[key]); | ||
(0, _keys2.default)(contents).forEach(function (key) { | ||
var builder = contents[key]; | ||
if (builder.isRequired || typeof object[key] !== 'undefined') { | ||
builder.runChecks(path + '.' + key, object[key]); | ||
} | ||
@@ -77,0 +79,0 @@ }); |
@@ -54,4 +54,2 @@ 'use strict'; | ||
_this.required(); | ||
_this.addCheck(_this.checkNotEmpty); | ||
@@ -58,0 +56,0 @@ return _this; |
@@ -38,3 +38,4 @@ declare module 'optimal' { | ||
errorMessage: string; | ||
nullable: boolean; | ||
isNullable: boolean; | ||
isRequired: boolean; | ||
type: SupportedType; | ||
@@ -46,4 +47,5 @@ | ||
message(message: string): this; | ||
nullable(state: boolean): this; | ||
only(): this; | ||
required(): this; | ||
required(state: boolean): this; | ||
runChecks(path: string, initialValue: *, config: Config): *; | ||
@@ -50,0 +52,0 @@ } |
{ | ||
"name": "optimal", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Options object builder and validator.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -12,5 +12,2 @@ /** | ||
super('boolean', defaultValue); | ||
// Only allow booleans | ||
this.required(); | ||
} | ||
@@ -17,0 +14,0 @@ } |
@@ -19,3 +19,4 @@ /** | ||
errorMessage: string = ''; | ||
nullable: boolean = true; | ||
isNullable: boolean = false; | ||
isRequired: boolean = false; | ||
type: SupportedType; | ||
@@ -132,2 +133,11 @@ | ||
/** | ||
* Allow null values. | ||
*/ | ||
nullable(state: boolean = true): this { | ||
this.isNullable = state; | ||
return this; | ||
} | ||
/** | ||
* Mark a field as only the default value can be used. | ||
@@ -148,6 +158,6 @@ */ | ||
/** | ||
* Mark a field as required and disallow nulls. | ||
* Disallow undefined values. | ||
*/ | ||
required(): this { | ||
this.nullable = false; | ||
required(state: boolean = true): this { | ||
this.isRequired = state; | ||
@@ -163,9 +173,24 @@ return this; | ||
const value = (typeof initialValue === 'undefined') ? this.defaultValue : initialValue; | ||
let value = initialValue; | ||
// If nullable, just abort early | ||
if (value === null && this.nullable) { | ||
return value; | ||
// Handle undefined | ||
if (typeof value === 'undefined') { | ||
if (!this.isRequired) { | ||
value = this.defaultValue; | ||
} else if (__DEV__) { | ||
this.invariant(false, 'Field is required and must be defined.', path); | ||
} | ||
} | ||
// Handle null | ||
if (value === null) { | ||
if (this.isNullable) { | ||
return value; | ||
} else if (__DEV__) { | ||
this.invariant(false, 'Null is not allowed.', path); | ||
} | ||
} | ||
// Run all checks against the value | ||
@@ -172,0 +197,0 @@ if (__DEV__) { |
@@ -14,2 +14,5 @@ /** | ||
super('function', defaultValue); | ||
// Nullable by default | ||
this.nullable(); | ||
} | ||
@@ -16,0 +19,0 @@ } |
@@ -15,2 +15,5 @@ /** | ||
// Nullable by default | ||
this.nullable(); | ||
if (__DEV__) { | ||
@@ -17,0 +20,0 @@ this.invariant( |
@@ -16,5 +16,2 @@ /** | ||
super('number', defaultValue); | ||
// Only allow numbers | ||
this.required(); | ||
} | ||
@@ -21,0 +18,0 @@ |
@@ -33,5 +33,8 @@ /** | ||
if (__DEV__) { | ||
Object.keys(object).forEach((key) => { | ||
if (contents[key]) { | ||
contents[key].runChecks(`${path}.${key}`, object[key]); | ||
Object.keys(contents).forEach((key) => { | ||
const builder = contents[key]; | ||
// Properties should be optional by default unless explicitly required | ||
if (builder.isRequired || typeof object[key] !== 'undefined') { | ||
builder.runChecks(`${path}.${key}`, object[key]); | ||
} | ||
@@ -38,0 +41,0 @@ }); |
@@ -19,5 +19,2 @@ /** | ||
// Only allow strings | ||
this.required(); | ||
// Check emptiness | ||
@@ -24,0 +21,0 @@ this.addCheck(this.checkNotEmpty); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
253361
1806
36