made with requirebin
Created
April 9, 2015 14:48
-
-
Save jquense/a02641b4ab651ce7a7db to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// require() some stuff from npm (like you were using browserify) | |
// and then hit Run Code to run it on the right | |
var yup = require('yup') | |
var assert = require('assert') | |
var schema = yup.object({ | |
name: yup.string(), | |
id: yup.string() | |
}); | |
schema.isValid({ name: 'hi' }).then(function(valid){ | |
assert(valid) | |
console.log('fin') | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=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 process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],2:[function(require,module,exports){"use strict";var babelHelpers=require("./util/babelHelpers.js");var MixedSchema=require("./mixed"),Promise=require("es6-promise").Promise,locale=require("./locale.js").array,inherits=require("./util/_").inherits;module.exports=ArraySchema;function ArraySchema(){if(!(this instanceof ArraySchema))return new ArraySchema;MixedSchema.call(this,{type:"array"});this.transforms.push(function(values){if(typeof values==="string")try{values=JSON.parse(values)}catch(err){values=null}if(Array.isArray(values))return this._subType?values.map(this._subType.cast,this._subType):values;return this.isType(values)?values:null})}inherits(ArraySchema,MixedSchema,{_typeCheck:function(v){return Array.isArray(v)},_validate:function(_value,_opts,_state){var context,subType,schema;_state=_state||{};context=_state.parent||(_opts||{}).context;schema=this._resolve(context);subType=schema._subType;return MixedSchema.prototype._validate.call(this,_value,_opts,_state).then(function(value){if(!subType||!Array.isArray(value))return value;return Promise.all(value.map(function(item,key){var path=(_state.path||"")+"["+key+"]",state=babelHelpers._extends({},_state,{path:path,key:key,parent:value});return subType._validate(item,_opts,state)})).then(function(){return value})})},of:function(schema){var next=this.clone();next._subType=schema;return next},required:function(msg){var _this=this;return this.validation({hashKey:"required",message:msg||locale.required},function(value){return _this.isType(value)&&!!value.length})},min:function(min,msg){msg=msg||locale.min;return this.validation({message:msg,hashKey:"min",params:{min:min}},function(value){return value&&value.length>=min})},max:function(max,msg){msg=msg||locale.max;return this.validation({message:msg,hashKey:"max",params:{max:max}},function(value){return value&&value.length<=max})},compact:function(rejector){var reject=!rejector?function(v){return!!v}:function(v,i,a){return!rejector(v,i,a)};return this.transform(function(values){return values.filter(reject)})}})},{"./locale.js":5,"./mixed":6,"./util/_":10,"./util/babelHelpers.js":11,"es6-promise":21}],3:[function(require,module,exports){"use strict";var MixedSchema=require("./mixed"),locale=require("./locale.js").boolean,inherits=require("./util/_").inherits;var isBool=function(v){return typeof v==="boolean"};module.exports=BooleanSchema;function BooleanSchema(){if(!(this instanceof BooleanSchema))return new BooleanSchema;MixedSchema.call(this,{type:"boolean"});this.transforms.push(function(value){if(this.isType(value))return value;return/true|1/i.test(value)})}inherits(BooleanSchema,MixedSchema,{_typeCheck:isBool,_coerce:function(value){if(this.isType(value))return value;return/true|1/i.test(value)},required:function(msg){return this.validation({hashKey:"required",message:msg||locale.required},isBool)}})},{"./locale.js":5,"./mixed":6,"./util/_":10}],4:[function(require,module,exports){"use strict";var MixedSchema=require("./mixed");var isoParse=require("./util/isodate");var locale=require("./locale.js").date;var _require=require("./util/_");var isDate=_require.isDate;var inherits=_require.inherits;var invalidDate=new Date("");module.exports=DateSchema;function DateSchema(){if(!(this instanceof DateSchema))return new DateSchema;MixedSchema.call(this,{type:"date"});this.transforms.push(function(value){if(this.isType(value))return isDate(value)?new Date(value):value;value=isoParse(value);return value?new Date(value):invalidDate})}inherits(DateSchema,MixedSchema,{_typeCheck:function(v){return isDate(v)&&!isNaN(v.getTime())},required:function(msg){return this.validation({hashKey:"required",message:msg||locale.required},isDate)},min:function(min,msg){var limit=this.cast(min);msg=msg||locale.min;if(!this.isType(limit))throw new TypeError("min must be a Date or a value that can be parsed to a Date");return this.validation({message:msg,hashKey:"min",params:{min:min}},function(value){return value&&value>=limit})},max:function(max,msg){var limit=this.cast(max);if(!this.isType(limit))throw new TypeError("max must be a Date or a value that can be parsed to a Date");return this.validation({hashKey:"max",message:msg||locale.max,params:{max:max}},function(value){return!value||value<=limit})}})},{"./locale.js":5,"./mixed":6,"./util/_":10,"./util/isodate":15}],5:[function(require,module,exports){module.exports={mixed:{required:"${path} is a required field",oneOf:"${path} must be one the following values: ${values}",notOneOf:"${path} must not be one the following values: ${values}"},string:{required:"${path} is a required field",min:"${path} must be at least ${min} characters",max:"${path} must be less than ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a uppercase string"},"boolean":{required:"${path} is a required field"},number:{required:"${path} is a required field",min:"${path} must be at least ${min}",max:"${path} must be less than or equal to ${max}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},date:{required:"${path} is a required field",min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},object:{required:"${path} is a required field"},array:{required:"${path} is a required field",min:"${path} field must have at least ${min} items",max:"${path} field must have less than ${max} items"}}},{}],6:[function(require,module,exports){"use strict";var babelHelpers=require("./util/babelHelpers.js");var interpolate=require("./util/interpolate"),Promise=require("es6-promise").Promise,Condition=require("./util/condition"),ValidationError=require("./util/validation-error"),getter=require("property-expr").getter,locale=require("./locale.js").mixed,_=require("./util/_"),cloneDeep=require("./util/clone"),BadSet=require("./util/set");module.exports=SchemaType;function SchemaType(){var options=arguments[0]===undefined?{}:arguments[0];if(!(this instanceof SchemaType))return new SchemaType;this._deps=[];this._conditions=[];this._options={};this._activeTests={};this._whitelist=new BadSet;this._blacklist=new BadSet;this.validations=[];this.transforms=[];if(_.has(options,"default"))this._default=options.default;this._type=options.type||"mixed"}SchemaType.prototype={__isYupSchema__:true,constructor:SchemaType,clone:function(){return cloneDeep(this)},concat:function(schema){return _.merge(this.clone(),schema.clone())},isType:function(v){if(this._nullable&&v===null)return true;return!this._typeCheck||this._typeCheck(v)},cast:function(_value,_opts){var schema=this._resolve((_opts||{}).context);return schema._cast(_value,_opts)},_cast:function(_value){var _this=this;var value=this._coerce&&_value!==undefined?this._coerce(_value):_value;if(value===undefined&&_.has(this,"_default"))value=this.default();return value===undefined?value:this.transforms.reduce(function(value,transform){return transform.call(_this,value,_value)},value)},_resolve:function(context){var schema=this;return this._conditions.reduce(function(schema,match){if(!context)throw new Error("missing the context necessary to cast this value");return match.resolve(schema,getter(match.key)(context))},schema)},_validate:function(value,_opts,_state){var valids=this._whitelist,invalids=this._blacklist,context=(_opts||{}).context||_state.parent,schema,valid,state,isStrict;state=_state;schema=this._resolve(context);isStrict=schema._option("strict",_opts);!state.path&&(state.path="this");var errors=[];if(!state.isCast&&!isStrict)value=schema._cast(value,_opts);if(value!==undefined&&!schema.isType(value)){errors.push("value: "+value+" is must be a "+schema._type+" type");return Promise.reject(new ValidationError(errors))}if(valids.length){valid=valids.has(value);if(!valid)return Promise.reject(new ValidationError(errors.concat(schema._whitelistError(babelHelpers._extends({values:valids.values().join(", ")},state)))))}if(invalids.has(value)){return Promise.reject(new ValidationError(errors.concat(schema._blacklistError(babelHelpers._extends({values:invalids.values().join(", ")},state)))))}return Promise.all(schema.validations.map(function(fn){return fn.call(schema,value,state)})).then(function(){if(errors.length)throw new ValidationError(errors);return value})},validate:function(value,options,cb){if(typeof options==="function")cb=options,options={};return nodeify(this._validate(value,options,{}),cb)},isValid:function(value,options,cb){if(typeof options==="function")cb=options,options={};return nodeify(this.validate(value,options).then(function(){return true}).catch(function(err){if(err instanceof ValidationError)return false;throw err}),cb)},"default":function(def){if(arguments.length===0){var dflt=this._default;return typeof dflt==="function"?dflt.call(this):cloneDeep(dflt)}var next=this.clone();next._default=def;return next},strict:function(){var next=this.clone();next._options.strict=true;return next},required:function(msg){var _this=this;return this.validation({hashKey:"required",message:msg||locale.required},function(value){return value!==undefined&&_this.isType(value)})},nullable:function(value){var next=this.clone();next._nullable=value===false?false:true;return next},transform:function(fn){var next=this.clone();next.transforms.push(fn);return next},validation:function(msg,validator,passInDoneCallback){var opts=msg,next=this.clone(),hashKey,errorMsg;if(typeof msg==="string")opts={message:msg};if(next._whitelist.length)throw new TypeError("Cannot add validations when specific valid values are specified");errorMsg=interpolate(opts.message);hashKey=opts.hashKey;if(!hashKey||!_.has(next._activeTests,hashKey)){if(hashKey)next._activeTests[hashKey]=true;next.validations.push(validate)}return next;function validate(value,state){var _this=this;var result=new Promise(function(resolve,reject){!passInDoneCallback?resolve(validator.call(_this,value)):validator.call(_this,value,function(err,valid){return err?reject(err):resolve(valid)})});return result.then(function(valid){if(!valid)throw new ValidationError(errorMsg(babelHelpers._extends({},state,opts.params)))})}},when:function(key,options){var next=this.clone();next._deps.push(key);next._conditions.push(new Condition(key,next,options));return next},oneOf:function(enums,msg){var next=this.clone();if(next.validations.length)throw new TypeError("Cannot specify values when there are validation rules specified");next._whitelistError=interpolate(msg||next._whitelistError||locale.oneOf);enums.forEach(function(val){next._blacklist.delete(val);next._whitelist.add(val)});return next},notOneOf:function(enums,msg){var next=this.clone();next._blacklistError=interpolate(msg||next._blacklistError||locale.notOneOf);enums.forEach(function(val){next._whitelist.delete(val);next._blacklist.add(val)});return next},_option:function(key,overrides){return _.has(overrides,key)?overrides[key]:this._options[key]}};var aliases={oneOf:["equals"]};for(var method in aliases)if(_.has(aliases,method))aliases[method].forEach(function(alias){return SchemaType.prototype[alias]=SchemaType.prototype[method]});function nodeify(promise,cb){if(typeof cb!=="function")return promise;promise.then(function(val){return cb(null,val)},function(err){return cb(err)})}},{"./locale.js":5,"./util/_":10,"./util/babelHelpers.js":11,"./util/clone":12,"./util/condition":13,"./util/interpolate":14,"./util/set":17,"./util/validation-error":19,"es6-promise":21,"property-expr":22}],7:[function(require,module,exports){"use strict";var SchemaObject=require("./mixed");var locale=require("./locale.js").number;var _require=require("./util/_");var isDate=_require.isDate;var inherits=_require.inherits;module.exports=NumberSchema;function NumberSchema(){if(!(this instanceof NumberSchema))return new NumberSchema;SchemaObject.call(this,{type:"number"});this.transforms.push(function(value){if(this.isType(value))return value;if(typeof value==="boolean")return value?1:0;return isDate(value)?+value:parseFloat(value)})}inherits(NumberSchema,SchemaObject,{_typeCheck:function(v){return typeof v==="number"&&!(v!==+v)},required:function(msg){var _this=this;return this.validation({hashKey:"required",message:msg||locale.required},function(v){return v!=null&&_this.isType(v)})},min:function(min,msg){return this.validation({hashKey:"min",params:{min:min},message:msg||locale.min},function(value){return value>=min})},max:function(max,msg){return this.validation({hashKey:"max",params:{max:max},message:msg||locale.max},function(value){return value<=max})},positive:function(max,msg){return this.min(0,msg||locale.positive)},negative:function(max,msg){return this.max(0,msg||locale.negative)},integer:function(msg){msg=msg||locale.integer;return this.transform(function(v){return v|0}).validation(msg,function(val){return val===(val|0)})},round:function(method){var avail=["ceil","floor","round"];method=method&&method.toLowerCase()||"round";if(avail.indexOf(method.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+avail.join(", "));return this.transform(function(v){return Math[method](v)})}})},{"./locale.js":5,"./mixed":6,"./util/_":10}],8:[function(require,module,exports){"use strict";var babelHelpers=require("./util/babelHelpers.js");var MixedSchema=require("./mixed");var Promise=require("es6-promise").Promise;var locale=require("./locale.js").object;var cloneDeep=require("./util/clone");var Topo=require("./util/topo");var c=require("case");var _require=require("./util/_");var isObject=_require.isObject;var isPlainObject=_require.isPlainObject;var transform=_require.transform;var assign=_require.assign;var inherits=_require.inherits;var has=_require.has;module.exports=ObjectSchema;function ObjectSchema(spec){if(!(this instanceof ObjectSchema))return new ObjectSchema(spec);MixedSchema.call(this,{type:"object","default":function(){var _this=this;var dft=transform(this._nodes,function(obj,key){var fieldDft=_this.fields[key].default();if(fieldDft!==undefined)obj[key]=fieldDft},{});return Object.keys(dft).length===0?undefined:dft}});this.transforms.push(function(value){if(typeof value==="string"){try{value=JSON.parse(value)}catch(err){value=null}}if(this.isType(value))return value;return null});this.fields=Object.create(null);this._nodes=[];if(spec)return this.shape(spec)}inherits(ObjectSchema,MixedSchema,{_typeCheck:function(value){return value&&typeof value==="object"&&!Array.isArray(value)},_cast:function(_value,_opts){var schema=this,value=MixedSchema.prototype._cast.call(schema,_value);if(schema.isType(value)){var fields=schema.fields,strip=schema._option("stripUnknown",_opts)===true,extra=Object.keys(value).filter(function(v){return schema._nodes.indexOf(v)===-1}),props=schema._nodes.concat(extra);return transform(props,function(obj,prop){var exists=has(value,prop);if(exists&&fields[prop])obj[prop]=fields[prop].cast(value[prop],{context:obj});else if(exists&&!strip)obj[prop]=cloneDeep(value[prop]);else if(fields[prop]){var fieldDefault=fields[prop].default();if(fieldDefault!==undefined)obj[prop]=fieldDefault}},{})}return value},_validate:function(_value,_opts,_state){var context,schema;_state=_state||{};context=_state.parent||(_opts||{}).context;schema=this._resolve(context);return MixedSchema.prototype._validate.call(this,_value,_opts,_state).then(function(value){if(!isObject(value))return value;return Promise.all(schema._nodes.map(function(key){var field=schema.fields[key],path=(_state.path?_state.path+".":"")+key;return field._validate(value[key],_opts,babelHelpers._extends({},_state,{key:key,path:path,parent:value}))})).then(function(){return value})})},shape:function(schema){var next=this.clone(),toposort=new Topo,fields=assign(next.fields,schema);for(var key in schema)if(has(schema,key))toposort.add(key,{after:schema[key]._deps,group:key});next.fields=fields;next._nodes=toposort.nodes;return next},required:function(msg){return this.validation({hashKey:"required",message:msg||locale.required},function(value){return!!value&&isPlainObject(value)})},from:function(from,to,alias){return this.transform(function(obj){var newObj=transform(obj,function(o,val,key){return key!==from&&(o[key]=val)},{});newObj[to]=obj[from];if(alias)newObj[from]=obj[from];return newObj})},camelcase:function(){return this.transform(function(obj){return transform(obj,function(newobj,val,key){return newobj[c.camel(key)]=val})})},constantcase:function(){return this.transform(function(obj){return transform(obj,function(newobj,val,key){return newobj[c.constant(key)]=val})})}})},{"./locale.js":5,"./mixed":6,"./util/_":10,"./util/babelHelpers.js":11,"./util/clone":12,"./util/topo":18,"case":20,"es6-promise":21}],9:[function(require,module,exports){"use strict";var MixedSchema=require("./mixed"),locale=require("./locale.js").string,inherits=require("./util/_").inherits;var rEmail=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;var rUrl=/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;module.exports=StringSchema;function StringSchema(){if(!(this instanceof StringSchema))return new StringSchema;MixedSchema.call(this,{type:"string"})}inherits(StringSchema,MixedSchema,{_typeCheck:function(value){return typeof value==="string"},_coerce:function(value){if(this.isType(value))return value;return value==null?"":value.toString?value.toString():""+value},required:function(msg){return this.validation({hashKey:"required",message:msg||locale.required},function(value){return value&&!!value.length})},min:function(min,msg){msg=msg||locale.min;return this.validation({message:msg,hashKey:"min",params:{min:min}},function(value){return value&&value.length>=min})},max:function(max,msg){msg=msg||locale.max;return this.validation({message:msg,hashKey:"max",params:{max:max}},function(value){return value&&value.length<=max})},matches:function(regex,msg){msg=msg||locale.matches;return this.validation({message:msg,params:{regex:regex}},function(value){return regex.test(value)})},email:function(msg){msg=msg||locale.email;return this.matches(rEmail,msg)},url:function(msg){msg=msg||locale.url;return this.matches(rUrl,msg)},trim:function(msg){msg=msg||locale.trim;return this.transform(function(v){return v.trim()}).validation(msg,function(val){return val===val.trim()})},lowercase:function(msg){msg=msg||locale.lowercase;return this.validation(msg,function(val){return val===val.toLowerCase()}).transform(function(v){return v.toLowerCase()})},uppercase:function(msg){msg=msg||locale.uppercase;return this.validation(msg,function(val){return val===val.toUpperCase()}).transform(function(v){return v.toUpperCase()})}})},{"./locale.js":5,"./mixed":6,"./util/_":10}],10:[function(require,module,exports){var toString=Object.prototype.toString;var isObject=function(obj){return obj&&toString.call(obj)==="[object Object]"};var isPlainObject=function(obj){return isObject(obj)&&Object.getPrototypeOf(obj)===Object.prototype};var isDate=function(obj){return Object.prototype.toString.call(obj)==="[object Date]"};function assign(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)if(has(source,key))target[key]=source[key]}return target}function transform(obj,cb,seed){cb=cb.bind(null,seed=seed||(Array.isArray(obj)?[]:{}));if(Array.isArray(obj))obj.forEach(cb);else for(var key in obj)if(has(obj,key))cb(obj[key],key,obj);return seed}function merge(target,source){for(var key in source)if(has(source,key)){var targetVal=target[key];var sourceVal=source[key];if(isObject(targetVal)||isObject(sourceVal))target[key]=merge(targetVal,sourceVal);else if(Array.isArray(targetVal)||Array.isArray(sourceVal))target[key]=sourceVal.concat?sourceVal.concat(targetVal):targetVal.concat(sourceVal);else target[key]=source[key]}return target}function has(o,k){return o?Object.prototype.hasOwnProperty.call(o,k):false}function inherits(ctor,superCtor,spec){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});assign(ctor.prototype,spec)}module.exports={inherits:inherits,has:has,assign:assign,merge:merge,transform:transform,isObject:isObject,isPlainObject:isPlainObject,isDate:isDate}},{}],11:[function(require,module,exports){(function(root,factory){if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports==="object"){factory(exports)}else{factory(root.babelHelpers={})}})(this,function(global){var babelHelpers=global;babelHelpers._extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key]}}}return target};babelHelpers.classCallCheck=function(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}})},{}],12:[function(require,module,exports){module.exports=function clone(obj,seen){var isFirst=!seen;if(typeof obj!=="object"||obj===null)return obj;seen=seen||{orig:[],copy:[]};var lookup=seen.orig.indexOf(obj);if(lookup!==-1)return seen.copy[lookup];var newObj;var cloneDeep=false;if(!Array.isArray(obj)){if(obj instanceof Date){newObj=new Date(obj.getTime())}else if(obj instanceof RegExp){newObj=new RegExp(obj)}else{var proto=Object.getPrototypeOf(obj);if(proto!==null&&(!proto||proto.__isYupSchema__&&!isFirst)){newObj=obj}else{newObj=Object.create(proto);cloneDeep=true}}}else{newObj=[];cloneDeep=true}seen.orig.push(obj);seen.copy.push(newObj);if(cloneDeep){var keys=Object.getOwnPropertyNames(obj);for(var i=0,il=keys.length;i<il;++i){var key=keys[i];var descriptor=Object.getOwnPropertyDescriptor(obj,key);if(descriptor.get||descriptor.set){Object.defineProperty(newObj,key,descriptor)}else{newObj[key]=clone(obj[key],seen)}}}return newObj}},{}],13:[function(require,module,exports){"use strict";var babelHelpers=require("./babelHelpers.js");var _require=require("./_");var has=_require.has;module.exports=Conditional;var Conditional=function(){function Conditional(key,current,options){babelHelpers.classCallCheck(this,Conditional);var type=current._type;this.key=key;if(typeof options==="function")this.fn=options;else{if(!has(options,"is"))throw new TypeError(".is must be provided");if(!options.then&&!options.otherwise)throw new TypeError(".then or .otherwise must be provided");if(options.then&&options.then._type!==type||options.otherwise&&options.otherwise._type!==type)throw new TypeError("cannot return polymorphic conditionals");this.is=options.is;this.then=options.then;this.otherwise=options.otherwise}}Conditional.prototype.resolve=function resolve(ctx,value){var schema,matches,then,otherwise;if(this.fn){schema=this.fn.call(ctx,value,ctx);if(schema!==undefined&&!schema.__isYupSchema__)throw new TypeError("conditions must return a schema object");return schema||ctx}matches=typeof this.is==="function"?this.is(value):this.is===value;then=this.then?ctx.concat(this.then):ctx;otherwise=this.otherwise?ctx.concat(this.otherwise):ctx;return matches?then:otherwise};return Conditional}();module.exports=Conditional},{"./_":10,"./babelHelpers.js":11}],14:[function(require,module,exports){"use strict";var expr=require("property-expr");var strReg=/\$\{\s*(\w+)\s*\}/g;module.exports=function strInterpolate(str,obj){if(arguments.length===1)return function(obj){return str.replace(strReg,function(_,key){return expr.getter(key)(obj)||""})};return str.replace(strReg,function(_,key){return expr.getter(key)(obj)||""})}},{"property-expr":22}],15:[function(require,module,exports){var isoReg=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;module.exports=function parseIsoDate(date){var numericKeys=[1,4,5,6,7,10,11],minutesOffset=0,timestamp,struct;if(struct=isoReg.exec(date)){for(var i=0,k;k=numericKeys[i];++i)struct[k]=+struct[k]||0;struct[2]=(+struct[2]||1)-1;struct[3]=+struct[3]||1;struct[7]=struct[7]?+(struct[7]+"00").substr(0,3):0;if((struct[8]===undefined||struct[8]==="")&&(struct[9]===undefined||struct[9]===""))timestamp=+new Date(struct[1],struct[2],struct[3],struct[4],struct[5],struct[6],struct[7]);else{if(struct[8]!=="Z"&&struct[9]!==undefined){minutesOffset=struct[10]*60+struct[11];if(struct[9]==="+")minutesOffset=0-minutesOffset}timestamp=Date.UTC(struct[1],struct[2],struct[3],struct[4],struct[5]+minutesOffset,struct[6],struct[7])}}else timestamp=Date.parse?Date.parse(date):NaN;return timestamp}},{}],16:[function(require,module,exports){"use strict";module.exports=function expr(obj,path){var parts=(path||"").split("."),part,idx;while(parts.length){part=parts.shift();if((idx=part.indexOf("["))!==-1)part=part.substr(0,idx);if(obj.fields){obj=obj.fields[part]||{};if(idx!==-1)obj=obj._subType||{}}else if(obj._subType)obj=obj._subType||{}}return obj}},{}],17:[function(require,module,exports){var babelHelpers=require("./babelHelpers.js");var toString=Object.prototype.toString;var isDate=function(obj){return toString.call(obj)==="[object Date]"};module.exports=function(){function BadSet(){babelHelpers.classCallCheck(this,BadSet);this._array=[];this.length=0}BadSet.prototype.values=function values(){return this._array};BadSet.prototype.add=function add(item){if(!this.has(item))this._array.push(item);this.length=this._array.length};BadSet.prototype.delete=function _delete(item){var idx=indexOf(this._array,item);if(idx!==-1)this._array.splice(idx,1);this.length=this._array.length};BadSet.prototype.has=function has(val){return indexOf(this._array,val)!==-1};return BadSet}();function indexOf(arr,val){for(var i=0;i<arr.length;i++){var item=arr[i];if(item===val||isDate(item)&&+val===+item)return i}return-1}},{"./babelHelpers.js":11}],18:[function(require,module,exports){module.exports=Topo;function Topo(){this._items=[];this.nodes=[]}Topo.prototype.add=function(nodes,options){var self=this;options=options||{};var before=[].concat(options.before||[]);var after=[].concat(options.after||[]);var group=options.group||"?";assert(before.indexOf(group)===-1,"Item cannot come before itself:"+group);assert(before.indexOf("?")===-1,"Item cannot come before unassociated items");assert(after.indexOf(group)===-1,"Item cannot come after itself: "+group);assert(after.indexOf("?")===-1,"Item cannot come after unassociated items");[].concat(nodes).forEach(function(node,i){var item={seq:self._items.length,before:before,after:after,group:group,node:node};self._items.push(item)});var error=this._sort();assert(!error,"item"+(group!=="?"?" added into group `"+group:"`")+" created a dependencies error");return this.nodes};Topo.prototype._sort=function(){var groups={};var graph={};var graphAfters={};for(var i=0,il=this._items.length;i<il;++i){var item=this._items[i];var seq=item.seq;var group=item.group;groups[group]=groups[group]||[];groups[group].push(seq);graph[seq]=[item.before];var after=item.after;for(var j=0,jl=after.length;j<jl;++j){graphAfters[after[j]]=(graphAfters[after[j]]||[]).concat(seq)}}var graphNodes=Object.keys(graph);for(i=0,il=graphNodes.length;i<il;++i){var node=graphNodes[i];var expandedGroups=[];var graphNodeItems=Object.keys(graph[node]);for(j=0,jl=graphNodeItems.length;j<jl;++j){var group=graph[node][graphNodeItems[j]];groups[group]=groups[group]||[];groups[group].forEach(function(d){return expandedGroups.push(d)})}graph[node]=expandedGroups}var afterNodes=Object.keys(graphAfters);for(i=0,il=afterNodes.length;i<il;++i){var group=afterNodes[i];if(groups[group]){for(j=0,jl=groups[group].length;j<jl;++j){var node=groups[group][j];graph[node]=graph[node].concat(graphAfters[group])}}}var ancestors={};graphNodes=Object.keys(graph);for(i=0,il=graphNodes.length;i<il;++i){var node=graphNodes[i];var children=graph[node];for(j=0,jl=children.length;j<jl;++j){ancestors[children[j]]=(ancestors[children[j]]||[]).concat(node)}}var visited={};var sorted=[]; | |
for(i=0,il=this._items.length;i<il;++i){var next=i;if(ancestors[i]){next=null;for(j=0,jl=this._items.length;j<jl;++j){if(visited[j]===true){continue}if(!ancestors[j]){ancestors[j]=[]}var shouldSeeCount=ancestors[j].length;var seenCount=0;for(var l=0,ll=shouldSeeCount;l<ll;++l){if(sorted.indexOf(ancestors[j][l])>=0){++seenCount}}if(seenCount===shouldSeeCount){next=j;break}}}if(next!==null){next=next.toString();visited[next]=true;sorted.push(next)}}if(sorted.length!==this._items.length){return new Error("Invalid dependencies")}var seqIndex={};this._items.forEach(function(item){return seqIndex[item.seq]=item});var sortedNodes=[];this._items=sorted.map(function(value){var item=seqIndex[value];sortedNodes.push(item.node);return item});this.nodes=sortedNodes};function assert(condition,msg){if(!condition)throw new Error(msg)}},{}],19:[function(require,module,exports){"use strict";module.exports=ValidationError;function ValidationError(errors){this.name="ValidationError";this.errors=errors==null?[]:[].concat(errors);this.message=this.errors[0];if(Error.captureStackTrace)Error.captureStackTrace(this,ValidationError)}ValidationError.prototype=Object.create(Error.prototype);ValidationError.prototype.constructor=ValidationError},{}],20:[function(require,module,exports){(function(){"use strict";var unicodes=function(s,prefix){prefix=prefix||"";return s.replace(/(^|-)/g,"$1\\u"+prefix).replace(/,/g,"\\u"+prefix)},basicSymbols=unicodes("20-2F,3A-40,5B-60,7B-7E,A0-BF,D7,F7","00"),baseLowerCase="a-z"+unicodes("DF-F6,F8-FF","00"),baseUpperCase="A-Z"+unicodes("C0-D6,D8-DE","00"),improperInTitle="A|An|And|As|At|But|By|En|For|If|In|Of|On|Or|The|To|Vs?\\.?|Via",regexps=function(symbols,lowers,uppers,impropers){symbols=symbols||basicSymbols;lowers=lowers||baseLowerCase;uppers=uppers||baseUpperCase;impropers=impropers||improperInTitle;return{capitalize:new RegExp("(^|["+symbols+"])(["+lowers+"])","g"),pascal:new RegExp("(^|["+symbols+"])+(["+lowers+uppers+"])","g"),fill:new RegExp("["+symbols+"]+(.|$)","g"),sentence:new RegExp('(^\\s*|[\\?\\!\\.]+"?\\s+"?|,\\s+")(['+lowers+"])","g"),improper:new RegExp("\\b("+impropers+")\\b","g"),relax:new RegExp("([^"+uppers+"])(["+uppers+"]*)(["+uppers+"])(?=["+lowers+"]|$)","g"),upper:new RegExp("^[^"+lowers+"]+$"),hole:/\s/,room:new RegExp("["+symbols+"]")}},re=regexps(),_={re:re,unicodes:unicodes,regexps:regexps,types:[],up:String.prototype.toUpperCase,low:String.prototype.toLowerCase,cap:function(s){return _.up.call(s.charAt(0))+s.slice(1)},decap:function(s){return _.low.call(s.charAt(0))+s.slice(1)},fill:function(s,fill){return!s||fill==null?s:s.replace(re.fill,function(m,next){return next?fill+next:""})},prep:function(s,fill,pascal,upper){if(!s){return s||""}if(!upper&&re.upper.test(s)){s=_.low.call(s)}if(!fill&&!re.hole.test(s)){s=_.fill(s," ")}if(!pascal&&!re.room.test(s)){s=s.replace(re.relax,_.relax)}return s},relax:function(m,before,acronym,caps){return before+" "+(acronym?acronym+" ":"")+caps}},Case={_:_,of:function(s){for(var i=0,m=_.types.length;i<m;i++){if(Case[_.types[i]](s)===s){return _.types[i]}}},flip:function(s){return s.replace(/\w/g,function(l){return l==_.up.call(l)?_.low.call(l):_.up.call(l)})},type:function(type,fn){Case[type]=fn;_.types.push(type)}},types={snake:function(s){return Case.lower(s,"_")},constant:function(s){return Case.upper(s,"_")},camel:function(s){return _.decap(Case.pascal(s))},lower:function(s,fill){return _.fill(_.low.call(_.prep(s,fill)),fill)},upper:function(s,fill){return _.fill(_.up.call(_.prep(s,fill,false,true)),fill)},capital:function(s,fill){return _.fill(_.prep(s).replace(re.capitalize,function(m,border,letter){return border+_.up.call(letter)}),fill)},pascal:function(s){return _.fill(_.prep(s,false,true).replace(re.pascal,function(m,border,letter){return _.up.call(letter)}),"")},title:function(s){return Case.capital(s).replace(re.improper,function(small){return _.low.call(small)})},sentence:function(s,names){s=Case.lower(s).replace(re.sentence,function(m,prelude,letter){return prelude+_.up.call(letter)});if(names){names.forEach(function(name){s=s.replace(new RegExp("\\b"+Case.lower(name)+"\\b","g"),_.cap)})}return s}};types.squish=types.pascal;for(var type in types){Case.type(type,types[type])}var define=typeof define==="function"?define:function(){};define(typeof module==="object"&&module.exports?module.exports=Case:this.Case=Case)}).call(this)},{}],21:[function(require,module,exports){(function(process,global){(function(){"use strict";function $$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function $$utils$$isFunction(x){return typeof x==="function"}function $$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var $$utils$$_isArray;if(!Array.isArray){$$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{$$utils$$_isArray=Array.isArray}var $$utils$$isArray=$$utils$$_isArray;var $$utils$$now=Date.now||function(){return(new Date).getTime()};function $$utils$$F(){}var $$utils$$o_create=Object.create||function(o){if(arguments.length>1){throw new Error("Second argument not supported")}if(typeof o!=="object"){throw new TypeError("Argument must be an object")}$$utils$$F.prototype=o;return new $$utils$$F};var $$asap$$len=0;var $$asap$$default=function asap(callback,arg){$$asap$$queue[$$asap$$len]=callback;$$asap$$queue[$$asap$$len+1]=arg;$$asap$$len+=2;if($$asap$$len===2){$$asap$$scheduleFlush()}};var $$asap$$browserGlobal=typeof window!=="undefined"?window:{};var $$asap$$BrowserMutationObserver=$$asap$$browserGlobal.MutationObserver||$$asap$$browserGlobal.WebKitMutationObserver;var $$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function $$asap$$useNextTick(){return function(){process.nextTick($$asap$$flush)}}function $$asap$$useMutationObserver(){var iterations=0;var observer=new $$asap$$BrowserMutationObserver($$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function $$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=$$asap$$flush;return function(){channel.port2.postMessage(0)}}function $$asap$$useSetTimeout(){return function(){setTimeout($$asap$$flush,1)}}var $$asap$$queue=new Array(1e3);function $$asap$$flush(){for(var i=0;i<$$asap$$len;i+=2){var callback=$$asap$$queue[i];var arg=$$asap$$queue[i+1];callback(arg);$$asap$$queue[i]=undefined;$$asap$$queue[i+1]=undefined}$$asap$$len=0}var $$asap$$scheduleFlush;if(typeof process!=="undefined"&&{}.toString.call(process)==="[object process]"){$$asap$$scheduleFlush=$$asap$$useNextTick()}else if($$asap$$BrowserMutationObserver){$$asap$$scheduleFlush=$$asap$$useMutationObserver()}else if($$asap$$isWorker){$$asap$$scheduleFlush=$$asap$$useMessageChannel()}else{$$asap$$scheduleFlush=$$asap$$useSetTimeout()}function $$$internal$$noop(){}var $$$internal$$PENDING=void 0;var $$$internal$$FULFILLED=1;var $$$internal$$REJECTED=2;var $$$internal$$GET_THEN_ERROR=new $$$internal$$ErrorObject;function $$$internal$$selfFullfillment(){return new TypeError("You cannot resolve a promise with itself")}function $$$internal$$cannotReturnOwn(){return new TypeError("A promises callback cannot return that same promise.")}function $$$internal$$getThen(promise){try{return promise.then}catch(error){$$$internal$$GET_THEN_ERROR.error=error;return $$$internal$$GET_THEN_ERROR}}function $$$internal$$tryThen(then,value,fulfillmentHandler,rejectionHandler){try{then.call(value,fulfillmentHandler,rejectionHandler)}catch(e){return e}}function $$$internal$$handleForeignThenable(promise,thenable,then){$$asap$$default(function(promise){var sealed=false;var error=$$$internal$$tryThen(then,thenable,function(value){if(sealed){return}sealed=true;if(thenable!==value){$$$internal$$resolve(promise,value)}else{$$$internal$$fulfill(promise,value)}},function(reason){if(sealed){return}sealed=true;$$$internal$$reject(promise,reason)},"Settle: "+(promise._label||" unknown promise"));if(!sealed&&error){sealed=true;$$$internal$$reject(promise,error)}},promise)}function $$$internal$$handleOwnThenable(promise,thenable){if(thenable._state===$$$internal$$FULFILLED){$$$internal$$fulfill(promise,thenable._result)}else if(promise._state===$$$internal$$REJECTED){$$$internal$$reject(promise,thenable._result)}else{$$$internal$$subscribe(thenable,undefined,function(value){$$$internal$$resolve(promise,value)},function(reason){$$$internal$$reject(promise,reason)})}}function $$$internal$$handleMaybeThenable(promise,maybeThenable){if(maybeThenable.constructor===promise.constructor){$$$internal$$handleOwnThenable(promise,maybeThenable)}else{var then=$$$internal$$getThen(maybeThenable);if(then===$$$internal$$GET_THEN_ERROR){$$$internal$$reject(promise,$$$internal$$GET_THEN_ERROR.error)}else if(then===undefined){$$$internal$$fulfill(promise,maybeThenable)}else if($$utils$$isFunction(then)){$$$internal$$handleForeignThenable(promise,maybeThenable,then)}else{$$$internal$$fulfill(promise,maybeThenable)}}}function $$$internal$$resolve(promise,value){if(promise===value){$$$internal$$reject(promise,$$$internal$$selfFullfillment())}else if($$utils$$objectOrFunction(value)){$$$internal$$handleMaybeThenable(promise,value)}else{$$$internal$$fulfill(promise,value)}}function $$$internal$$publishRejection(promise){if(promise._onerror){promise._onerror(promise._result)}$$$internal$$publish(promise)}function $$$internal$$fulfill(promise,value){if(promise._state!==$$$internal$$PENDING){return}promise._result=value;promise._state=$$$internal$$FULFILLED;if(promise._subscribers.length===0){}else{$$asap$$default($$$internal$$publish,promise)}}function $$$internal$$reject(promise,reason){if(promise._state!==$$$internal$$PENDING){return}promise._state=$$$internal$$REJECTED;promise._result=reason;$$asap$$default($$$internal$$publishRejection,promise)}function $$$internal$$subscribe(parent,child,onFulfillment,onRejection){var subscribers=parent._subscribers;var length=subscribers.length;parent._onerror=null;subscribers[length]=child;subscribers[length+$$$internal$$FULFILLED]=onFulfillment;subscribers[length+$$$internal$$REJECTED]=onRejection;if(length===0&&parent._state){$$asap$$default($$$internal$$publish,parent)}}function $$$internal$$publish(promise){var subscribers=promise._subscribers;var settled=promise._state;if(subscribers.length===0){return}var child,callback,detail=promise._result;for(var i=0;i<subscribers.length;i+=3){child=subscribers[i];callback=subscribers[i+settled];if(child){$$$internal$$invokeCallback(settled,child,callback,detail)}else{callback(detail)}}promise._subscribers.length=0}function $$$internal$$ErrorObject(){this.error=null}var $$$internal$$TRY_CATCH_ERROR=new $$$internal$$ErrorObject;function $$$internal$$tryCatch(callback,detail){try{return callback(detail)}catch(e){$$$internal$$TRY_CATCH_ERROR.error=e;return $$$internal$$TRY_CATCH_ERROR}}function $$$internal$$invokeCallback(settled,promise,callback,detail){var hasCallback=$$utils$$isFunction(callback),value,error,succeeded,failed;if(hasCallback){value=$$$internal$$tryCatch(callback,detail);if(value===$$$internal$$TRY_CATCH_ERROR){failed=true;error=value.error;value=null}else{succeeded=true}if(promise===value){$$$internal$$reject(promise,$$$internal$$cannotReturnOwn());return}}else{value=detail;succeeded=true}if(promise._state!==$$$internal$$PENDING){}else if(hasCallback&&succeeded){$$$internal$$resolve(promise,value)}else if(failed){$$$internal$$reject(promise,error)}else if(settled===$$$internal$$FULFILLED){$$$internal$$fulfill(promise,value)}else if(settled===$$$internal$$REJECTED){$$$internal$$reject(promise,value)}}function $$$internal$$initializePromise(promise,resolver){try{resolver(function resolvePromise(value){$$$internal$$resolve(promise,value)},function rejectPromise(reason){$$$internal$$reject(promise,reason)})}catch(e){$$$internal$$reject(promise,e)}}function $$$enumerator$$makeSettledResult(state,position,value){if(state===$$$internal$$FULFILLED){return{state:"fulfilled",value:value}}else{return{state:"rejected",reason:value}}}function $$$enumerator$$Enumerator(Constructor,input,abortOnReject,label){this._instanceConstructor=Constructor;this.promise=new Constructor($$$internal$$noop,label);this._abortOnReject=abortOnReject;if(this._validateInput(input)){this._input=input;this.length=input.length;this._remaining=input.length;this._init();if(this.length===0){$$$internal$$fulfill(this.promise,this._result)}else{this.length=this.length||0;this._enumerate();if(this._remaining===0){$$$internal$$fulfill(this.promise,this._result)}}}else{$$$internal$$reject(this.promise,this._validationError())}}$$$enumerator$$Enumerator.prototype._validateInput=function(input){return $$utils$$isArray(input)};$$$enumerator$$Enumerator.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")};$$$enumerator$$Enumerator.prototype._init=function(){this._result=new Array(this.length)};var $$$enumerator$$default=$$$enumerator$$Enumerator;$$$enumerator$$Enumerator.prototype._enumerate=function(){var length=this.length;var promise=this.promise;var input=this._input;for(var i=0;promise._state===$$$internal$$PENDING&&i<length;i++){this._eachEntry(input[i],i)}};$$$enumerator$$Enumerator.prototype._eachEntry=function(entry,i){var c=this._instanceConstructor;if($$utils$$isMaybeThenable(entry)){if(entry.constructor===c&&entry._state!==$$$internal$$PENDING){entry._onerror=null;this._settledAt(entry._state,i,entry._result)}else{this._willSettleAt(c.resolve(entry),i)}}else{this._remaining--;this._result[i]=this._makeResult($$$internal$$FULFILLED,i,entry)}};$$$enumerator$$Enumerator.prototype._settledAt=function(state,i,value){var promise=this.promise;if(promise._state===$$$internal$$PENDING){this._remaining--;if(this._abortOnReject&&state===$$$internal$$REJECTED){$$$internal$$reject(promise,value)}else{this._result[i]=this._makeResult(state,i,value)}}if(this._remaining===0){$$$internal$$fulfill(promise,this._result)}};$$$enumerator$$Enumerator.prototype._makeResult=function(state,i,value){return value};$$$enumerator$$Enumerator.prototype._willSettleAt=function(promise,i){var enumerator=this;$$$internal$$subscribe(promise,undefined,function(value){enumerator._settledAt($$$internal$$FULFILLED,i,value)},function(reason){enumerator._settledAt($$$internal$$REJECTED,i,reason)})};var $$promise$all$$default=function all(entries,label){return new $$$enumerator$$default(this,entries,true,label).promise};var $$promise$race$$default=function race(entries,label){var Constructor=this;var promise=new Constructor($$$internal$$noop,label);if(!$$utils$$isArray(entries)){$$$internal$$reject(promise,new TypeError("You must pass an array to race."));return promise}var length=entries.length;function onFulfillment(value){$$$internal$$resolve(promise,value)}function onRejection(reason){$$$internal$$reject(promise,reason)}for(var i=0;promise._state===$$$internal$$PENDING&&i<length;i++){$$$internal$$subscribe(Constructor.resolve(entries[i]),undefined,onFulfillment,onRejection)}return promise};var $$promise$resolve$$default=function resolve(object,label){var Constructor=this;if(object&&typeof object==="object"&&object.constructor===Constructor){return object}var promise=new Constructor($$$internal$$noop,label);$$$internal$$resolve(promise,object);return promise};var $$promise$reject$$default=function reject(reason,label){var Constructor=this;var promise=new Constructor($$$internal$$noop,label);$$$internal$$reject(promise,reason);return promise};var $$es6$promise$promise$$counter=0;function $$es6$promise$promise$$needsResolver(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function $$es6$promise$promise$$needsNew(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var $$es6$promise$promise$$default=$$es6$promise$promise$$Promise;function $$es6$promise$promise$$Promise(resolver){this._id=$$es6$promise$promise$$counter++;this._state=undefined;this._result=undefined;this._subscribers=[];if($$$internal$$noop!==resolver){if(!$$utils$$isFunction(resolver)){$$es6$promise$promise$$needsResolver()}if(!(this instanceof $$es6$promise$promise$$Promise)){$$es6$promise$promise$$needsNew()}$$$internal$$initializePromise(this,resolver)}}$$es6$promise$promise$$Promise.all=$$promise$all$$default;$$es6$promise$promise$$Promise.race=$$promise$race$$default;$$es6$promise$promise$$Promise.resolve=$$promise$resolve$$default;$$es6$promise$promise$$Promise.reject=$$promise$reject$$default;$$es6$promise$promise$$Promise.prototype={constructor:$$es6$promise$promise$$Promise,then:function(onFulfillment,onRejection){var parent=this;var state=parent._state;if(state===$$$internal$$FULFILLED&&!onFulfillment||state===$$$internal$$REJECTED&&!onRejection){return this}var child=new this.constructor($$$internal$$noop);var result=parent._result;if(state){var callback=arguments[state-1];$$asap$$default(function(){$$$internal$$invokeCallback(state,child,callback,result)})}else{$$$internal$$subscribe(parent,child,onFulfillment,onRejection)}return child},"catch":function(onRejection){return this.then(null,onRejection)}};var $$es6$promise$polyfill$$default=function polyfill(){var local;if(typeof global!=="undefined"){local=global}else if(typeof window!=="undefined"&&window.document){local=window}else{local=self}var es6PromiseSupport="Promise"in local&&"resolve"in local.Promise&&"reject"in local.Promise&&"all"in local.Promise&&"race"in local.Promise&&function(){var resolve;new local.Promise(function(r){resolve=r});return $$utils$$isFunction(resolve)}();if(!es6PromiseSupport){local.Promise=$$es6$promise$promise$$default}};var es6$promise$umd$$ES6Promise={Promise:$$es6$promise$promise$$default,polyfill:$$es6$promise$polyfill$$default};if(typeof define==="function"&&define["amd"]){define(function(){return es6$promise$umd$$ES6Promise})}else if(typeof module!=="undefined"&&module["exports"]){module["exports"]=es6$promise$umd$$ES6Promise}else if(typeof this!=="undefined"){this["ES6Promise"]=es6$promise$umd$$ES6Promise}}).call(this)}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{_process:1}],22:[function(require,module,exports){"use strict";var regexCache={},setCache={},getCache={};module.exports={expr:expr,setter:function(path){return setCache[path]||(setCache[path]=new Function("data, value",expr(path,"data")+" = value"))},getter:function(path,safe){var k=path+"_"+safe;return getCache[k]||(getCache[k]=new Function("data","return "+expr(path,safe,"data")))}};function expr(expression,safe,param){var SPLIT_REGEX=/[^.^\]^[]+|(?=\[\]|\.\.)/g;expression=expression||"";if(typeof safe==="string"){param=safe;safe=false}param=param||"data";if(expression&&expression.charAt(0)!=="[")expression="."+expression;return safe?makeSafe(expression.match(SPLIT_REGEX),param):param+expression}function makeSafe(parts,param){var result=param,part,idx,isLast,isArray,isBracket;for(idx=0;idx<parts.length;idx++){part=parts[idx];isLast=idx===parts.length-1;if(part){isBracket=["'",'"'].indexOf(part.charAt(0))!==-1;isArray=/^\d+$/.test(part);part=isBracket||isArray?"["+part+"]":"."+part;result+=part+(!isLast?" || {})":")")}}return new Array(parts.length+1).join("(")+result}},{}],yup:[function(require,module,exports){"use strict";var mixed=require("./mixed"),bool=require("./boolean");module.exports={mixed:mixed,string:require("./string"),number:require("./number"),"boolean":bool,bool:bool,date:require("./date"),object:require("./object"),array:require("./array"),reach:require("./util/reach"),ValidationError:require("./util/validation-error")}},{"./array":2,"./boolean":3,"./date":4,"./mixed":6,"./number":7,"./object":8,"./string":9,"./util/reach":16,"./util/validation-error":19}]},{},[]);require=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){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],2:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],3:[function(require,module,exports){module.exports=function isBuffer(arg){return arg&&typeof arg==="object"&&typeof arg.copy==="function"&&typeof arg.fill==="function"&&typeof arg.readUInt8==="function"}},{}],4:[function(require,module,exports){(function(process,global){var formatRegExp=/%[sdj%]/g;exports.format=function(f){if(!isString(f)){var objects=[];for(var i=0;i<arguments.length;i++){objects.push(inspect(arguments[i]))}return objects.join(" ")}var i=1;var args=arguments;var len=args.length;var str=String(f).replace(formatRegExp,function(x){if(x==="%%")return"%";if(i>=len)return x;switch(x){case"%s":return String(args[i++]);case"%d":return Number(args[i++]);case"%j":try{return JSON.stringify(args[i++])}catch(_){return"[Circular]"}default:return x}});for(var x=args[i];i<len;x=args[++i]){if(isNull(x)||!isObject(x)){str+=" "+x}else{str+=" "+inspect(x)}}return str};exports.deprecate=function(fn,msg){if(isUndefined(global.process)){return function(){return exports.deprecate(fn,msg).apply(this,arguments)}}if(process.noDeprecation===true){return fn}var warned=false;function deprecated(){if(!warned){if(process.throwDeprecation){throw new Error(msg)}else if(process.traceDeprecation){console.trace(msg)}else{console.error(msg)}warned=true}return fn.apply(this,arguments)}return deprecated};var debugs={};var debugEnviron;exports.debuglog=function(set){if(isUndefined(debugEnviron))debugEnviron=process.env.NODE_DEBUG||"";set=set.toUpperCase();if(!debugs[set]){if(new RegExp("\\b"+set+"\\b","i").test(debugEnviron)){var pid=process.pid;debugs[set]=function(){var msg=exports.format.apply(exports,arguments);console.error("%s %d: %s",set,pid,msg)}}else{debugs[set]=function(){}}}return debugs[set]};function inspect(obj,opts){var ctx={seen:[],stylize:stylizeNoColor};if(arguments.length>=3)ctx.depth=arguments[2];if(arguments.length>=4)ctx.colors=arguments[3];if(isBoolean(opts)){ctx.showHidden=opts}else if(opts){exports._extend(ctx,opts)}if(isUndefined(ctx.showHidden))ctx.showHidden=false;if(isUndefined(ctx.depth))ctx.depth=2;if(isUndefined(ctx.colors))ctx.colors=false;if(isUndefined(ctx.customInspect))ctx.customInspect=true;if(ctx.colors)ctx.stylize=stylizeWithColor;return formatValue(ctx,obj,ctx.depth)}exports.inspect=inspect;inspect.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]};inspect.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};function stylizeWithColor(str,styleType){var style=inspect.styles[styleType];if(style){return"["+inspect.colors[style][0]+"m"+str+"["+inspect.colors[style][1]+"m"}else{return str}}function stylizeNoColor(str,styleType){return str}function arrayToHash(array){var hash={};array.forEach(function(val,idx){hash[val]=true});return hash}function formatValue(ctx,value,recurseTimes){if(ctx.customInspect&&value&&isFunction(value.inspect)&&value.inspect!==exports.inspect&&!(value.constructor&&value.constructor.prototype===value)){var ret=value.inspect(recurseTimes,ctx);if(!isString(ret)){ret=formatValue(ctx,ret,recurseTimes)}return ret}var primitive=formatPrimitive(ctx,value);if(primitive){return primitive}var keys=Object.keys(value);var visibleKeys=arrayToHash(keys);if(ctx.showHidden){keys=Object.getOwnPropertyNames(value)}if(isError(value)&&(keys.indexOf("message")>=0||keys.indexOf("description")>=0)){return formatError(value)}if(keys.length===0){if(isFunction(value)){var name=value.name?": "+value.name:"";return ctx.stylize("[Function"+name+"]","special")}if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}if(isDate(value)){return ctx.stylize(Date.prototype.toString.call(value),"date")}if(isError(value)){return formatError(value)}}var base="",array=false,braces=["{","}"];if(isArray(value)){array=true;braces=["[","]"]}if(isFunction(value)){var n=value.name?": "+value.name:"";base=" [Function"+n+"]"}if(isRegExp(value)){base=" "+RegExp.prototype.toString.call(value)}if(isDate(value)){base=" "+Date.prototype.toUTCString.call(value)}if(isError(value)){base=" "+formatError(value)}if(keys.length===0&&(!array||value.length==0)){return braces[0]+base+braces[1]}if(recurseTimes<0){if(isRegExp(value)){return ctx.stylize(RegExp.prototype.toString.call(value),"regexp")}else{return ctx.stylize("[Object]","special")}}ctx.seen.push(value);var output;if(array){output=formatArray(ctx,value,recurseTimes,visibleKeys,keys)}else{output=keys.map(function(key){return formatProperty(ctx,value,recurseTimes,visibleKeys,key,array)})}ctx.seen.pop();return reduceToSingleString(output,base,braces)}function formatPrimitive(ctx,value){if(isUndefined(value))return ctx.stylize("undefined","undefined");if(isString(value)){var simple="'"+JSON.stringify(value).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return ctx.stylize(simple,"string")}if(isNumber(value))return ctx.stylize(""+value,"number");if(isBoolean(value))return ctx.stylize(""+value,"boolean");if(isNull(value))return ctx.stylize("null","null")}function formatError(value){return"["+Error.prototype.toString.call(value)+"]"}function formatArray(ctx,value,recurseTimes,visibleKeys,keys){var output=[];for(var i=0,l=value.length;i<l;++i){if(hasOwnProperty(value,String(i))){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,String(i),true))}else{output.push("")}}keys.forEach(function(key){if(!key.match(/^\d+$/)){output.push(formatProperty(ctx,value,recurseTimes,visibleKeys,key,true))}});return output}function formatProperty(ctx,value,recurseTimes,visibleKeys,key,array){var name,str,desc;desc=Object.getOwnPropertyDescriptor(value,key)||{value:value[key]};if(desc.get){if(desc.set){str=ctx.stylize("[Getter/Setter]","special")}else{str=ctx.stylize("[Getter]","special")}}else{if(desc.set){str=ctx.stylize("[Setter]","special")}}if(!hasOwnProperty(visibleKeys,key)){name="["+key+"]"}if(!str){if(ctx.seen.indexOf(desc.value)<0){if(isNull(recurseTimes)){str=formatValue(ctx,desc.value,null)}else{str=formatValue(ctx,desc.value,recurseTimes-1)}if(str.indexOf("\n")>-1){if(array){str=str.split("\n").map(function(line){return" "+line}).join("\n").substr(2)}else{str="\n"+str.split("\n").map(function(line){return" "+line}).join("\n")}}}else{str=ctx.stylize("[Circular]","special")}}if(isUndefined(name)){if(array&&key.match(/^\d+$/)){return str}name=JSON.stringify(""+key);if(name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)){name=name.substr(1,name.length-2);name=ctx.stylize(name,"name")}else{name=name.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'");name=ctx.stylize(name,"string")}}return name+": "+str}function reduceToSingleString(output,base,braces){var numLinesEst=0;var length=output.reduce(function(prev,cur){numLinesEst++;if(cur.indexOf("\n")>=0)numLinesEst++;return prev+cur.replace(/\u001b\[\d\d?m/g,"").length+1},0);if(length>60){return braces[0]+(base===""?"":base+"\n ")+" "+output.join(",\n ")+" "+braces[1]}return braces[0]+base+" "+output.join(", ")+" "+braces[1]}function isArray(ar){return Array.isArray(ar)}exports.isArray=isArray;function isBoolean(arg){return typeof arg==="boolean"}exports.isBoolean=isBoolean;function isNull(arg){return arg===null}exports.isNull=isNull;function isNullOrUndefined(arg){return arg==null}exports.isNullOrUndefined=isNullOrUndefined;function isNumber(arg){return typeof arg==="number"}exports.isNumber=isNumber;function isString(arg){return typeof arg==="string"}exports.isString=isString;function isSymbol(arg){return typeof arg==="symbol"}exports.isSymbol=isSymbol;function isUndefined(arg){return arg===void 0}exports.isUndefined=isUndefined;function isRegExp(re){return isObject(re)&&objectToString(re)==="[object RegExp]"}exports.isRegExp=isRegExp;function isObject(arg){return typeof arg==="object"&&arg!==null}exports.isObject=isObject;function isDate(d){return isObject(d)&&objectToString(d)==="[object Date]"}exports.isDate=isDate;function isError(e){return isObject(e)&&(objectToString(e)==="[object Error]"||e instanceof Error)}exports.isError=isError;function isFunction(arg){return typeof arg==="function"}exports.isFunction=isFunction;function isPrimitive(arg){return arg===null||typeof arg==="boolean"||typeof arg==="number"||typeof arg==="string"||typeof arg==="symbol"||typeof arg==="undefined"}exports.isPrimitive=isPrimitive;exports.isBuffer=require("./support/isBuffer");function objectToString(o){return Object.prototype.toString.call(o)}function pad(n){return n<10?"0"+n.toString(10):n.toString(10)}var months=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function timestamp(){var d=new Date;var time=[pad(d.getHours()),pad(d.getMinutes()),pad(d.getSeconds())].join(":");return[d.getDate(),months[d.getMonth()],time].join(" ")}exports.log=function(){console.log("%s - %s",timestamp(),exports.format.apply(exports,arguments))};exports.inherits=require("inherits");exports._extend=function(origin,add){if(!add||!isObject(add))return origin;var keys=Object.keys(add);var i=keys.length;while(i--){origin[keys[i]]=add[keys[i]]}return origin};function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}}).call(this,require("_process"),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./support/isBuffer":3,_process:2,inherits:1}],assert:[function(require,module,exports){var util=require("util/"); | |
var pSlice=Array.prototype.slice;var hasOwn=Object.prototype.hasOwnProperty;var assert=module.exports=ok;assert.AssertionError=function AssertionError(options){this.name="AssertionError";this.actual=options.actual;this.expected=options.expected;this.operator=options.operator;if(options.message){this.message=options.message;this.generatedMessage=false}else{this.message=getMessage(this);this.generatedMessage=true}var stackStartFunction=options.stackStartFunction||fail;if(Error.captureStackTrace){Error.captureStackTrace(this,stackStartFunction)}else{var err=new Error;if(err.stack){var out=err.stack;var fn_name=stackStartFunction.name;var idx=out.indexOf("\n"+fn_name);if(idx>=0){var next_line=out.indexOf("\n",idx+1);out=out.substring(next_line+1)}this.stack=out}}};util.inherits(assert.AssertionError,Error);function replacer(key,value){if(util.isUndefined(value)){return""+value}if(util.isNumber(value)&&(isNaN(value)||!isFinite(value))){return value.toString()}if(util.isFunction(value)||util.isRegExp(value)){return value.toString()}return value}function truncate(s,n){if(util.isString(s)){return s.length<n?s:s.slice(0,n)}else{return s}}function getMessage(self){return truncate(JSON.stringify(self.actual,replacer),128)+" "+self.operator+" "+truncate(JSON.stringify(self.expected,replacer),128)}function fail(actual,expected,message,operator,stackStartFunction){throw new assert.AssertionError({message:message,actual:actual,expected:expected,operator:operator,stackStartFunction:stackStartFunction})}assert.fail=fail;function ok(value,message){if(!value)fail(value,true,message,"==",assert.ok)}assert.ok=ok;assert.equal=function equal(actual,expected,message){if(actual!=expected)fail(actual,expected,message,"==",assert.equal)};assert.notEqual=function notEqual(actual,expected,message){if(actual==expected){fail(actual,expected,message,"!=",assert.notEqual)}};assert.deepEqual=function deepEqual(actual,expected,message){if(!_deepEqual(actual,expected)){fail(actual,expected,message,"deepEqual",assert.deepEqual)}};function _deepEqual(actual,expected){if(actual===expected){return true}else if(util.isBuffer(actual)&&util.isBuffer(expected)){if(actual.length!=expected.length)return false;for(var i=0;i<actual.length;i++){if(actual[i]!==expected[i])return false}return true}else if(util.isDate(actual)&&util.isDate(expected)){return actual.getTime()===expected.getTime()}else if(util.isRegExp(actual)&&util.isRegExp(expected)){return actual.source===expected.source&&actual.global===expected.global&&actual.multiline===expected.multiline&&actual.lastIndex===expected.lastIndex&&actual.ignoreCase===expected.ignoreCase}else if(!util.isObject(actual)&&!util.isObject(expected)){return actual==expected}else{return objEquiv(actual,expected)}}function isArguments(object){return Object.prototype.toString.call(object)=="[object Arguments]"}function objEquiv(a,b){if(util.isNullOrUndefined(a)||util.isNullOrUndefined(b))return false;if(a.prototype!==b.prototype)return false;if(isArguments(a)){if(!isArguments(b)){return false}a=pSlice.call(a);b=pSlice.call(b);return _deepEqual(a,b)}try{var ka=objectKeys(a),kb=objectKeys(b),key,i}catch(e){return false}if(ka.length!=kb.length)return false;ka.sort();kb.sort();for(i=ka.length-1;i>=0;i--){if(ka[i]!=kb[i])return false}for(i=ka.length-1;i>=0;i--){key=ka[i];if(!_deepEqual(a[key],b[key]))return false}return true}assert.notDeepEqual=function notDeepEqual(actual,expected,message){if(_deepEqual(actual,expected)){fail(actual,expected,message,"notDeepEqual",assert.notDeepEqual)}};assert.strictEqual=function strictEqual(actual,expected,message){if(actual!==expected){fail(actual,expected,message,"===",assert.strictEqual)}};assert.notStrictEqual=function notStrictEqual(actual,expected,message){if(actual===expected){fail(actual,expected,message,"!==",assert.notStrictEqual)}};function expectedException(actual,expected){if(!actual||!expected){return false}if(Object.prototype.toString.call(expected)=="[object RegExp]"){return expected.test(actual)}else if(actual instanceof expected){return true}else if(expected.call({},actual)===true){return true}return false}function _throws(shouldThrow,block,expected,message){var actual;if(util.isString(expected)){message=expected;expected=null}try{block()}catch(e){actual=e}message=(expected&&expected.name?" ("+expected.name+").":".")+(message?" "+message:".");if(shouldThrow&&!actual){fail(actual,expected,"Missing expected exception"+message)}if(!shouldThrow&&expectedException(actual,expected)){fail(actual,expected,"Got unwanted exception"+message)}if(shouldThrow&&actual&&expected&&!expectedException(actual,expected)||!shouldThrow&&actual){throw actual}}assert.throws=function(block,error,message){_throws.apply(this,[true].concat(pSlice.call(arguments)))};assert.doesNotThrow=function(block,message){_throws.apply(this,[false].concat(pSlice.call(arguments)))};assert.ifError=function(err){if(err){throw err}};var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj){if(hasOwn.call(obj,key))keys.push(key)}return keys}},{"util/":4}]},{},[]);var yup=require("yup");var assert=require("assert");var schema=yup.object({name:yup.string(),id:yup.string()});schema.isValid({name:"hi"}).then(function(valid){assert(valid);console.log("fin")}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"yup": "0.6.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment