Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

superstruct

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

superstruct - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

docs/api-reference.md

2

dist/superstruct.min.js
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Superstruct=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}if(val===null)return"null";if(val===undefined)return"undefined";if(val!==val)return"nan";if(val&&val.nodeType===1)return"element";if(isBuffer(val))return"buffer";val=val.valueOf?val.valueOf():Object.prototype.valueOf.apply(val);return typeof val};function isBuffer(obj){return!!(obj!=null&&(obj._isBuffer||obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)))}},{}],2:[function(require,module,exports){var getNative=require("./_getNative"),root=require("./_root");var DataView=getNative(root,"DataView");module.exports=DataView},{"./_getNative":54,"./_root":90}],3:[function(require,module,exports){var hashClear=require("./_hashClear"),hashDelete=require("./_hashDelete"),hashGet=require("./_hashGet"),hashHas=require("./_hashHas"),hashSet=require("./_hashSet");function Hash(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}Hash.prototype.clear=hashClear;Hash.prototype["delete"]=hashDelete;Hash.prototype.get=hashGet;Hash.prototype.has=hashHas;Hash.prototype.set=hashSet;module.exports=Hash},{"./_hashClear":61,"./_hashDelete":62,"./_hashGet":63,"./_hashHas":64,"./_hashSet":65}],4:[function(require,module,exports){var listCacheClear=require("./_listCacheClear"),listCacheDelete=require("./_listCacheDelete"),listCacheGet=require("./_listCacheGet"),listCacheHas=require("./_listCacheHas"),listCacheSet=require("./_listCacheSet");function ListCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}ListCache.prototype.clear=listCacheClear;ListCache.prototype["delete"]=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;module.exports=ListCache},{"./_listCacheClear":73,"./_listCacheDelete":74,"./_listCacheGet":75,"./_listCacheHas":76,"./_listCacheSet":77}],5:[function(require,module,exports){var getNative=require("./_getNative"),root=require("./_root");var Map=getNative(root,"Map");module.exports=Map},{"./_getNative":54,"./_root":90}],6:[function(require,module,exports){var mapCacheClear=require("./_mapCacheClear"),mapCacheDelete=require("./_mapCacheDelete"),mapCacheGet=require("./_mapCacheGet"),mapCacheHas=require("./_mapCacheHas"),mapCacheSet=require("./_mapCacheSet");function MapCache(entries){var index=-1,length=entries==null?0:entries.length;this.clear();while(++index<length){var entry=entries[index];this.set(entry[0],entry[1])}}MapCache.prototype.clear=mapCacheClear;MapCache.prototype["delete"]=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;module.exports=MapCache},{"./_mapCacheClear":78,"./_mapCacheDelete":79,"./_mapCacheGet":80,"./_mapCacheHas":81,"./_mapCacheSet":82}],7:[function(require,module,exports){var getNative=require("./_getNative"),root=require("./_root");var Promise=getNative(root,"Promise");module.exports=Promise},{"./_getNative":54,"./_root":90}],8:[function(require,module,exports){var getNative=require("./_getNative"),root=require("./_root");var Set=getNative(root,"Set");module.exports=Set},{"./_getNative":54,"./_root":90}],9:[function(require,module,exports){var ListCache=require("./_ListCache"),stackClear=require("./_stackClear"),stackDelete=require("./_stackDelete"),stackGet=require("./_stackGet"),stackHas=require("./_stackHas"),stackSet=require("./_stackSet");function Stack(entries){var data=this.__data__=new ListCache(entries);this.size=data.size}Stack.prototype.clear=stackClear;Stack.prototype["delete"]=stackDelete;Stack.prototype.get=stackGet;Stack.prototype.has=stackHas;Stack.prototype.set=stackSet;module.exports=Stack},{"./_ListCache":4,"./_stackClear":92,"./_stackDelete":93,"./_stackGet":94,"./_stackHas":95,"./_stackSet":96}],10:[function(require,module,exports){var root=require("./_root");var Symbol=root.Symbol;module.exports=Symbol},{"./_root":90}],11:[function(require,module,exports){var root=require("./_root");var Uint8Array=root.Uint8Array;module.exports=Uint8Array},{"./_root":90}],12:[function(require,module,exports){var getNative=require("./_getNative"),root=require("./_root");var WeakMap=getNative(root,"WeakMap");module.exports=WeakMap},{"./_getNative":54,"./_root":90}],13:[function(require,module,exports){function addMapEntry(map,pair){map.set(pair[0],pair[1]);return map}module.exports=addMapEntry},{}],14:[function(require,module,exports){function addSetEntry(set,value){set.add(value);return set}module.exports=addSetEntry},{}],15:[function(require,module,exports){function arrayEach(array,iteratee){var index=-1,length=array==null?0:array.length;while(++index<length){if(iteratee(array[index],index,array)===false){break}}return array}module.exports=arrayEach},{}],16:[function(require,module,exports){function arrayFilter(array,predicate){var index=-1,length=array==null?0:array.length,resIndex=0,result=[];while(++index<length){var value=array[index];if(predicate(value,index,array)){result[resIndex++]=value}}return result}module.exports=arrayFilter},{}],17:[function(require,module,exports){var baseTimes=require("./_baseTimes"),isArguments=require("./isArguments"),isArray=require("./isArray"),isBuffer=require("./isBuffer"),isIndex=require("./_isIndex"),isTypedArray=require("./isTypedArray");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function arrayLikeKeys(value,inherited){var isArr=isArray(value),isArg=!isArr&&isArguments(value),isBuff=!isArr&&!isArg&&isBuffer(value),isType=!isArr&&!isArg&&!isBuff&&isTypedArray(value),skipIndexes=isArr||isArg||isBuff||isType,result=skipIndexes?baseTimes(value.length,String):[],length=result.length;for(var key in value){if((inherited||hasOwnProperty.call(value,key))&&!(skipIndexes&&(key=="length"||isBuff&&(key=="offset"||key=="parent")||isType&&(key=="buffer"||key=="byteLength"||key=="byteOffset")||isIndex(key,length)))){result.push(key)}}return result}module.exports=arrayLikeKeys},{"./_baseTimes":34,"./_isIndex":69,"./isArguments":100,"./isArray":101,"./isBuffer":103,"./isTypedArray":108}],18:[function(require,module,exports){function arrayPush(array,values){var index=-1,length=values.length,offset=array.length;while(++index<length){array[offset+index]=values[index]}return array}module.exports=arrayPush},{}],19:[function(require,module,exports){function arrayReduce(array,iteratee,accumulator,initAccum){var index=-1,length=array==null?0:array.length;if(initAccum&&length){accumulator=array[++index]}while(++index<length){accumulator=iteratee(accumulator,array[index],index,array)}return accumulator}module.exports=arrayReduce},{}],20:[function(require,module,exports){var baseAssignValue=require("./_baseAssignValue"),eq=require("./eq");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function assignValue(object,key,value){var objValue=object[key];if(!(hasOwnProperty.call(object,key)&&eq(objValue,value))||value===undefined&&!(key in object)){baseAssignValue(object,key,value)}}module.exports=assignValue},{"./_baseAssignValue":24,"./eq":99}],21:[function(require,module,exports){var eq=require("./eq");function assocIndexOf(array,key){var length=array.length;while(length--){if(eq(array[length][0],key)){return length}}return-1}module.exports=assocIndexOf},{"./eq":99}],22:[function(require,module,exports){var copyObject=require("./_copyObject"),keys=require("./keys");function baseAssign(object,source){return object&&copyObject(source,keys(source),object)}module.exports=baseAssign},{"./_copyObject":45,"./keys":109}],23:[function(require,module,exports){var copyObject=require("./_copyObject"),keysIn=require("./keysIn");function baseAssignIn(object,source){return object&&copyObject(source,keysIn(source),object)}module.exports=baseAssignIn},{"./_copyObject":45,"./keysIn":110}],24:[function(require,module,exports){var defineProperty=require("./_defineProperty");function baseAssignValue(object,key,value){if(key=="__proto__"&&defineProperty){defineProperty(object,key,{configurable:true,enumerable:true,value:value,writable:true})}else{object[key]=value}}module.exports=baseAssignValue},{"./_defineProperty":49}],25:[function(require,module,exports){var Stack=require("./_Stack"),arrayEach=require("./_arrayEach"),assignValue=require("./_assignValue"),baseAssign=require("./_baseAssign"),baseAssignIn=require("./_baseAssignIn"),cloneBuffer=require("./_cloneBuffer"),copyArray=require("./_copyArray"),copySymbols=require("./_copySymbols"),copySymbolsIn=require("./_copySymbolsIn"),getAllKeys=require("./_getAllKeys"),getAllKeysIn=require("./_getAllKeysIn"),getTag=require("./_getTag"),initCloneArray=require("./_initCloneArray"),initCloneByTag=require("./_initCloneByTag"),initCloneObject=require("./_initCloneObject"),isArray=require("./isArray"),isBuffer=require("./isBuffer"),isObject=require("./isObject"),keys=require("./keys");var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",genTag="[object GeneratorFunction]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var cloneableTags={};cloneableTags[argsTag]=cloneableTags[arrayTag]=cloneableTags[arrayBufferTag]=cloneableTags[dataViewTag]=cloneableTags[boolTag]=cloneableTags[dateTag]=cloneableTags[float32Tag]=cloneableTags[float64Tag]=cloneableTags[int8Tag]=cloneableTags[int16Tag]=cloneableTags[int32Tag]=cloneableTags[mapTag]=cloneableTags[numberTag]=cloneableTags[objectTag]=cloneableTags[regexpTag]=cloneableTags[setTag]=cloneableTags[stringTag]=cloneableTags[symbolTag]=cloneableTags[uint8Tag]=cloneableTags[uint8ClampedTag]=cloneableTags[uint16Tag]=cloneableTags[uint32Tag]=true;cloneableTags[errorTag]=cloneableTags[funcTag]=cloneableTags[weakMapTag]=false;function baseClone(value,bitmask,customizer,key,object,stack){var result,isDeep=bitmask&CLONE_DEEP_FLAG,isFlat=bitmask&CLONE_FLAT_FLAG,isFull=bitmask&CLONE_SYMBOLS_FLAG;if(customizer){result=object?customizer(value,key,object,stack):customizer(value)}if(result!==undefined){return result}if(!isObject(value)){return value}var isArr=isArray(value);if(isArr){result=initCloneArray(value);if(!isDeep){return copyArray(value,result)}}else{var tag=getTag(value),isFunc=tag==funcTag||tag==genTag;if(isBuffer(value)){return cloneBuffer(value,isDeep)}if(tag==objectTag||tag==argsTag||isFunc&&!object){result=isFlat||isFunc?{}:initCloneObject(value);if(!isDeep){return isFlat?copySymbolsIn(value,baseAssignIn(result,value)):copySymbols(value,baseAssign(result,value))}}else{if(!cloneableTags[tag]){return object?value:{}}result=initCloneByTag(value,tag,baseClone,isDeep)}}stack||(stack=new Stack);var stacked=stack.get(value);if(stacked){return stacked}stack.set(value,result);var keysFunc=isFull?isFlat?getAllKeysIn:getAllKeys:isFlat?keysIn:keys;var props=isArr?undefined:keysFunc(value);arrayEach(props||value,function(subValue,key){if(props){key=subValue;subValue=value[key]}assignValue(result,key,baseClone(subValue,bitmask,customizer,key,value,stack))});return result}module.exports=baseClone},{"./_Stack":9,"./_arrayEach":15,"./_assignValue":20,"./_baseAssign":22,"./_baseAssignIn":23,"./_cloneBuffer":37,"./_copyArray":44,"./_copySymbols":46,"./_copySymbolsIn":47,"./_getAllKeys":51,"./_getAllKeysIn":52,"./_getTag":59,"./_initCloneArray":66,"./_initCloneByTag":67,"./_initCloneObject":68,"./isArray":101,"./isBuffer":103,"./isObject":106,"./keys":109}],26:[function(require,module,exports){var isObject=require("./isObject");var objectCreate=Object.create;var baseCreate=function(){function object(){}return function(proto){if(!isObject(proto)){return{}}if(objectCreate){return objectCreate(proto)}object.prototype=proto;var result=new object;object.prototype=undefined;return result}}();module.exports=baseCreate},{"./isObject":106}],27:[function(require,module,exports){var arrayPush=require("./_arrayPush"),isArray=require("./isArray");function baseGetAllKeys(object,keysFunc,symbolsFunc){var result=keysFunc(object);return isArray(object)?result:arrayPush(result,symbolsFunc(object))}module.exports=baseGetAllKeys},{"./_arrayPush":18,"./isArray":101}],28:[function(require,module,exports){var Symbol=require("./_Symbol"),getRawTag=require("./_getRawTag"),objectToString=require("./_objectToString");var nullTag="[object Null]",undefinedTag="[object Undefined]";var symToStringTag=Symbol?Symbol.toStringTag:undefined;function baseGetTag(value){if(value==null){return value===undefined?undefinedTag:nullTag}return symToStringTag&&symToStringTag in Object(value)?getRawTag(value):objectToString(value)}module.exports=baseGetTag},{"./_Symbol":10,"./_getRawTag":56,"./_objectToString":88}],29:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isObjectLike=require("./isObjectLike");var argsTag="[object Arguments]";function baseIsArguments(value){return isObjectLike(value)&&baseGetTag(value)==argsTag}module.exports=baseIsArguments},{"./_baseGetTag":28,"./isObjectLike":107}],30:[function(require,module,exports){var isFunction=require("./isFunction"),isMasked=require("./_isMasked"),isObject=require("./isObject"),toSource=require("./_toSource");var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var funcProto=Function.prototype,objectProto=Object.prototype;var funcToString=funcProto.toString;var hasOwnProperty=objectProto.hasOwnProperty;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(value){if(!isObject(value)||isMasked(value)){return false}var pattern=isFunction(value)?reIsNative:reIsHostCtor;return pattern.test(toSource(value))}module.exports=baseIsNative},{"./_isMasked":71,"./_toSource":97,"./isFunction":104,"./isObject":106}],31:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isLength=require("./isLength"),isObjectLike=require("./isObjectLike");var argsTag="[object Arguments]",arrayTag="[object Array]",boolTag="[object Boolean]",dateTag="[object Date]",errorTag="[object Error]",funcTag="[object Function]",mapTag="[object Map]",numberTag="[object Number]",objectTag="[object Object]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",weakMapTag="[object WeakMap]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";var typedArrayTags={};typedArrayTags[float32Tag]=typedArrayTags[float64Tag]=typedArrayTags[int8Tag]=typedArrayTags[int16Tag]=typedArrayTags[int32Tag]=typedArrayTags[uint8Tag]=typedArrayTags[uint8ClampedTag]=typedArrayTags[uint16Tag]=typedArrayTags[uint32Tag]=true;typedArrayTags[argsTag]=typedArrayTags[arrayTag]=typedArrayTags[arrayBufferTag]=typedArrayTags[boolTag]=typedArrayTags[dataViewTag]=typedArrayTags[dateTag]=typedArrayTags[errorTag]=typedArrayTags[funcTag]=typedArrayTags[mapTag]=typedArrayTags[numberTag]=typedArrayTags[objectTag]=typedArrayTags[regexpTag]=typedArrayTags[setTag]=typedArrayTags[stringTag]=typedArrayTags[weakMapTag]=false;function baseIsTypedArray(value){return isObjectLike(value)&&isLength(value.length)&&!!typedArrayTags[baseGetTag(value)]}module.exports=baseIsTypedArray},{"./_baseGetTag":28,"./isLength":105,"./isObjectLike":107}],32:[function(require,module,exports){var isPrototype=require("./_isPrototype"),nativeKeys=require("./_nativeKeys");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function baseKeys(object){if(!isPrototype(object)){return nativeKeys(object)}var result=[];for(var key in Object(object)){if(hasOwnProperty.call(object,key)&&key!="constructor"){result.push(key)}}return result}module.exports=baseKeys},{"./_isPrototype":72,"./_nativeKeys":85}],33:[function(require,module,exports){var isObject=require("./isObject"),isPrototype=require("./_isPrototype"),nativeKeysIn=require("./_nativeKeysIn");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function baseKeysIn(object){if(!isObject(object)){return nativeKeysIn(object)}var isProto=isPrototype(object),result=[];for(var key in object){if(!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}module.exports=baseKeysIn},{"./_isPrototype":72,"./_nativeKeysIn":86,"./isObject":106}],34:[function(require,module,exports){function baseTimes(n,iteratee){var index=-1,result=Array(n);while(++index<n){result[index]=iteratee(index)}return result}module.exports=baseTimes},{}],35:[function(require,module,exports){function baseUnary(func){return function(value){return func(value)}}module.exports=baseUnary},{}],36:[function(require,module,exports){var Uint8Array=require("./_Uint8Array");function cloneArrayBuffer(arrayBuffer){var result=new arrayBuffer.constructor(arrayBuffer.byteLength);new Uint8Array(result).set(new Uint8Array(arrayBuffer));return result}module.exports=cloneArrayBuffer},{"./_Uint8Array":11}],37:[function(require,module,exports){var root=require("./_root");var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var Buffer=moduleExports?root.Buffer:undefined,allocUnsafe=Buffer?Buffer.allocUnsafe:undefined;function cloneBuffer(buffer,isDeep){if(isDeep){return buffer.slice()}var length=buffer.length,result=allocUnsafe?allocUnsafe(length):new buffer.constructor(length);buffer.copy(result);return result}module.exports=cloneBuffer},{"./_root":90}],38:[function(require,module,exports){var cloneArrayBuffer=require("./_cloneArrayBuffer");function cloneDataView(dataView,isDeep){var buffer=isDeep?cloneArrayBuffer(dataView.buffer):dataView.buffer;return new dataView.constructor(buffer,dataView.byteOffset,dataView.byteLength)}module.exports=cloneDataView},{"./_cloneArrayBuffer":36}],39:[function(require,module,exports){var addMapEntry=require("./_addMapEntry"),arrayReduce=require("./_arrayReduce"),mapToArray=require("./_mapToArray");var CLONE_DEEP_FLAG=1;function cloneMap(map,isDeep,cloneFunc){var array=isDeep?cloneFunc(mapToArray(map),CLONE_DEEP_FLAG):mapToArray(map);return arrayReduce(array,addMapEntry,new map.constructor)}module.exports=cloneMap},{"./_addMapEntry":13,"./_arrayReduce":19,"./_mapToArray":83}],40:[function(require,module,exports){var reFlags=/\w*$/;function cloneRegExp(regexp){var result=new regexp.constructor(regexp.source,reFlags.exec(regexp));result.lastIndex=regexp.lastIndex;return result}module.exports=cloneRegExp},{}],41:[function(require,module,exports){var addSetEntry=require("./_addSetEntry"),arrayReduce=require("./_arrayReduce"),setToArray=require("./_setToArray");var CLONE_DEEP_FLAG=1;function cloneSet(set,isDeep,cloneFunc){var array=isDeep?cloneFunc(setToArray(set),CLONE_DEEP_FLAG):setToArray(set);return arrayReduce(array,addSetEntry,new set.constructor)}module.exports=cloneSet},{"./_addSetEntry":14,"./_arrayReduce":19,"./_setToArray":91}],42:[function(require,module,exports){var Symbol=require("./_Symbol");var symbolProto=Symbol?Symbol.prototype:undefined,symbolValueOf=symbolProto?symbolProto.valueOf:undefined;function cloneSymbol(symbol){return symbolValueOf?Object(symbolValueOf.call(symbol)):{}}module.exports=cloneSymbol},{"./_Symbol":10}],43:[function(require,module,exports){var cloneArrayBuffer=require("./_cloneArrayBuffer");function cloneTypedArray(typedArray,isDeep){var buffer=isDeep?cloneArrayBuffer(typedArray.buffer):typedArray.buffer;return new typedArray.constructor(buffer,typedArray.byteOffset,typedArray.length)}module.exports=cloneTypedArray},{"./_cloneArrayBuffer":36}],44:[function(require,module,exports){function copyArray(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index]}return array}module.exports=copyArray},{}],45:[function(require,module,exports){var assignValue=require("./_assignValue"),baseAssignValue=require("./_baseAssignValue");function copyObject(source,props,object,customizer){var isNew=!object;object||(object={});var index=-1,length=props.length;while(++index<length){var key=props[index];var newValue=customizer?customizer(object[key],source[key],key,object,source):undefined;if(newValue===undefined){newValue=source[key]}if(isNew){baseAssignValue(object,key,newValue)}else{assignValue(object,key,newValue)}}return object}module.exports=copyObject},{"./_assignValue":20,"./_baseAssignValue":24}],46:[function(require,module,exports){var copyObject=require("./_copyObject"),getSymbols=require("./_getSymbols");function copySymbols(source,object){return copyObject(source,getSymbols(source),object)}module.exports=copySymbols},{"./_copyObject":45,"./_getSymbols":57}],47:[function(require,module,exports){var copyObject=require("./_copyObject"),getSymbolsIn=require("./_getSymbolsIn");function copySymbolsIn(source,object){return copyObject(source,getSymbolsIn(source),object)}module.exports=copySymbolsIn},{"./_copyObject":45,"./_getSymbolsIn":58}],48:[function(require,module,exports){var root=require("./_root");var coreJsData=root["__core-js_shared__"];module.exports=coreJsData},{"./_root":90}],49:[function(require,module,exports){var getNative=require("./_getNative");var defineProperty=function(){try{var func=getNative(Object,"defineProperty");func({},"",{});return func}catch(e){}}();module.exports=defineProperty},{"./_getNative":54}],50:[function(require,module,exports){(function(global){var freeGlobal=typeof global=="object"&&global&&global.Object===Object&&global;module.exports=freeGlobal}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],51:[function(require,module,exports){var baseGetAllKeys=require("./_baseGetAllKeys"),getSymbols=require("./_getSymbols"),keys=require("./keys");function getAllKeys(object){return baseGetAllKeys(object,keys,getSymbols)}module.exports=getAllKeys},{"./_baseGetAllKeys":27,"./_getSymbols":57,"./keys":109}],52:[function(require,module,exports){var baseGetAllKeys=require("./_baseGetAllKeys"),getSymbolsIn=require("./_getSymbolsIn"),keysIn=require("./keysIn");function getAllKeysIn(object){return baseGetAllKeys(object,keysIn,getSymbolsIn)}module.exports=getAllKeysIn},{"./_baseGetAllKeys":27,"./_getSymbolsIn":58,"./keysIn":110}],53:[function(require,module,exports){var isKeyable=require("./_isKeyable");function getMapData(map,key){var data=map.__data__;return isKeyable(key)?data[typeof key=="string"?"string":"hash"]:data.map}module.exports=getMapData},{"./_isKeyable":70}],54:[function(require,module,exports){var baseIsNative=require("./_baseIsNative"),getValue=require("./_getValue");function getNative(object,key){var value=getValue(object,key);return baseIsNative(value)?value:undefined}module.exports=getNative},{"./_baseIsNative":30,"./_getValue":60}],55:[function(require,module,exports){var overArg=require("./_overArg");var getPrototype=overArg(Object.getPrototypeOf,Object);module.exports=getPrototype},{"./_overArg":89}],56:[function(require,module,exports){var Symbol=require("./_Symbol");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var nativeObjectToString=objectProto.toString;var symToStringTag=Symbol?Symbol.toStringTag:undefined;function getRawTag(value){var isOwn=hasOwnProperty.call(value,symToStringTag),tag=value[symToStringTag];try{value[symToStringTag]=undefined;var unmasked=true}catch(e){}var result=nativeObjectToString.call(value);if(unmasked){if(isOwn){value[symToStringTag]=tag}else{delete value[symToStringTag]}}return result}module.exports=getRawTag},{"./_Symbol":10}],57:[function(require,module,exports){var arrayFilter=require("./_arrayFilter"),stubArray=require("./stubArray");var objectProto=Object.prototype;var propertyIsEnumerable=objectProto.propertyIsEnumerable;var nativeGetSymbols=Object.getOwnPropertySymbols;var getSymbols=!nativeGetSymbols?stubArray:function(object){if(object==null){return[]}object=Object(object);return arrayFilter(nativeGetSymbols(object),function(symbol){return propertyIsEnumerable.call(object,symbol)})};module.exports=getSymbols},{"./_arrayFilter":16,"./stubArray":111}],58:[function(require,module,exports){var arrayPush=require("./_arrayPush"),getPrototype=require("./_getPrototype"),getSymbols=require("./_getSymbols"),stubArray=require("./stubArray");var nativeGetSymbols=Object.getOwnPropertySymbols;var getSymbolsIn=!nativeGetSymbols?stubArray:function(object){var result=[];while(object){arrayPush(result,getSymbols(object));object=getPrototype(object)}return result};module.exports=getSymbolsIn},{"./_arrayPush":18,"./_getPrototype":55,"./_getSymbols":57,"./stubArray":111}],59:[function(require,module,exports){var DataView=require("./_DataView"),Map=require("./_Map"),Promise=require("./_Promise"),Set=require("./_Set"),WeakMap=require("./_WeakMap"),baseGetTag=require("./_baseGetTag"),toSource=require("./_toSource");var mapTag="[object Map]",objectTag="[object Object]",promiseTag="[object Promise]",setTag="[object Set]",weakMapTag="[object WeakMap]";var dataViewTag="[object DataView]";var dataViewCtorString=toSource(DataView),mapCtorString=toSource(Map),promiseCtorString=toSource(Promise),setCtorString=toSource(Set),weakMapCtorString=toSource(WeakMap);var getTag=baseGetTag;if(DataView&&getTag(new DataView(new ArrayBuffer(1)))!=dataViewTag||Map&&getTag(new Map)!=mapTag||Promise&&getTag(Promise.resolve())!=promiseTag||Set&&getTag(new Set)!=setTag||WeakMap&&getTag(new WeakMap)!=weakMapTag){getTag=function(value){var result=baseGetTag(value),Ctor=result==objectTag?value.constructor:undefined,ctorString=Ctor?toSource(Ctor):"";if(ctorString){switch(ctorString){case dataViewCtorString:return dataViewTag;case mapCtorString:return mapTag;case promiseCtorString:return promiseTag;case setCtorString:return setTag;case weakMapCtorString:return weakMapTag}}return result}}module.exports=getTag},{"./_DataView":2,"./_Map":5,"./_Promise":7,"./_Set":8,"./_WeakMap":12,"./_baseGetTag":28,"./_toSource":97}],60:[function(require,module,exports){function getValue(object,key){return object==null?undefined:object[key]}module.exports=getValue},{}],61:[function(require,module,exports){var nativeCreate=require("./_nativeCreate");function hashClear(){this.__data__=nativeCreate?nativeCreate(null):{};this.size=0}module.exports=hashClear},{"./_nativeCreate":84}],62:[function(require,module,exports){function hashDelete(key){var result=this.has(key)&&delete this.__data__[key];this.size-=result?1:0;return result}module.exports=hashDelete},{}],63:[function(require,module,exports){var nativeCreate=require("./_nativeCreate");var HASH_UNDEFINED="__lodash_hash_undefined__";var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function hashGet(key){var data=this.__data__;if(nativeCreate){var result=data[key];return result===HASH_UNDEFINED?undefined:result}return hasOwnProperty.call(data,key)?data[key]:undefined}module.exports=hashGet},{"./_nativeCreate":84}],64:[function(require,module,exports){var nativeCreate=require("./_nativeCreate");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function hashHas(key){var data=this.__data__;return nativeCreate?data[key]!==undefined:hasOwnProperty.call(data,key)}module.exports=hashHas},{"./_nativeCreate":84}],65:[function(require,module,exports){var nativeCreate=require("./_nativeCreate");var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(key,value){var data=this.__data__;this.size+=this.has(key)?0:1;data[key]=nativeCreate&&value===undefined?HASH_UNDEFINED:value;return this}module.exports=hashSet},{"./_nativeCreate":84}],66:[function(require,module,exports){var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;function initCloneArray(array){var length=array.length,result=array.constructor(length);if(length&&typeof array[0]=="string"&&hasOwnProperty.call(array,"index")){result.index=array.index;result.input=array.input}return result}module.exports=initCloneArray},{}],67:[function(require,module,exports){var cloneArrayBuffer=require("./_cloneArrayBuffer"),cloneDataView=require("./_cloneDataView"),cloneMap=require("./_cloneMap"),cloneRegExp=require("./_cloneRegExp"),cloneSet=require("./_cloneSet"),cloneSymbol=require("./_cloneSymbol"),cloneTypedArray=require("./_cloneTypedArray");var boolTag="[object Boolean]",dateTag="[object Date]",mapTag="[object Map]",numberTag="[object Number]",regexpTag="[object RegExp]",setTag="[object Set]",stringTag="[object String]",symbolTag="[object Symbol]";var arrayBufferTag="[object ArrayBuffer]",dataViewTag="[object DataView]",float32Tag="[object Float32Array]",float64Tag="[object Float64Array]",int8Tag="[object Int8Array]",int16Tag="[object Int16Array]",int32Tag="[object Int32Array]",uint8Tag="[object Uint8Array]",uint8ClampedTag="[object Uint8ClampedArray]",uint16Tag="[object Uint16Array]",uint32Tag="[object Uint32Array]";function initCloneByTag(object,tag,cloneFunc,isDeep){var Ctor=object.constructor;switch(tag){case arrayBufferTag:return cloneArrayBuffer(object);case boolTag:case dateTag:return new Ctor(+object);case dataViewTag:return cloneDataView(object,isDeep);case float32Tag:case float64Tag:case int8Tag:case int16Tag:case int32Tag:case uint8Tag:case uint8ClampedTag:case uint16Tag:case uint32Tag:return cloneTypedArray(object,isDeep);case mapTag:return cloneMap(object,isDeep,cloneFunc);case numberTag:case stringTag:return new Ctor(object);case regexpTag:return cloneRegExp(object);case setTag:return cloneSet(object,isDeep,cloneFunc);case symbolTag:return cloneSymbol(object)}}module.exports=initCloneByTag},{"./_cloneArrayBuffer":36,"./_cloneDataView":38,"./_cloneMap":39,"./_cloneRegExp":40,"./_cloneSet":41,"./_cloneSymbol":42,"./_cloneTypedArray":43}],68:[function(require,module,exports){
var baseCreate=require("./_baseCreate"),getPrototype=require("./_getPrototype"),isPrototype=require("./_isPrototype");function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}module.exports=initCloneObject},{"./_baseCreate":26,"./_getPrototype":55,"./_isPrototype":72}],69:[function(require,module,exports){var MAX_SAFE_INTEGER=9007199254740991;var reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(value,length){length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(typeof value=="number"||reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}module.exports=isIndex},{}],70:[function(require,module,exports){function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}module.exports=isKeyable},{}],71:[function(require,module,exports){var coreJsData=require("./_coreJsData");var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}module.exports=isMasked},{"./_coreJsData":48}],72:[function(require,module,exports){var objectProto=Object.prototype;function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto;return value===proto}module.exports=isPrototype},{}],73:[function(require,module,exports){function listCacheClear(){this.__data__=[];this.size=0}module.exports=listCacheClear},{}],74:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");var arrayProto=Array.prototype;var splice=arrayProto.splice;function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}--this.size;return true}module.exports=listCacheDelete},{"./_assocIndexOf":21}],75:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}module.exports=listCacheGet},{"./_assocIndexOf":21}],76:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}module.exports=listCacheHas},{"./_assocIndexOf":21}],77:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else{data[index][1]=value}return this}module.exports=listCacheSet},{"./_assocIndexOf":21}],78:[function(require,module,exports){var Hash=require("./_Hash"),ListCache=require("./_ListCache"),Map=require("./_Map");function mapCacheClear(){this.size=0;this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}module.exports=mapCacheClear},{"./_Hash":3,"./_ListCache":4,"./_Map":5}],79:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheDelete(key){var result=getMapData(this,key)["delete"](key);this.size-=result?1:0;return result}module.exports=mapCacheDelete},{"./_getMapData":53}],80:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheGet(key){return getMapData(this,key).get(key)}module.exports=mapCacheGet},{"./_getMapData":53}],81:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheHas(key){return getMapData(this,key).has(key)}module.exports=mapCacheHas},{"./_getMapData":53}],82:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this}module.exports=mapCacheSet},{"./_getMapData":53}],83:[function(require,module,exports){function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}module.exports=mapToArray},{}],84:[function(require,module,exports){var getNative=require("./_getNative");var nativeCreate=getNative(Object,"create");module.exports=nativeCreate},{"./_getNative":54}],85:[function(require,module,exports){var overArg=require("./_overArg");var nativeKeys=overArg(Object.keys,Object);module.exports=nativeKeys},{"./_overArg":89}],86:[function(require,module,exports){function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key)}}return result}module.exports=nativeKeysIn},{}],87:[function(require,module,exports){var freeGlobal=require("./_freeGlobal");var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var freeProcess=moduleExports&&freeGlobal.process;var nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();module.exports=nodeUtil},{"./_freeGlobal":50}],88:[function(require,module,exports){var objectProto=Object.prototype;var nativeObjectToString=objectProto.toString;function objectToString(value){return nativeObjectToString.call(value)}module.exports=objectToString},{}],89:[function(require,module,exports){function overArg(func,transform){return function(arg){return func(transform(arg))}}module.exports=overArg},{}],90:[function(require,module,exports){var freeGlobal=require("./_freeGlobal");var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();module.exports=root},{"./_freeGlobal":50}],91:[function(require,module,exports){function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value});return result}module.exports=setToArray},{}],92:[function(require,module,exports){var ListCache=require("./_ListCache");function stackClear(){this.__data__=new ListCache;this.size=0}module.exports=stackClear},{"./_ListCache":4}],93:[function(require,module,exports){function stackDelete(key){var data=this.__data__,result=data["delete"](key);this.size=data.size;return result}module.exports=stackDelete},{}],94:[function(require,module,exports){function stackGet(key){return this.__data__.get(key)}module.exports=stackGet},{}],95:[function(require,module,exports){function stackHas(key){return this.__data__.has(key)}module.exports=stackHas},{}],96:[function(require,module,exports){var ListCache=require("./_ListCache"),Map=require("./_Map"),MapCache=require("./_MapCache");var LARGE_ARRAY_SIZE=200;function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1){pairs.push([key,value]);this.size=++data.size;return this}data=this.__data__=new MapCache(pairs)}data.set(key,value);this.size=data.size;return this}module.exports=stackSet},{"./_ListCache":4,"./_Map":5,"./_MapCache":6}],97:[function(require,module,exports){var funcProto=Function.prototype;var funcToString=funcProto.toString;function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}module.exports=toSource},{}],98:[function(require,module,exports){var baseClone=require("./_baseClone");var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}module.exports=cloneDeep},{"./_baseClone":25}],99:[function(require,module,exports){function eq(value,other){return value===other||value!==value&&other!==other}module.exports=eq},{}],100:[function(require,module,exports){var baseIsArguments=require("./_baseIsArguments"),isObjectLike=require("./isObjectLike");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var propertyIsEnumerable=objectProto.propertyIsEnumerable;var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};module.exports=isArguments},{"./_baseIsArguments":29,"./isObjectLike":107}],101:[function(require,module,exports){var isArray=Array.isArray;module.exports=isArray},{}],102:[function(require,module,exports){var isFunction=require("./isFunction"),isLength=require("./isLength");function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}module.exports=isArrayLike},{"./isFunction":104,"./isLength":105}],103:[function(require,module,exports){var root=require("./_root"),stubFalse=require("./stubFalse");var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var Buffer=moduleExports?root.Buffer:undefined;var nativeIsBuffer=Buffer?Buffer.isBuffer:undefined;var isBuffer=nativeIsBuffer||stubFalse;module.exports=isBuffer},{"./_root":90,"./stubFalse":112}],104:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isObject=require("./isObject");var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(value){if(!isObject(value)){return false}var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}module.exports=isFunction},{"./_baseGetTag":28,"./isObject":106}],105:[function(require,module,exports){var MAX_SAFE_INTEGER=9007199254740991;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}module.exports=isLength},{}],106:[function(require,module,exports){function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}module.exports=isObject},{}],107:[function(require,module,exports){function isObjectLike(value){return value!=null&&typeof value=="object"}module.exports=isObjectLike},{}],108:[function(require,module,exports){var baseIsTypedArray=require("./_baseIsTypedArray"),baseUnary=require("./_baseUnary"),nodeUtil=require("./_nodeUtil");var nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;module.exports=isTypedArray},{"./_baseIsTypedArray":31,"./_baseUnary":35,"./_nodeUtil":87}],109:[function(require,module,exports){var arrayLikeKeys=require("./_arrayLikeKeys"),baseKeys=require("./_baseKeys"),isArrayLike=require("./isArrayLike");function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}module.exports=keys},{"./_arrayLikeKeys":17,"./_baseKeys":32,"./isArrayLike":102}],110:[function(require,module,exports){var arrayLikeKeys=require("./_arrayLikeKeys"),baseKeysIn=require("./_baseKeysIn"),isArrayLike=require("./isArrayLike");function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object)}module.exports=keysIn},{"./_arrayLikeKeys":17,"./_baseKeysIn":33,"./isArrayLike":102}],111:[function(require,module,exports){function stubArray(){return[]}module.exports=stubArray},{}],112:[function(require,module,exports){function stubFalse(){return false}module.exports=stubFalse},{}],113:[function(require,module,exports){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function superstruct(){function e(e,t){var r=e.endsWith("?"),n=r?e.slice(0,-1):e,o=n.split(/\s*\|\s*/g),a=o.map(function(e){var t=u[e];if("function"!=typeof t)throw new Error('No struct validator function found for type "'+e+'".');return t});return function(e){if(!r&&void 0===e)throw new StructError("value_required",{type:n});if(void 0!==e&&!a.some(function(t){return t(e)}))throw new StructError("value_invalid",{type:n,value:e});return e}}function t(e,t){if(1!==e.length)throw new Error("List structs must be defined as an array with a single element, but you passed "+e.length+" elements.");e=e[0];var r=n(e);return function(e){if(void 0===e)throw new StructError("value_required",{type:"array"});if("array"!==(0,_componentType2.default)(e))throw new StructError("value_invalid",{type:"array",value:e});return e.map(function(e,t){try{return r(e)}catch(e){var n=[t].concat(e.path);switch(e.code){case"value_invalid":throw new StructError("element_invalid",_extends({},e,{index:t,path:n}));default:throw"path"in e&&(e.path=n),e}}})}}function r(e,t){var r={};for(var o in e){var u=n(e[o]);r[o]=u}return function(e){var t=!1;if(void 0===e)t=!0,e={};else if("object"!==(0,_componentType2.default)(e))throw new StructError("value_invalid",{type:"object",value:e});var n={};for(var o in r){var u=r[o],a=e[o],c=void 0;try{c=u(a)}catch(e){var i=[o].concat(e.path);switch(e.code){case"value_invalid":throw new StructError("property_invalid",_extends({},e,{key:o,path:i}));case"value_required":throw t?new StructError("value_required",{type:"object"}):new StructError("property_required",_extends({},e,{key:o,path:i}));default:throw"path"in e&&(e.path=i),e}}o in e&&(n[o]=c)}for(var p in e)if(!(p in r))throw new StructError("property_unknown",{key:p,path:[p]});return t?void 0:n}}function n(n,o){var u=void 0;if("function"===(0,_componentType2.default)(n))u=n;else if("string"===(0,_componentType2.default)(n))u=e(n,o);else if("array"===(0,_componentType2.default)(n))u=t(n,o);else{if("object"!==(0,_componentType2.default)(n))throw new Error("A struct schema definition must be a string, array or object, but you passed: "+n);u=r(n,o)}return function(e){return void 0===e&&(e="function"==typeof o?o():(0,_cloneDeep2.default)(o)),u(e)}}var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=_extends({},DEFAULT_TYPES,o.types||{});return n}Object.defineProperty(exports,"__esModule",{value:!0}),exports.StructError=exports.superstruct=exports.struct=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_cloneDeep=require("lodash/cloneDeep"),_cloneDeep2=_interopRequireDefault(_cloneDeep),_componentType=require("component-type"),_componentType2=_interopRequireDefault(_componentType),DEFAULT_TYPES={any:function(e){return void 0!==e},array:function(e){return"array"===(0,_componentType2.default)(e)},boolean:function(e){return"boolean"===(0,_componentType2.default)(e)},buffer:function(e){return"buffer"===(0,_componentType2.default)(e)},date:function(e){return"date"===(0,_componentType2.default)(e)},error:function(e){return"error"===(0,_componentType2.default)(e)},function:function(e){return"string"===(0,_componentType2.default)(e)},null:function(e){return"null"===(0,_componentType2.default)(e)},number:function(e){return"number"===(0,_componentType2.default)(e)},object:function(e){return"object"===(0,_componentType2.default)(e)},regexp:function(e){return"regexp"===(0,_componentType2.default)(e)},string:function(e){return"string"===(0,_componentType2.default)(e)},undefined:function(e){return"undefined"===(0,_componentType2.default)(e)}},StructError=function(e){function t(e,r){_classCallCheck(this,t),r.code=e,r.path=r.path||[];var n=r.index,o=r.key,u=r.value,a=r.type;switch(e){case"element_invalid":e="Expected the element at index `"+n+'` to be of type "'+a+'", but it was `'+u+"`.";break;case"property_invalid":case"property_required":e="Expected the `"+o+'` property to be of type "'+a+'", but it was `'+u+"`.";break;case"property_unknown":e="Unexpected `"+o+"` property that was not defined in the struct.";break;case"value_invalid":case"value_required":e='Expected a value of type "'+a+'" but received `'+u+"`.";break;default:throw new Error('Unknown struct error code: "'+e+'"')}var c=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));c.name="StructError";for(var i in r)c[i]=r[i];return Error.captureStackTrace(c,c.constructor),c}return _inherits(t,e),t}(Error),struct=superstruct();exports.default=struct,exports.struct=struct,exports.superstruct=superstruct,exports.StructError=StructError},{"component-type":1,"lodash/cloneDeep":98}]},{},[113])(113)});
var baseCreate=require("./_baseCreate"),getPrototype=require("./_getPrototype"),isPrototype=require("./_isPrototype");function initCloneObject(object){return typeof object.constructor=="function"&&!isPrototype(object)?baseCreate(getPrototype(object)):{}}module.exports=initCloneObject},{"./_baseCreate":26,"./_getPrototype":55,"./_isPrototype":72}],69:[function(require,module,exports){var MAX_SAFE_INTEGER=9007199254740991;var reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(value,length){length=length==null?MAX_SAFE_INTEGER:length;return!!length&&(typeof value=="number"||reIsUint.test(value))&&(value>-1&&value%1==0&&value<length)}module.exports=isIndex},{}],70:[function(require,module,exports){function isKeyable(value){var type=typeof value;return type=="string"||type=="number"||type=="symbol"||type=="boolean"?value!=="__proto__":value===null}module.exports=isKeyable},{}],71:[function(require,module,exports){var coreJsData=require("./_coreJsData");var maskSrcKey=function(){var uid=/[^.]+$/.exec(coreJsData&&coreJsData.keys&&coreJsData.keys.IE_PROTO||"");return uid?"Symbol(src)_1."+uid:""}();function isMasked(func){return!!maskSrcKey&&maskSrcKey in func}module.exports=isMasked},{"./_coreJsData":48}],72:[function(require,module,exports){var objectProto=Object.prototype;function isPrototype(value){var Ctor=value&&value.constructor,proto=typeof Ctor=="function"&&Ctor.prototype||objectProto;return value===proto}module.exports=isPrototype},{}],73:[function(require,module,exports){function listCacheClear(){this.__data__=[];this.size=0}module.exports=listCacheClear},{}],74:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");var arrayProto=Array.prototype;var splice=arrayProto.splice;function listCacheDelete(key){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){return false}var lastIndex=data.length-1;if(index==lastIndex){data.pop()}else{splice.call(data,index,1)}--this.size;return true}module.exports=listCacheDelete},{"./_assocIndexOf":21}],75:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");function listCacheGet(key){var data=this.__data__,index=assocIndexOf(data,key);return index<0?undefined:data[index][1]}module.exports=listCacheGet},{"./_assocIndexOf":21}],76:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");function listCacheHas(key){return assocIndexOf(this.__data__,key)>-1}module.exports=listCacheHas},{"./_assocIndexOf":21}],77:[function(require,module,exports){var assocIndexOf=require("./_assocIndexOf");function listCacheSet(key,value){var data=this.__data__,index=assocIndexOf(data,key);if(index<0){++this.size;data.push([key,value])}else{data[index][1]=value}return this}module.exports=listCacheSet},{"./_assocIndexOf":21}],78:[function(require,module,exports){var Hash=require("./_Hash"),ListCache=require("./_ListCache"),Map=require("./_Map");function mapCacheClear(){this.size=0;this.__data__={hash:new Hash,map:new(Map||ListCache),string:new Hash}}module.exports=mapCacheClear},{"./_Hash":3,"./_ListCache":4,"./_Map":5}],79:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheDelete(key){var result=getMapData(this,key)["delete"](key);this.size-=result?1:0;return result}module.exports=mapCacheDelete},{"./_getMapData":53}],80:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheGet(key){return getMapData(this,key).get(key)}module.exports=mapCacheGet},{"./_getMapData":53}],81:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheHas(key){return getMapData(this,key).has(key)}module.exports=mapCacheHas},{"./_getMapData":53}],82:[function(require,module,exports){var getMapData=require("./_getMapData");function mapCacheSet(key,value){var data=getMapData(this,key),size=data.size;data.set(key,value);this.size+=data.size==size?0:1;return this}module.exports=mapCacheSet},{"./_getMapData":53}],83:[function(require,module,exports){function mapToArray(map){var index=-1,result=Array(map.size);map.forEach(function(value,key){result[++index]=[key,value]});return result}module.exports=mapToArray},{}],84:[function(require,module,exports){var getNative=require("./_getNative");var nativeCreate=getNative(Object,"create");module.exports=nativeCreate},{"./_getNative":54}],85:[function(require,module,exports){var overArg=require("./_overArg");var nativeKeys=overArg(Object.keys,Object);module.exports=nativeKeys},{"./_overArg":89}],86:[function(require,module,exports){function nativeKeysIn(object){var result=[];if(object!=null){for(var key in Object(object)){result.push(key)}}return result}module.exports=nativeKeysIn},{}],87:[function(require,module,exports){var freeGlobal=require("./_freeGlobal");var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var freeProcess=moduleExports&&freeGlobal.process;var nodeUtil=function(){try{return freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch(e){}}();module.exports=nodeUtil},{"./_freeGlobal":50}],88:[function(require,module,exports){var objectProto=Object.prototype;var nativeObjectToString=objectProto.toString;function objectToString(value){return nativeObjectToString.call(value)}module.exports=objectToString},{}],89:[function(require,module,exports){function overArg(func,transform){return function(arg){return func(transform(arg))}}module.exports=overArg},{}],90:[function(require,module,exports){var freeGlobal=require("./_freeGlobal");var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=freeGlobal||freeSelf||Function("return this")();module.exports=root},{"./_freeGlobal":50}],91:[function(require,module,exports){function setToArray(set){var index=-1,result=Array(set.size);set.forEach(function(value){result[++index]=value});return result}module.exports=setToArray},{}],92:[function(require,module,exports){var ListCache=require("./_ListCache");function stackClear(){this.__data__=new ListCache;this.size=0}module.exports=stackClear},{"./_ListCache":4}],93:[function(require,module,exports){function stackDelete(key){var data=this.__data__,result=data["delete"](key);this.size=data.size;return result}module.exports=stackDelete},{}],94:[function(require,module,exports){function stackGet(key){return this.__data__.get(key)}module.exports=stackGet},{}],95:[function(require,module,exports){function stackHas(key){return this.__data__.has(key)}module.exports=stackHas},{}],96:[function(require,module,exports){var ListCache=require("./_ListCache"),Map=require("./_Map"),MapCache=require("./_MapCache");var LARGE_ARRAY_SIZE=200;function stackSet(key,value){var data=this.__data__;if(data instanceof ListCache){var pairs=data.__data__;if(!Map||pairs.length<LARGE_ARRAY_SIZE-1){pairs.push([key,value]);this.size=++data.size;return this}data=this.__data__=new MapCache(pairs)}data.set(key,value);this.size=data.size;return this}module.exports=stackSet},{"./_ListCache":4,"./_Map":5,"./_MapCache":6}],97:[function(require,module,exports){var funcProto=Function.prototype;var funcToString=funcProto.toString;function toSource(func){if(func!=null){try{return funcToString.call(func)}catch(e){}try{return func+""}catch(e){}}return""}module.exports=toSource},{}],98:[function(require,module,exports){var baseClone=require("./_baseClone");var CLONE_DEEP_FLAG=1,CLONE_SYMBOLS_FLAG=4;function cloneDeep(value){return baseClone(value,CLONE_DEEP_FLAG|CLONE_SYMBOLS_FLAG)}module.exports=cloneDeep},{"./_baseClone":25}],99:[function(require,module,exports){function eq(value,other){return value===other||value!==value&&other!==other}module.exports=eq},{}],100:[function(require,module,exports){var baseIsArguments=require("./_baseIsArguments"),isObjectLike=require("./isObjectLike");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var propertyIsEnumerable=objectProto.propertyIsEnumerable;var isArguments=baseIsArguments(function(){return arguments}())?baseIsArguments:function(value){return isObjectLike(value)&&hasOwnProperty.call(value,"callee")&&!propertyIsEnumerable.call(value,"callee")};module.exports=isArguments},{"./_baseIsArguments":29,"./isObjectLike":107}],101:[function(require,module,exports){var isArray=Array.isArray;module.exports=isArray},{}],102:[function(require,module,exports){var isFunction=require("./isFunction"),isLength=require("./isLength");function isArrayLike(value){return value!=null&&isLength(value.length)&&!isFunction(value)}module.exports=isArrayLike},{"./isFunction":104,"./isLength":105}],103:[function(require,module,exports){var root=require("./_root"),stubFalse=require("./stubFalse");var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports;var freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module;var moduleExports=freeModule&&freeModule.exports===freeExports;var Buffer=moduleExports?root.Buffer:undefined;var nativeIsBuffer=Buffer?Buffer.isBuffer:undefined;var isBuffer=nativeIsBuffer||stubFalse;module.exports=isBuffer},{"./_root":90,"./stubFalse":112}],104:[function(require,module,exports){var baseGetTag=require("./_baseGetTag"),isObject=require("./isObject");var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction(value){if(!isObject(value)){return false}var tag=baseGetTag(value);return tag==funcTag||tag==genTag||tag==asyncTag||tag==proxyTag}module.exports=isFunction},{"./_baseGetTag":28,"./isObject":106}],105:[function(require,module,exports){var MAX_SAFE_INTEGER=9007199254740991;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}module.exports=isLength},{}],106:[function(require,module,exports){function isObject(value){var type=typeof value;return value!=null&&(type=="object"||type=="function")}module.exports=isObject},{}],107:[function(require,module,exports){function isObjectLike(value){return value!=null&&typeof value=="object"}module.exports=isObjectLike},{}],108:[function(require,module,exports){var baseIsTypedArray=require("./_baseIsTypedArray"),baseUnary=require("./_baseUnary"),nodeUtil=require("./_nodeUtil");var nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray;var isTypedArray=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray;module.exports=isTypedArray},{"./_baseIsTypedArray":31,"./_baseUnary":35,"./_nodeUtil":87}],109:[function(require,module,exports){var arrayLikeKeys=require("./_arrayLikeKeys"),baseKeys=require("./_baseKeys"),isArrayLike=require("./isArrayLike");function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}module.exports=keys},{"./_arrayLikeKeys":17,"./_baseKeys":32,"./isArrayLike":102}],110:[function(require,module,exports){var arrayLikeKeys=require("./_arrayLikeKeys"),baseKeysIn=require("./_baseKeysIn"),isArrayLike=require("./isArrayLike");function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,true):baseKeysIn(object)}module.exports=keysIn},{"./_arrayLikeKeys":17,"./_baseKeysIn":33,"./isArrayLike":102}],111:[function(require,module,exports){function stubArray(){return[]}module.exports=stubArray},{}],112:[function(require,module,exports){function stubFalse(){return false}module.exports=stubFalse},{}],113:[function(require,module,exports){"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function superstruct(){function e(e,t){var r=e.endsWith("?"),n=r?e.slice(0,-1):e,o=n.split(/\s*\|\s*/g),a=o.map(function(e){var t=u[e];if("function"!=typeof t)throw new Error('No struct validator function found for type "'+e+'".');return t});return function(e){if(!r&&void 0===e)throw new StructError("value_required",{type:n});if(void 0!==e&&!a.some(function(t){return t(e)}))throw new StructError("value_invalid",{type:n,value:e});return e}}function t(e,t){if(1!==e.length)throw new Error("List structs must be defined as an array with a single element, but you passed "+e.length+" elements.");e=e[0];var r=n(e);return function(e){if(void 0===e)throw new StructError("value_required",{type:"array"});if("array"!==(0,_componentType2.default)(e))throw new StructError("value_invalid",{type:"array",value:e});return e.map(function(e,t){try{return r(e)}catch(e){var n=[t].concat(e.path);switch(e.code){case"value_invalid":throw new StructError("element_invalid",_extends({},e,{index:t,path:n}));default:throw"path"in e&&(e.path=n),e}}})}}function r(e,t){var r={};for(var o in e){var u=n(e[o]);r[o]=u}return function(e){var t=!1;if(void 0===e)t=!0,e={};else if("object"!==(0,_componentType2.default)(e))throw new StructError("value_invalid",{type:"object",value:e});var n={};for(var o in r){var u=r[o],a=e[o],c=void 0;try{c=u(a)}catch(e){var i=[o].concat(e.path);switch(e.code){case"value_invalid":throw new StructError("property_invalid",_extends({},e,{key:o,path:i}));case"value_required":throw t?new StructError("value_required",{type:"object"}):new StructError("property_required",_extends({},e,{key:o,path:i}));default:throw"path"in e&&(e.path=i),e}}o in e&&(n[o]=c)}for(var p in e)if(!(p in r))throw new StructError("property_unknown",{key:p,path:[p]});return t?void 0:n}}function n(n,o){var u=void 0;if("function"===(0,_componentType2.default)(n))u=n;else if("string"===(0,_componentType2.default)(n))u=e(n,o);else if("array"===(0,_componentType2.default)(n))u=t(n,o);else{if("object"!==(0,_componentType2.default)(n))throw new Error("A struct schema definition must be a string, array or object, but you passed: "+n);u=r(n,o)}return function(e){return void 0===e&&(e="function"==typeof o?o():(0,_cloneDeep2.default)(o)),u(e)}}var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},u=_extends({},DEFAULT_TYPES,o.types||{});return n}Object.defineProperty(exports,"__esModule",{value:!0}),exports.StructError=exports.superstruct=exports.struct=void 0;var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_cloneDeep=require("lodash/cloneDeep"),_cloneDeep2=_interopRequireDefault(_cloneDeep),_componentType=require("component-type"),_componentType2=_interopRequireDefault(_componentType),DEFAULT_TYPES={any:function(e){return void 0!==e},array:function(e){return"array"===(0,_componentType2.default)(e)},boolean:function(e){return"boolean"===(0,_componentType2.default)(e)},buffer:function(e){return"buffer"===(0,_componentType2.default)(e)},date:function(e){return"date"===(0,_componentType2.default)(e)},error:function(e){return"error"===(0,_componentType2.default)(e)},function:function(e){return"function"===(0,_componentType2.default)(e)},null:function(e){return"null"===(0,_componentType2.default)(e)},number:function(e){return"number"===(0,_componentType2.default)(e)},object:function(e){return"object"===(0,_componentType2.default)(e)},regexp:function(e){return"regexp"===(0,_componentType2.default)(e)},string:function(e){return"string"===(0,_componentType2.default)(e)},undefined:function(e){return"undefined"===(0,_componentType2.default)(e)}},StructError=function(e){function t(e,r){_classCallCheck(this,t),r.code=e,r.path=r.path||[];var n=r.index,o=r.key,u=r.value,a=r.type;switch(e){case"element_invalid":e="Expected the element at index `"+n+'` to be of type "'+a+'", but it was `'+u+"`.";break;case"property_invalid":case"property_required":e="Expected the `"+o+'` property to be of type "'+a+'", but it was `'+u+"`.";break;case"property_unknown":e="Unexpected `"+o+"` property that was not defined in the struct.";break;case"value_invalid":case"value_required":e='Expected a value of type "'+a+'" but received `'+u+"`.";break;default:throw new Error('Unknown struct error code: "'+e+'"')}var c=_possibleConstructorReturn(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));c.name="StructError";for(var i in r)c[i]=r[i];return Error.captureStackTrace(c,c.constructor),c}return _inherits(t,e),t}(Error),struct=superstruct();exports.default=struct,exports.struct=struct,exports.superstruct=superstruct,exports.StructError=StructError},{"component-type":1,"lodash/cloneDeep":98}]},{},[113])(113)});

@@ -52,3 +52,3 @@ 'use strict';

function: function _function(v) {
return (0, _componentType2.default)(v) === 'string';
return (0, _componentType2.default)(v) === 'function';
},

@@ -55,0 +55,0 @@ null: function _null(v) {

{
"name": "superstruct",
"description": "A simple, expressive way to validate data in Javascript.",
"version": "0.0.4",
"version": "0.0.5",
"license": "MIT",

@@ -37,2 +37,4 @@ "repository": "git://github.com/ianstormtaylor/superstruct.git",

"is-email": "^1.0.0",
"is-url": "^1.2.2",
"is-uuid": "^1.0.2",
"mocha": "^3.2.0",

@@ -39,0 +41,0 @@ "np": "^2.13.1",

@@ -14,5 +14,6 @@

<p align="center">
<a href="#example">Example</a> •
<a href="#usage">Usage</a> •
<a href="#why">Why?</a> •
<a href="#principles">Principles</a> •
<a href="#examples">Examples</a> •
<a href="#documentation">Documentation</a>

@@ -22,8 +23,2 @@ </p>

<p align="center">
<a href="https://www.npmjs.com/package/superstruct">
<img src="https://img.shields.io/npm/dt/superstruct.svg?maxAge=2592000">
</a>
<a href="https://unpkg.com/superstruct/dist/superstruct.min.js">
<img src="http://img.badgesize.io/https://unpkg.com/superstruct/dist/superstruct.min.js?compression=gzip&amp;label=superstruct">
</a>
<a href="https://travis-ci.org/ianstormtaylor/superstruct">

@@ -33,7 +28,4 @@ <img src="https://travis-ci.org/ianstormtaylor/superstruct.svg?branch=master">

<a href="./packages/superstruct/package.json">
<img src="https://img.shields.io/npm/v/superstruct.svg?maxAge=2592000&label=superstruct&colorB=007ec6">
<img src="https://img.shields.io/npm/v/superstruct.svg?maxAge=3600&label=superstruct&colorB=007ec6&maxAge=3600">
</a>
<a href="./License.md">
<img src="https://img.shields.io/npm/l/superstruct.svg?maxAge=2592000">
</a>
</p>

@@ -44,3 +36,3 @@

Superstruct makes it easy to define interfaces and then validate Javascript data against them. Its type annotation API was inspired by [Typescript](https://www.typescriptlang.org/docs/handbook/basic-types.html), [Flow](https://flow.org/en/docs/types/) and [GraphQL](http://graphql.org/learn/schema/). But Superstruct is designed for runtime data validations, for example when accepting input in a REST or GraphQL API.
Superstruct makes it easy to define interfaces and then validate Javascript data against them. Its type annotation API was inspired by [Typescript](https://www.typescriptlang.org/docs/handbook/basic-types.html), [Flow](https://flow.org/en/docs/types/) and [GraphQL](http://graphql.org/learn/schema/), which gives it a API familiar, easy to understand API. But Superstruct is designed for runtime data validations, like accepting arbitrary input in a REST or GraphQL API, so it throws detailed errors for you or your end users.

@@ -50,3 +42,3 @@

### Example
### Usage

@@ -61,3 +53,3 @@ Superstruct exports a `struct` factory for creating functions that validate data against a specific schema:

title: 'string',
is_published: 'boolean',
is_published: 'boolean?',
tags: ['string'],

@@ -73,3 +65,3 @@ author: {

is_published: true,
tags: ['announcements'],
tags: ['news', 'features'],
author: {

@@ -85,5 +77,5 @@ id: 1,

The schema definition syntax was inspired by [Typescript](https://www.typescriptlang.org/docs/handbook/basic-types.html), [Flow](https://flow.org/en/docs/types/) and [GraphQL](http://graphql.org/learn/schema/).
The schema definition syntax was inspired by [Typescript](https://www.typescriptlang.org/docs/handbook/basic-types.html), [Flow](https://flow.org/en/docs/types/) and [GraphQL](http://graphql.org/learn/schema/), and ships with types for all of the native Javascript types out of the box.
But you can also define your own types—specific to your application's requirements—by using the exported `superstruct` function. For example:
But you can also define your own custom data types—specific to your application's requirements—by using the exported `superstruct` function. For example:

@@ -98,3 +90,3 @@ ```js

types: {
uuid: v => isUuid.v5(v),
uuid: v => isUuid.v4(v),
email: v => isEmail(v) && v.length < 256,

@@ -111,3 +103,3 @@ }

const data = {
id: '5a2de30a-a736-5aea-8f7f-ad0f019cdc00',
id: 'c8d63140-a1f7-45e0-bfc6-df72973fea86',
email: 'jane@example.com',

@@ -166,5 +158,22 @@ }

### Examples
Superstruct's API is very flexible, allowing it to be used for a variety of use cases on your servers and in the browser. Here are a few examples to common patterns...
- [Basic Validation](./examples/basic-validation.js)
- [Custom Types](./examples/custom-types.js)
- [Default Values](./examples/default-values.js)
- [Composing Structs](./examples/composing-structs.js)
- [Throwing Errors](./examples/throwing-errors.js)
- [Custom Errors](./examples/custom-errors.js)
<br/>
### Documentation
Read the **Getting Started** guide to familiarize yourself with how Superstruct works. After that, check out the full API reference...
- [Getting Started](./docs/getting-started.md)
- [API Reference](./docs/api-reference.md)

@@ -171,0 +180,0 @@

@@ -18,3 +18,3 @@

error: v => typeOf(v) === 'error',
function: v => typeOf(v) === 'string',
function: v => typeOf(v) === 'function',
null: v => typeOf(v) === 'null',

@@ -21,0 +21,0 @@ number: v => typeOf(v) === 'number',

Sorry, the diff of this file is too big to display

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc