superstruct
Advanced tools
Comparing version 0.8.3 to 0.8.4
@@ -72,3 +72,3 @@ function _defineProperty(obj, key, value) { | ||
function isNativeReflectConstruct() { | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
@@ -87,3 +87,3 @@ if (Reflect.construct.sham) return false; | ||
function _construct(Parent, args, Class) { | ||
if (isNativeReflectConstruct()) { | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
@@ -165,2 +165,44 @@ } else { | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { | ||
var it; | ||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
return function () { | ||
if (i >= o.length) return { | ||
done: true | ||
}; | ||
return { | ||
done: false, | ||
value: o[i++] | ||
}; | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
it = o[Symbol.iterator](); | ||
return it.next.bind(it); | ||
} | ||
var toString = Object.prototype.toString; | ||
@@ -234,3 +276,3 @@ | ||
function ctorName(val) { | ||
return val.constructor ? val.constructor.name : null; | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
@@ -625,5 +667,3 @@ | ||
var StructError = | ||
/*#__PURE__*/ | ||
function (_TypeError) { | ||
var StructError = /*#__PURE__*/function (_TypeError) { | ||
_inheritsLoose(StructError, _TypeError); | ||
@@ -657,3 +697,3 @@ | ||
return StructError; | ||
}(_wrapNativeSuper(TypeError)); | ||
}( /*#__PURE__*/_wrapNativeSuper(TypeError)); | ||
@@ -741,3 +781,3 @@ /** | ||
Struct.fail = function (obj) { | ||
return _objectSpread2({}, obj, { | ||
return _objectSpread2(_objectSpread2({}, obj), {}, { | ||
type: 'type' in obj ? obj.type : Struct.type | ||
@@ -861,15 +901,4 @@ }); | ||
} else if (Array.isArray(result) && result.length > 0) { | ||
for (var _iterator = result, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var r = _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(result), _step; !(_step = _iterator()).done;) { | ||
var r = _step.value; | ||
failures.push(Struct.fail(_objectSpread2({ | ||
@@ -980,16 +1009,5 @@ value: value, | ||
for (var _iterator = Structs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(Structs), _step; !(_step = _iterator()).done;) { | ||
var _struct = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _struct = _ref; | ||
var _struct$check = _struct.check(value, branch, path), | ||
@@ -1099,15 +1117,4 @@ fs = _struct$check[0], | ||
for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var k = _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(keys), _step; !(_step = _iterator()).done;) { | ||
var k = _step.value; | ||
var v = value[k]; | ||
@@ -1186,15 +1193,4 @@ var p = path.concat(k); | ||
for (var _iterator = value, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var k = _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(value), _step; !(_step = _iterator()).done;) { | ||
var k = _step.value; | ||
var v = value[k]; | ||
@@ -1316,3 +1312,3 @@ var p = path.concat(k); | ||
var defs = Struct.default(); | ||
value = defs ? _objectSpread2({}, defs, {}, value) : value; | ||
value = defs ? _objectSpread2(_objectSpread2({}, defs), value) : value; | ||
@@ -1506,16 +1502,5 @@ if (kindOf(value) !== 'object') { | ||
for (var _iterator = Structs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(Structs), _step; !(_step = _iterator()).done;) { | ||
var _struct = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _struct = _ref; | ||
var _struct$check = _struct.check(value, branch, path), | ||
@@ -1627,3 +1612,3 @@ fs = _struct$check[0], | ||
struct.Error = settings.error || StructError; | ||
struct.Types = _objectSpread2({}, Types, {}, settings.types); | ||
struct.Types = _objectSpread2(_objectSpread2({}, Types), settings.types); | ||
return struct; | ||
@@ -1630,0 +1615,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "A simple, expressive way to validate data in JavaScript.", | ||
"version": "0.8.3", | ||
"version": "0.8.4", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "repository": "git://github.com/ianstormtaylor/superstruct.git", |
@@ -78,3 +78,3 @@ (function (global, factory) { | ||
function isNativeReflectConstruct() { | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
@@ -93,3 +93,3 @@ if (Reflect.construct.sham) return false; | ||
function _construct(Parent, args, Class) { | ||
if (isNativeReflectConstruct()) { | ||
if (_isNativeReflectConstruct()) { | ||
_construct = Reflect.construct; | ||
@@ -171,2 +171,44 @@ } else { | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _createForOfIteratorHelperLoose(o, allowArrayLike) { | ||
var it; | ||
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { | ||
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { | ||
if (it) o = it; | ||
var i = 0; | ||
return function () { | ||
if (i >= o.length) return { | ||
done: true | ||
}; | ||
return { | ||
done: false, | ||
value: o[i++] | ||
}; | ||
}; | ||
} | ||
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
it = o[Symbol.iterator](); | ||
return it.next.bind(it); | ||
} | ||
var toString = Object.prototype.toString; | ||
@@ -240,3 +282,3 @@ | ||
function ctorName(val) { | ||
return val.constructor ? val.constructor.name : null; | ||
return typeof val.constructor === 'function' ? val.constructor.name : null; | ||
} | ||
@@ -628,5 +670,3 @@ | ||
var StructError = | ||
/*#__PURE__*/ | ||
function (_TypeError) { | ||
var StructError = /*#__PURE__*/function (_TypeError) { | ||
_inheritsLoose(StructError, _TypeError); | ||
@@ -660,3 +700,3 @@ | ||
return StructError; | ||
}(_wrapNativeSuper(TypeError)); | ||
}( /*#__PURE__*/_wrapNativeSuper(TypeError)); | ||
@@ -744,3 +784,3 @@ /** | ||
Struct.fail = function (obj) { | ||
return _objectSpread2({}, obj, { | ||
return _objectSpread2(_objectSpread2({}, obj), {}, { | ||
type: 'type' in obj ? obj.type : Struct.type | ||
@@ -864,15 +904,4 @@ }); | ||
} else if (Array.isArray(result) && result.length > 0) { | ||
for (var _iterator = result, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var r = _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(result), _step; !(_step = _iterator()).done;) { | ||
var r = _step.value; | ||
failures.push(Struct.fail(_objectSpread2({ | ||
@@ -983,16 +1012,5 @@ value: value, | ||
for (var _iterator = Structs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(Structs), _step; !(_step = _iterator()).done;) { | ||
var _struct = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _struct = _ref; | ||
var _struct$check = _struct.check(value, branch, path), | ||
@@ -1102,15 +1120,4 @@ fs = _struct$check[0], | ||
for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var k = _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(keys), _step; !(_step = _iterator()).done;) { | ||
var k = _step.value; | ||
var v = value[k]; | ||
@@ -1189,15 +1196,4 @@ var p = path.concat(k); | ||
for (var _iterator = value, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var k = _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(value), _step; !(_step = _iterator()).done;) { | ||
var k = _step.value; | ||
var v = value[k]; | ||
@@ -1319,3 +1315,3 @@ var p = path.concat(k); | ||
var defs = Struct.default(); | ||
value = defs ? _objectSpread2({}, defs, {}, value) : value; | ||
value = defs ? _objectSpread2(_objectSpread2({}, defs), value) : value; | ||
@@ -1509,16 +1505,5 @@ if (kindOf(value) !== 'object') { | ||
for (var _iterator = Structs, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
for (var _iterator = _createForOfIteratorHelperLoose(Structs), _step; !(_step = _iterator()).done;) { | ||
var _struct = _step.value; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _struct = _ref; | ||
var _struct$check = _struct.check(value, branch, path), | ||
@@ -1630,3 +1615,3 @@ fs = _struct$check[0], | ||
struct.Error = settings.error || StructError; | ||
struct.Types = _objectSpread2({}, Types, {}, settings.types); | ||
struct.Types = _objectSpread2(_objectSpread2({}, Types), settings.types); | ||
return struct; | ||
@@ -1633,0 +1618,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((r=r||self).Superstruct={})}(this,(function(r){"use strict";function t(r,t,n){return t in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function n(r,t){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(r);t&&(e=e.filter((function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.push.apply(n,e)}return n}function e(r){for(var e=1;e<arguments.length;e++){var u=null!=arguments[e]?arguments[e]:{};e%2?n(Object(u),!0).forEach((function(n){t(r,n,u[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(u)):n(Object(u)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(u,t))}))}return r}function u(r){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)})(r)}function a(r,t){return(a=Object.setPrototypeOf||function(r,t){return r.__proto__=t,r})(r,t)}function i(r,t,n){return(i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(r){return!1}}()?Reflect.construct:function(r,t,n){var e=[null];e.push.apply(e,t);var u=new(Function.bind.apply(r,e));return n&&a(u,n.prototype),u}).apply(null,arguments)}function o(r){var t="function"==typeof Map?new Map:void 0;return(o=function(r){if(null===r||(n=r,-1===Function.toString.call(n).indexOf("[native code]")))return r;var n;if("function"!=typeof r)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(r))return t.get(r);t.set(r,e)}function e(){return i(r,arguments,u(this).constructor)}return e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),a(e,r)})(r)}var c=Object.prototype.toString,f=function(r){if(void 0===r)return"undefined";if(null===r)return"null";var t=typeof r;if("boolean"===t)return"boolean";if("string"===t)return"string";if("number"===t)return"number";if("symbol"===t)return"symbol";if("function"===t)return"GeneratorFunction"===l(r)?"generatorfunction":"function";if(function(r){return Array.isArray?Array.isArray(r):r instanceof Array}(r))return"array";if(function(r){if(r.constructor&&"function"==typeof r.constructor.isBuffer)return r.constructor.isBuffer(r);return!1}(r))return"buffer";if(function(r){try{if("number"==typeof r.length&&"function"==typeof r.callee)return!0}catch(r){if(-1!==r.message.indexOf("callee"))return!0}return!1}(r))return"arguments";if(function(r){return r instanceof Date||"function"==typeof r.toDateString&&"function"==typeof r.getDate&&"function"==typeof r.setDate}(r))return"date";if(function(r){return r instanceof Error||"string"==typeof r.message&&r.constructor&&"number"==typeof r.constructor.stackTraceLimit}(r))return"error";if(function(r){return r instanceof RegExp||"string"==typeof r.flags&&"boolean"==typeof r.ignoreCase&&"boolean"==typeof r.multiline&&"boolean"==typeof r.global}(r))return"regexp";switch(l(r)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(r){return"function"==typeof r.throw&&"function"==typeof r.return&&"function"==typeof r.next}(r))return"generator";switch(t=c.call(r)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return t.slice(8,-1).toLowerCase().replace(/\s/g,"")};function l(r){return r.constructor?r.constructor.name:null}var s={any:function(r){return void 0!==r},arguments:function(r){return"arguments"===f(r)},array:function(r){return"array"===f(r)},boolean:function(r){return"boolean"===f(r)},buffer:function(r){return"buffer"===f(r)},date:function(r){return"date"===f(r)&&!isNaN(r)},error:function(r){return"error"===f(r)},float32array:function(r){return"float32array"===f(r)},float64array:function(r){return"float64array"===f(r)},function:function(r){return"function"===f(r)},generatorfunction:function(r){return"generatorfunction"===f(r)},int16array:function(r){return"int16array"===f(r)},int32array:function(r){return"int32array"===f(r)},int8array:function(r){return"int8array"===f(r)},map:function(r){return"map"===f(r)},null:function(r){return"null"===f(r)},number:function(r){return"number"===f(r)},object:function(r){return"object"===f(r)},promise:function(r){return"promise"===f(r)},regexp:function(r){return"regexp"===f(r)},set:function(r){return"set"===f(r)},string:function(r){return"string"===f(r)},symbol:function(r){return"symbol"===f(r)},uint16array:function(r){return"uint16array"===f(r)},uint32array:function(r){return"uint32array"===f(r)},uint8array:function(r){return"uint8array"===f(r)},uint8clampedarray:function(r){return"uint8clampedarray"===f(r)},undefined:function(r){return"undefined"===f(r)},weakmap:function(r){return"weakmap"===f(r)},weakset:function(r){return"weakset"===f(r)}},p="Invariant failed";function y(r,t){if(!r)throw new Error(p)}var v=function(r){var t,n;function e(t){var n;t.length>0||y(!1);var u=t[0],a=u.path,i=u.value,o=u.type,c=u.branch,f=function(r,t){if(null==r)return{};var n,e,u={},a=Object.keys(r);for(e=0;e<a.length;e++)n=a[e],t.indexOf(n)>=0||(u[n]=r[n]);return u}(u,["path","value","type","branch"]),l="Expected a value of type `"+o+"`"+(a.length?" for `"+a.join(".")+"`":"")+" but received `"+JSON.stringify(i)+"`.";return(n=r.call(this,l)||this).type=o,n.value=i,Object.assign(function(r){if(void 0===r)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}(n),f),n.path=a,n.branch=c,n.failures=t,n.stack=(new Error).stack,n.__proto__=e.prototype,n}return n=r,(t=e).prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n,e}(o(TypeError)),d=Symbol("STRUCT"),h=function(r){return"function"==typeof r&&r[d]},b=function(r){var t=r.struct.Error,n=function r(t){return r.assert(t)};return Object.defineProperty(n,d,{value:!0}),n.kind=r.kind,n.type=r.type,n.default=function(){return"function"==typeof r.defaults?r.defaults():r.defaults},n.test=function(r){return!n.check(r,[r],[])[0]},n.assert=function(r){var e=n.check(r,[r],[]),u=e[0],a=e[1];if(u)throw new t(u);return a},n.validate=function(r){var e=n.check(r,[r],[]),u=e[0],a=e[1];return u?[new t(u)]:[void 0,a]},n.check=function(r,t,e){return void 0===r&&(r=n.default()),[[n.fail({value:r,branch:t,path:e})]]},n.fail=function(r){return e({},r,{type:"type"in r?r.type:n.type})},n},g=function(r,t,n){Array.isArray(r)&&0!==r.length||y(!1);var e=r.map((function(r){return n(r)})),u=e.map((function(r){return r.type})).join(" | "),a=b({kind:"union",type:u,defaults:t,struct:n});return a.check=function(r,t,n){void 0===r&&(r=a.default());var u=e,i=Array.isArray(u),o=0;for(u=i?u:u[Symbol.iterator]();;){var c;if(i){if(o>=u.length)break;c=u[o++]}else{if((o=u.next()).done)break;c=o.value}var f=c.check(r,t,n),l=f[0],s=f[1];if(!l)return[void 0,s]}return[[a.fail({value:r,branch:t,path:n})]]},a},k=function(r){void 0===r&&(r={});var t=function r(t,n){return function(r,t,n){if(h(r))return r;if(Array.isArray(r)){if(1===r.length){var e=r[0];return n.array([e],t)}if(r.length>1)return n.tuple(r,t)}if("function"==typeof r)return n.function(r,t);if("object"==typeof r)return n.object(r,t);if("string"==typeof r){var u,a=!1;if(r.endsWith("?")&&(a=!0,r=r.slice(0,-1)),r.includes("|")){var i=r.split(/\s*\|\s*/g);u=n.union(i,t)}else if(r.includes("&")){var o=r.split(/\s*&\s*/g);u=n.intersection(o,t)}else u=n.scalar(r,t);return a&&(u=n.union([u,"undefined"],void 0)),u}throw new Error("A schema definition must be an object, array, string or function, but you passed: "+r)}(t,n,r)};return t.array=function(r,n){return function(r,t,n){Array.isArray(r)&&1===r.length||y(!1);var e=n(r[0],void 0),u=b({kind:"array",type:e.type+"[]",defaults:t,struct:n});return u.check=function(r,t,n){if(void 0===r&&(r=u.default()),!Array.isArray(r))return[[u.fail({value:r,branch:t,path:n})]];for(var a=[],i=[],o=0;o<r.length;o++){var c=r[o],f=e.check(c,t.concat(c),n.concat(o)),l=f[0],s=f[1];l?i.push.apply(i,l):a[o]=s}return i.length?[i]:[void 0,a]},u}(r,n,t)},t.dynamic=function(r,n){return function(r,t,n){"function"!=typeof r&&y(!1);var e=b({kind:"dynamic",type:"dynamic<…>",defaults:t,struct:n});return e.check=function(t,n,u){return void 0===t&&(t=e.default()),r(t,n,u).check(t,n,u)},e}(r,n,t)},t.enum=function(r,n){return function(r,t,n){Array.isArray(r)||y(!1);var e=n((function(t){return r.includes(t)}),t);return e.kind="enum",e.type=r.map((function(r){return"string"==typeof r?'"'+r+'"':""+r})).join(" | "),e}(r,n,t)},t.function=function(r,n){return function(r,t,n){var u=b({kind:"function",type:"function<…>",defaults:t,struct:n});return u.check=function(t,n,a){void 0===t&&(t=u.default());var i=r(t,n,a);if(!0===i)return[void 0,t];var o=[];if(!1===i)o.push(u.fail({value:t,branch:n,path:a}));else if(Array.isArray(i)&&i.length>0){var c=i,f=Array.isArray(c),l=0;for(c=f?c:c[Symbol.iterator]();;){var s;if(f){if(l>=c.length)break;s=c[l++]}else{if((l=c.next()).done)break;s=l.value}var p=s;o.push(u.fail(e({value:t,branch:n,path:a},p)))}}else"object"==typeof i?o.push(u.fail(e({value:t,branch:n,path:a},i))):y(!1);return[o]},u}(r,n,t)},t.instance=function(r,n){return function(r,t,n){"function"!=typeof r&&y(!1);var e=n((function(t){return t instanceof r}),t);return e.kind="instance",e.type="instance<"+r.name+">",e}(r,n,t)},t.interface=function(r,n){return function(r,t,n){"object"!=typeof r&&y(!1);var e={};for(var u in r)e[u]=n(r[u]);var a=b({kind:"interface",type:"interface<{"+Object.keys(r).join()+"}>",defaults:t,struct:n});return a.check=function(r,t,n){if(void 0===r&&(r=a.default()),"object"!=typeof r&&"function"!=typeof r)return[[a.fail({value:r,branch:t,path:n})]];var u=[];for(var i in e){var o=e[i],c=r[i],f=o.check(c,t.concat(c),n.concat(i))[0];f&&u.push.apply(u,f)}return u.length?[u]:[void 0,r]},a}(r,n,t)},t.intersection=function(r,n){return function(r,t,n){Array.isArray(r)&&0!==r.length||y(!1);var e=r.map((function(r){return n(r)})),u=e.map((function(r){return r.type})).join(" & "),a=b({kind:"intersection",type:u,defaults:t,struct:n});return a.check=function(r,t,n){void 0===r&&(r=a.default());var u=r,i=e,o=Array.isArray(i),c=0;for(i=o?i:i[Symbol.iterator]();;){var f;if(o){if(c>=i.length)break;f=i[c++]}else{if((c=i.next()).done)break;f=c.value}var l=f.check(r,t,n),s=l[0],p=l[1];if(s)return[[a.fail({value:r,branch:t,path:n})]];u=p}return[void 0,u]},a}(r,n,t)},t.lazy=function(r,n){return function(r,t,n){"function"!=typeof r&&y(!1);var e=b({kind:"lazy",type:"lazy<…>",defaults:t,struct:n});return e.check=function(){return Object.assign(e,r()),e.check.apply(e,arguments)},e}(r,n,t)},t.literal=function(r,n){return function(r,t,n){var e=n((function(t){return t===r}),t);return e.kind="literal",e.type="string"==typeof r?'"'+r+'"':""+r,e}(r,n,t)},t.object=function(r,n){return function(r,t,n){"object"!=typeof r&&y(!1);var e={};for(var u in r)e[u]=n(r[u]);var a=b({kind:"object",type:"{"+Object.keys(r).join()+"}",defaults:t,struct:n});return a.check=function(r,t,n){void 0===r&&(r=a.default());var u=a.default();if(void 0===r&&(r=u),"object"!==f(r))return[[a.fail({value:r,branch:t,path:n})]];var i={},o=[],c=new Set(Object.keys(e).concat(Object.keys(r))),l=Array.isArray(c),s=0;for(c=l?c:c[Symbol.iterator]();;){var p;if(l){if(s>=c.length)break;p=c[s++]}else{if((s=c.next()).done)break;p=s.value}var y=p,v=r[y],d=n.concat(y),h=t.concat(v),b=e[y];if(void 0===v&&null!=u&&y in u&&(v="function"==typeof u[y]?u[y](r,t,n):u[y]),y in e){var g=b.check(v,h,d),k=g[0],m=g[1];k?o.push.apply(o,k):void 0!==m&&y in e&&(i[y]=m)}else o.push(a.fail({type:void 0,value:v,path:d,branch:r}))}return o.length?[o]:[void 0,i]},a}(r,n,t)},t.optional=function(r,n){return g([r,"undefined"],n,t)},t.partial=function(r,n){return function(r,t,n){"object"!=typeof r&&y(!1);var e={};for(var u in r)e[u]=n.union([r[u],"undefined"]);var a=b({kind:"object",type:"{"+Object.keys(r).join()+"}",defaults:t,struct:n});return a.check=function(r,t,n){void 0===r&&(r=a.default());var u=a.default();if(void 0===r&&(r=u),"object"!==f(r))return[[a.fail({value:r,branch:t,path:n})]];var i={},o=[],c=r,l=Array.isArray(c),s=0;for(c=l?c:c[Symbol.iterator]();;){var p;if(l){if(s>=c.length)break;p=c[s++]}else{if((s=c.next()).done)break;p=s.value}var y=p,v=r[y],d=n.concat(y),h=t.concat(v),b=e[y];if(void 0===v&&null!=u&&y in u&&(v="function"==typeof u[y]?u[y](r,t,n):u[y]),y in e){var g=b.check(v,h,d),k=g[0],m=g[1];k?o.push.apply(o,k):void 0!==m&&y in e&&(i[y]=m)}else o.push(a.fail({type:void 0,value:v,path:d,branch:r}))}return o.length?[o]:[void 0,i]},a}(r,n,t)},t.pick=function(r,n){return function(r,t,n){"object"!=typeof r&&y(!1);var e={};for(var u in r)e[u]=n(r[u]);var a=b({kind:"pick",type:"pick<{"+Object.keys(r).join()+"}>",defaults:t,struct:n});return a.check=function(r,t,n){void 0===r&&(r=a.default());var u=a.default();if(void 0===r&&(r=u),"object"!==f(r))return[[a.fail({value:r,branch:t,path:n})]];var i={},o=[];for(var c in e){var l=r[c],s=n.concat(c),p=t.concat(l),y=e[c];void 0===l&&null!=u&&c in u&&(l="function"==typeof u[c]?u[c](r,t,n):u[c]);var v=y.check(l,p,s),d=v[0],h=v[1];d?o.push.apply(o,d):void 0!==h&&c in e&&(i[c]=h)}return o.length?[o]:[void 0,i]},a}(r,n,t)},t.record=function(r,n){return function(r,t,n){Array.isArray(r)&&2===r.length||y(!1);var u=n(r[0]),a=n(r[1]),i=b({kind:"record",type:"record<"+u.type+","+a.type+">",defaults:t,struct:n});return i.check=function(r,t,n){var o=i.default();if(r=o?e({},o,{},r):r,"object"!==f(r))return[[i.fail({value:r,branch:t,path:n})]];var c={},l=[];for(var s in r){var p=r[s],y=n.concat(s),v=t.concat(p),d=u.check(s,v,y),h=d[0],b=d[1];if(h)l.push.apply(l,h);else{var g=a.check(p,v,y),k=g[0],m=g[1];k?l.push.apply(l,k):c[b]=m}}return l.length?[l]:[void 0,c]},i}(r,n,t)},t.scalar=function(r,n){return function(r,t,n){"string"!=typeof r&&y(!1);var e=n.Types;r in e||y(!1);var u=n(e[r],t);return u.kind="scalar",u.type=r,u}(r,n,t)},t.size=function(r,n){return function(r,t,n){Array.isArray(r)&&2===r.length&&r.every((function(r){return"number"==typeof r}))||y(!1);var e=r[0],u=r[1],a=n((function(r){return null!=r&&"number"==typeof r.length&&r.length>=e&&r.length<=u}),t);return a.kind="size",a.type="size<"+e+","+u+">",a}(r,n,t)},t.tuple=function(r,n){return function(r,t,n){Array.isArray(r)||y(!1);var e=r.map((function(r){return n(r)})),u=b({kind:"tuple",type:"["+e.map((function(r){return r.type})).join()+"]",defaults:t,struct:n});return u.check=function(r,t,n){if(void 0===r&&(r=u.default()),!Array.isArray(r))return[[u.fail({value:r,branch:t,path:n})]];for(var a=[],i=[],o=Math.max(r.length,e.length),c=0;c<o;c++){var f=e[c],l=r[c],s=n.concat(c),p=t.concat(l);if(f){var y=f.check(l,p,s),v=y[0],d=y[1];v?i.push.apply(i,v):a[c]=d}else i.push(u.fail({type:void 0,value:l,path:s,branch:p}))}return i.length?[i]:[void 0,a]},u}(r,n,t)},t.union=function(r,n){return g(r,n,t)},t.Error=r.error||v,t.Types=e({},s,{},r.types),t},m=k();r.StructError=v,r.Types=s,r.isStruct=h,r.struct=m,r.superstruct=k,Object.defineProperty(r,"__esModule",{value:!0})})); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t=t||self).Superstruct={})}(this,(function(t){"use strict";function r(t,r,n){return r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function n(t,r){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);r&&(e=e.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),n.push.apply(n,e)}return n}function e(t){for(var e=1;e<arguments.length;e++){var u=null!=arguments[e]?arguments[e]:{};e%2?n(Object(u),!0).forEach((function(n){r(t,n,u[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(u)):n(Object(u)).forEach((function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(u,r))}))}return t}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function o(t,r){return(o=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t})(t,r)}function a(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function i(t,r,n){return(i=a()?Reflect.construct:function(t,r,n){var e=[null];e.push.apply(e,r);var u=new(Function.bind.apply(t,e));return n&&o(u,n.prototype),u}).apply(null,arguments)}function c(t){var r="function"==typeof Map?new Map:void 0;return(c=function(t){if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;var n;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(t))return r.get(t);r.set(t,e)}function e(){return i(t,arguments,u(this).constructor)}return e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),o(e,t)})(t)}function f(t,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function l(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,r){if(t){if("string"==typeof t)return f(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?f(t,r):void 0}}(t))||r&&t&&"number"==typeof t.length){n&&(t=n);var e=0;return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}var p=Object.prototype.toString,s=function(t){if(void 0===t)return"undefined";if(null===t)return"null";var r=typeof t;if("boolean"===r)return"boolean";if("string"===r)return"string";if("number"===r)return"number";if("symbol"===r)return"symbol";if("function"===r)return"GeneratorFunction"===y(t)?"generatorfunction":"function";if(function(t){return Array.isArray?Array.isArray(t):t instanceof Array}(t))return"array";if(function(t){if(t.constructor&&"function"==typeof t.constructor.isBuffer)return t.constructor.isBuffer(t);return!1}(t))return"buffer";if(function(t){try{if("number"==typeof t.length&&"function"==typeof t.callee)return!0}catch(t){if(-1!==t.message.indexOf("callee"))return!0}return!1}(t))return"arguments";if(function(t){return t instanceof Date||"function"==typeof t.toDateString&&"function"==typeof t.getDate&&"function"==typeof t.setDate}(t))return"date";if(function(t){return t instanceof Error||"string"==typeof t.message&&t.constructor&&"number"==typeof t.constructor.stackTraceLimit}(t))return"error";if(function(t){return t instanceof RegExp||"string"==typeof t.flags&&"boolean"==typeof t.ignoreCase&&"boolean"==typeof t.multiline&&"boolean"==typeof t.global}(t))return"regexp";switch(y(t)){case"Symbol":return"symbol";case"Promise":return"promise";case"WeakMap":return"weakmap";case"WeakSet":return"weakset";case"Map":return"map";case"Set":return"set";case"Int8Array":return"int8array";case"Uint8Array":return"uint8array";case"Uint8ClampedArray":return"uint8clampedarray";case"Int16Array":return"int16array";case"Uint16Array":return"uint16array";case"Int32Array":return"int32array";case"Uint32Array":return"uint32array";case"Float32Array":return"float32array";case"Float64Array":return"float64array"}if(function(t){return"function"==typeof t.throw&&"function"==typeof t.return&&"function"==typeof t.next}(t))return"generator";switch(r=p.call(t)){case"[object Object]":return"object";case"[object Map Iterator]":return"mapiterator";case"[object Set Iterator]":return"setiterator";case"[object String Iterator]":return"stringiterator";case"[object Array Iterator]":return"arrayiterator"}return r.slice(8,-1).toLowerCase().replace(/\s/g,"")};function y(t){return"function"==typeof t.constructor?t.constructor.name:null}var v={any:function(t){return void 0!==t},arguments:function(t){return"arguments"===s(t)},array:function(t){return"array"===s(t)},boolean:function(t){return"boolean"===s(t)},buffer:function(t){return"buffer"===s(t)},date:function(t){return"date"===s(t)&&!isNaN(t)},error:function(t){return"error"===s(t)},float32array:function(t){return"float32array"===s(t)},float64array:function(t){return"float64array"===s(t)},function:function(t){return"function"===s(t)},generatorfunction:function(t){return"generatorfunction"===s(t)},int16array:function(t){return"int16array"===s(t)},int32array:function(t){return"int32array"===s(t)},int8array:function(t){return"int8array"===s(t)},map:function(t){return"map"===s(t)},null:function(t){return"null"===s(t)},number:function(t){return"number"===s(t)},object:function(t){return"object"===s(t)},promise:function(t){return"promise"===s(t)},regexp:function(t){return"regexp"===s(t)},set:function(t){return"set"===s(t)},string:function(t){return"string"===s(t)},symbol:function(t){return"symbol"===s(t)},uint16array:function(t){return"uint16array"===s(t)},uint32array:function(t){return"uint32array"===s(t)},uint8array:function(t){return"uint8array"===s(t)},uint8clampedarray:function(t){return"uint8clampedarray"===s(t)},undefined:function(t){return"undefined"===s(t)},weakmap:function(t){return"weakmap"===s(t)},weakset:function(t){return"weakset"===s(t)}};function d(t,r){if(!t)throw new Error("Invariant failed")}var h=function(t){var r,n;function e(r){var n;r.length>0||d(!1);var u=r[0],o=u.path,a=u.value,i=u.type,c=u.branch,f=function(t,r){if(null==t)return{};var n,e,u={},o=Object.keys(t);for(e=0;e<o.length;e++)n=o[e],r.indexOf(n)>=0||(u[n]=t[n]);return u}(u,["path","value","type","branch"]),l="Expected a value of type `"+i+"`"+(o.length?" for `"+o.join(".")+"`":"")+" but received `"+JSON.stringify(a)+"`.";return(n=t.call(this,l)||this).type=i,n.value=a,Object.assign(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(n),f),n.path=o,n.branch=c,n.failures=r,n.stack=(new Error).stack,n.__proto__=e.prototype,n}return n=t,(r=e).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n,e}(c(TypeError)),b=Symbol("STRUCT"),g=function(t){return"function"==typeof t&&t[b]},m=function(t){var r=t.struct.Error,n=function t(r){return t.assert(r)};return Object.defineProperty(n,b,{value:!0}),n.kind=t.kind,n.type=t.type,n.default=function(){return"function"==typeof t.defaults?t.defaults():t.defaults},n.test=function(t){return!n.check(t,[t],[])[0]},n.assert=function(t){var e=n.check(t,[t],[]),u=e[0],o=e[1];if(u)throw new r(u);return o},n.validate=function(t){var e=n.check(t,[t],[]),u=e[0],o=e[1];return u?[new r(u)]:[void 0,o]},n.check=function(t,r,e){return void 0===t&&(t=n.default()),[[n.fail({value:t,branch:r,path:e})]]},n.fail=function(t){return e(e({},t),{},{type:"type"in t?t.type:n.type})},n},k=function(t,r,n){Array.isArray(t)&&0!==t.length||d(!1);var e=t.map((function(t){return n(t)})),u=e.map((function(t){return t.type})).join(" | "),o=m({kind:"union",type:u,defaults:r,struct:n});return o.check=function(t,r,n){void 0===t&&(t=o.default());for(var u,a=l(e);!(u=a()).done;){var i=u.value.check(t,r,n),c=i[0],f=i[1];if(!c)return[void 0,f]}return[[o.fail({value:t,branch:r,path:n})]]},o},j=function(t){void 0===t&&(t={});var r=function t(r,n){return function(t,r,n){if(g(t))return t;if(Array.isArray(t)){if(1===t.length){var e=t[0];return n.array([e],r)}if(t.length>1)return n.tuple(t,r)}if("function"==typeof t)return n.function(t,r);if("object"==typeof t)return n.object(t,r);if("string"==typeof t){var u,o=!1;if(t.endsWith("?")&&(o=!0,t=t.slice(0,-1)),t.includes("|")){var a=t.split(/\s*\|\s*/g);u=n.union(a,r)}else if(t.includes("&")){var i=t.split(/\s*&\s*/g);u=n.intersection(i,r)}else u=n.scalar(t,r);return o&&(u=n.union([u,"undefined"],void 0)),u}throw new Error("A schema definition must be an object, array, string or function, but you passed: "+t)}(r,n,t)};return r.array=function(t,n){return function(t,r,n){Array.isArray(t)&&1===t.length||d(!1);var e=n(t[0],void 0),u=m({kind:"array",type:e.type+"[]",defaults:r,struct:n});return u.check=function(t,r,n){if(void 0===t&&(t=u.default()),!Array.isArray(t))return[[u.fail({value:t,branch:r,path:n})]];for(var o=[],a=[],i=0;i<t.length;i++){var c=t[i],f=e.check(c,r.concat(c),n.concat(i)),l=f[0],p=f[1];l?a.push.apply(a,l):o[i]=p}return a.length?[a]:[void 0,o]},u}(t,n,r)},r.dynamic=function(t,n){return function(t,r,n){"function"!=typeof t&&d(!1);var e=m({kind:"dynamic",type:"dynamic<…>",defaults:r,struct:n});return e.check=function(r,n,u){return void 0===r&&(r=e.default()),t(r,n,u).check(r,n,u)},e}(t,n,r)},r.enum=function(t,n){return function(t,r,n){Array.isArray(t)||d(!1);var e=n((function(r){return t.includes(r)}),r);return e.kind="enum",e.type=t.map((function(t){return"string"==typeof t?'"'+t+'"':""+t})).join(" | "),e}(t,n,r)},r.function=function(t,n){return function(t,r,n){var u=m({kind:"function",type:"function<…>",defaults:r,struct:n});return u.check=function(r,n,o){void 0===r&&(r=u.default());var a=t(r,n,o);if(!0===a)return[void 0,r];var i=[];if(!1===a)i.push(u.fail({value:r,branch:n,path:o}));else if(Array.isArray(a)&&a.length>0)for(var c,f=l(a);!(c=f()).done;){var p=c.value;i.push(u.fail(e({value:r,branch:n,path:o},p)))}else"object"==typeof a?i.push(u.fail(e({value:r,branch:n,path:o},a))):d(!1);return[i]},u}(t,n,r)},r.instance=function(t,n){return function(t,r,n){"function"!=typeof t&&d(!1);var e=n((function(r){return r instanceof t}),r);return e.kind="instance",e.type="instance<"+t.name+">",e}(t,n,r)},r.interface=function(t,n){return function(t,r,n){"object"!=typeof t&&d(!1);var e={};for(var u in t)e[u]=n(t[u]);var o=m({kind:"interface",type:"interface<{"+Object.keys(t).join()+"}>",defaults:r,struct:n});return o.check=function(t,r,n){if(void 0===t&&(t=o.default()),"object"!=typeof t&&"function"!=typeof t)return[[o.fail({value:t,branch:r,path:n})]];var u=[];for(var a in e){var i=e[a],c=t[a],f=i.check(c,r.concat(c),n.concat(a))[0];f&&u.push.apply(u,f)}return u.length?[u]:[void 0,t]},o}(t,n,r)},r.intersection=function(t,n){return function(t,r,n){Array.isArray(t)&&0!==t.length||d(!1);var e=t.map((function(t){return n(t)})),u=e.map((function(t){return t.type})).join(" & "),o=m({kind:"intersection",type:u,defaults:r,struct:n});return o.check=function(t,r,n){void 0===t&&(t=o.default());for(var u,a=t,i=l(e);!(u=i()).done;){var c=u.value.check(t,r,n),f=c[0],p=c[1];if(f)return[[o.fail({value:t,branch:r,path:n})]];a=p}return[void 0,a]},o}(t,n,r)},r.lazy=function(t,n){return function(t,r,n){"function"!=typeof t&&d(!1);var e=m({kind:"lazy",type:"lazy<…>",defaults:r,struct:n});return e.check=function(){return Object.assign(e,t()),e.check.apply(e,arguments)},e}(t,n,r)},r.literal=function(t,n){return function(t,r,n){var e=n((function(r){return r===t}),r);return e.kind="literal",e.type="string"==typeof t?'"'+t+'"':""+t,e}(t,n,r)},r.object=function(t,n){return function(t,r,n){"object"!=typeof t&&d(!1);var e={};for(var u in t)e[u]=n(t[u]);var o=m({kind:"object",type:"{"+Object.keys(t).join()+"}",defaults:r,struct:n});return o.check=function(t,r,n){void 0===t&&(t=o.default());var u=o.default();if(void 0===t&&(t=u),"object"!==s(t))return[[o.fail({value:t,branch:r,path:n})]];for(var a,i={},c=[],f=l(new Set(Object.keys(e).concat(Object.keys(t))));!(a=f()).done;){var p=a.value,y=t[p],v=n.concat(p),d=r.concat(y),h=e[p];if(void 0===y&&null!=u&&p in u&&(y="function"==typeof u[p]?u[p](t,r,n):u[p]),p in e){var b=h.check(y,d,v),g=b[0],m=b[1];g?c.push.apply(c,g):void 0!==m&&p in e&&(i[p]=m)}else c.push(o.fail({type:void 0,value:y,path:v,branch:t}))}return c.length?[c]:[void 0,i]},o}(t,n,r)},r.optional=function(t,n){return k([t,"undefined"],n,r)},r.partial=function(t,n){return function(t,r,n){"object"!=typeof t&&d(!1);var e={};for(var u in t)e[u]=n.union([t[u],"undefined"]);var o=m({kind:"object",type:"{"+Object.keys(t).join()+"}",defaults:r,struct:n});return o.check=function(t,r,n){void 0===t&&(t=o.default());var u=o.default();if(void 0===t&&(t=u),"object"!==s(t))return[[o.fail({value:t,branch:r,path:n})]];for(var a,i={},c=[],f=l(t);!(a=f()).done;){var p=a.value,y=t[p],v=n.concat(p),d=r.concat(y),h=e[p];if(void 0===y&&null!=u&&p in u&&(y="function"==typeof u[p]?u[p](t,r,n):u[p]),p in e){var b=h.check(y,d,v),g=b[0],m=b[1];g?c.push.apply(c,g):void 0!==m&&p in e&&(i[p]=m)}else c.push(o.fail({type:void 0,value:y,path:v,branch:t}))}return c.length?[c]:[void 0,i]},o}(t,n,r)},r.pick=function(t,n){return function(t,r,n){"object"!=typeof t&&d(!1);var e={};for(var u in t)e[u]=n(t[u]);var o=m({kind:"pick",type:"pick<{"+Object.keys(t).join()+"}>",defaults:r,struct:n});return o.check=function(t,r,n){void 0===t&&(t=o.default());var u=o.default();if(void 0===t&&(t=u),"object"!==s(t))return[[o.fail({value:t,branch:r,path:n})]];var a={},i=[];for(var c in e){var f=t[c],l=n.concat(c),p=r.concat(f),y=e[c];void 0===f&&null!=u&&c in u&&(f="function"==typeof u[c]?u[c](t,r,n):u[c]);var v=y.check(f,p,l),d=v[0],h=v[1];d?i.push.apply(i,d):void 0!==h&&c in e&&(a[c]=h)}return i.length?[i]:[void 0,a]},o}(t,n,r)},r.record=function(t,n){return function(t,r,n){Array.isArray(t)&&2===t.length||d(!1);var u=n(t[0]),o=n(t[1]),a=m({kind:"record",type:"record<"+u.type+","+o.type+">",defaults:r,struct:n});return a.check=function(t,r,n){var i=a.default();if(t=i?e(e({},i),t):t,"object"!==s(t))return[[a.fail({value:t,branch:r,path:n})]];var c={},f=[];for(var l in t){var p=t[l],y=n.concat(l),v=r.concat(p),d=u.check(l,v,y),h=d[0],b=d[1];if(h)f.push.apply(f,h);else{var g=o.check(p,v,y),m=g[0],k=g[1];m?f.push.apply(f,m):c[b]=k}}return f.length?[f]:[void 0,c]},a}(t,n,r)},r.scalar=function(t,n){return function(t,r,n){"string"!=typeof t&&d(!1);var e=n.Types;t in e||d(!1);var u=n(e[t],r);return u.kind="scalar",u.type=t,u}(t,n,r)},r.size=function(t,n){return function(t,r,n){Array.isArray(t)&&2===t.length&&t.every((function(t){return"number"==typeof t}))||d(!1);var e=t[0],u=t[1],o=n((function(t){return null!=t&&"number"==typeof t.length&&t.length>=e&&t.length<=u}),r);return o.kind="size",o.type="size<"+e+","+u+">",o}(t,n,r)},r.tuple=function(t,n){return function(t,r,n){Array.isArray(t)||d(!1);var e=t.map((function(t){return n(t)})),u=m({kind:"tuple",type:"["+e.map((function(t){return t.type})).join()+"]",defaults:r,struct:n});return u.check=function(t,r,n){if(void 0===t&&(t=u.default()),!Array.isArray(t))return[[u.fail({value:t,branch:r,path:n})]];for(var o=[],a=[],i=Math.max(t.length,e.length),c=0;c<i;c++){var f=e[c],l=t[c],p=n.concat(c),s=r.concat(l);if(f){var y=f.check(l,s,p),v=y[0],d=y[1];v?a.push.apply(a,v):o[c]=d}else a.push(u.fail({type:void 0,value:l,path:p,branch:s}))}return a.length?[a]:[void 0,o]},u}(t,n,r)},r.union=function(t,n){return k(t,n,r)},r.Error=t.error||h,r.Types=e(e({},v),t.types),r},O=j();t.StructError=h,t.Types=v,t.isStruct=g,t.struct=O,t.superstruct=j,Object.defineProperty(t,"__esModule",{value:!0})})); |
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
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
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
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
88
415390
6250