forked from shouldjs/should.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
should.min.js
9 lines (9 loc) · 36.4 KB
/
should.min.js
1
2
3
4
5
6
7
8
9
/*!
* should - test framework agnostic BDD-style assertions
* @version v7.1.1
* @author TJ Holowaychuk <[email protected]> and contributors
* @link https://github.com/shouldjs/should.js
* @license MIT
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Should=t()}}(function(){return function t(e,r,a){function n(s,i){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!i&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var h=r[s]={exports:{}};e[s][0].call(h.exports,function(t){var r=e[s][1][t];return n(r?r:t)},h,h.exports,t,e,r,a)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<a.length;s++)n(a[s]);return n}({1:[function(t,e,r){var a=t("./lib/should"),n=Object.prototype,o="should";try{var s=a.extend(o,n);a._prevShould=s}catch(i){}e.exports=a},{"./lib/should":17}],2:[function(t,e,r){function a(t){return i+t}function n(t){return t.split("\n").map(a).join("\n")}var o=t("./util"),s=function(t){if(o.merge(this,t),t.message||Object.defineProperty(this,"message",{get:function(){return this._message||(this._message=this.generateMessage(),this.generatedMessage=!0),this._message},configurable:!0,enumerable:!1}),Error.captureStackTrace)Error.captureStackTrace(this,this.stackStartFunction);else{var e=new Error;if(e.stack){var r=e.stack;if(this.stackStartFunction){var a=o.functionName(this.stackStartFunction),n=r.indexOf("\n"+a);if(n>=0){var s=r.indexOf("\n",n+1);r=r.substring(s+1)}}this.stack=r}}},i=" ";s.prototype=Object.create(Error.prototype,{name:{value:"AssertionError"},generateMessage:{value:function(){if(!this.operator&&this.previous)return this.previous.message;var t=o.format(this.actual),e="expected"in this?" "+o.format(this.expected):"",r="details"in this&&this.details?" ("+this.details+")":"",a=this.previous?"\n"+n(this.previous.message):"";return"expected "+t+(this.negate?" not ":" ")+this.operator+e+r+a}}}),e.exports=s},{"./util":18}],3:[function(t,e,r){function a(t){this.obj=t,this.anyOne=!1,this.negate=!1,this.params={actual:t}}var n=t("./assertion-error");t("./util");a.add=function(t,e){var r={enumerable:!0,configurable:!0};r.value=function(){var r=new a(this.obj,this,t);r.anyOne=this.anyOne;try{e.apply(r,arguments)}catch(o){if(o instanceof n){if(this.negate)return this.obj=r.obj,this.negate=!1,this;r!==o.assertion&&(r.params.previous=o),r.negate=!1,r.fail()}throw o}return this.negate&&(r.negate=!0,r.params.details="false negative fail",r.fail()),this.params.operator||(this.params=r.params),this.obj=r.obj,this.negate=!1,this},Object.defineProperty(a.prototype,t,r)},a.addChain=function(t,e){e=e||function(){},Object.defineProperty(a.prototype,t,{get:function(){return e(),this},enumerable:!0})},a.alias=function(t,e){var r=Object.getOwnPropertyDescriptor(a.prototype,t);if(!r)throw new Error("Alias "+t+" -> "+e+" could not be created as "+t+" not defined");Object.defineProperty(a.prototype,e,r)},a.prototype={constructor:a,assert:function(t){if(t)return this;var e=this.params;throw"obj"in e&&!("actual"in e)?e.actual=e.obj:"obj"in e||"actual"in e||(e.actual=this.obj),e.stackStartFunction=e.stackStartFunction||this.assert,e.negate=this.negate,e.assertion=this,new n(e)},fail:function(){return this.assert(!1)},get not(){return this.negate=!this.negate,this},get any(){return this.anyOne=!0,this}},e.exports=a},{"./assertion-error":2,"./util":18}],4:[function(t,e,r){var a=t("should-format").Formatter,n={checkProtoEql:!1,getFormatter:function(t){return new a(t||n)}};e.exports=n},{"should-format":21}],5:[function(t,e,r){function a(t,e,r,n,o){var s=new i(t);s.params={operator:n,expected:e,message:r,stackStartFunction:o||a},s.fail()}function n(t,e){t||a(t,!0,e,"==",h.ok)}function o(t,e){return t&&e?"[object RegExp]"==Object.prototype.toString.call(e)?e.test(t):t instanceof e?!0:e.call({},t)===!0?!0:!1:!1}function s(t,e,r,n){var s;"string"==typeof r&&(n=r,r=null);try{e()}catch(i){s=i}if(n=(r&&r.name?" ("+r.name+")":".")+(n?" "+n:"."),t&&!s&&a(s,r,"Missing expected exception"+n),!t&&o(s,r)&&a(s,r,"Got unwanted exception"+n),t&&s&&r&&!o(s,r)||!t&&s)throw s}var i=t("./../assertion"),u=t("should-equal"),c=Array.prototype.slice,h=e.exports=n;h.fail=a,h.ok=n,h.equal=function(t,e,r){t!=e&&a(t,e,r,"==",h.equal)},h.notEqual=function(t,e,r){t==e&&a(t,e,r,"!=",h.notEqual)},h.deepEqual=function(t,e,r){u(t,e).result||a(t,e,r,"deepEqual",h.deepEqual)},h.notDeepEqual=function(t,e,r){u(t,e).result&&a(t,e,r,"notDeepEqual",h.notDeepEqual)},h.strictEqual=function(t,e,r){t!==e&&a(t,e,r,"===",h.strictEqual)},h.notStrictEqual=function(t,e,r){t===e&&a(t,e,r,"!==",h.notStrictEqual)},h["throws"]=function(t,e,r){s.apply(this,[!0].concat(c.call(arguments)))},h.doesNotThrow=function(t,e){s.apply(this,[!1].concat(c.call(arguments)))},h.ifError=function(t){if(t)throw t}},{"./../assertion":3,"should-equal":20}],6:[function(t,e,r){var a=t("../util"),n=t("./_assert"),o=t("../assertion-error");e.exports=function(t){var e=t.format;a.merge(t,n),t.exist=t.exists=function(r,a){if(null==r)throw new o({message:a||"expected "+e(r)+" to exist",stackStartFunction:t.exist})},t.not={},t.not.exist=t.not.exists=function(r,a){if(null!=r)throw new o({message:a||"expected "+e(r)+" to not exist",stackStartFunction:t.not.exist})}}},{"../assertion-error":2,"../util":18,"./_assert":5}],7:[function(t,e,r){e.exports=function(t,e){e.add("true",function(){this.is.exactly(!0)}),e.alias("true","True"),e.add("false",function(){this.is.exactly(!1)}),e.alias("false","False"),e.add("ok",function(){this.params={operator:"to be truthy"},this.assert(this.obj)})}},{}],8:[function(t,e,r){e.exports=function(t,e){["an","of","a","and","be","has","have","with","is","which","the","it"].forEach(function(t){e.addChain(t)})}},{}],9:[function(t,e,r){var a=t("../util"),n=t("should-equal");e.exports=function(t,e){var r=t.format;e.add("containEql",function(t){this.params={operator:"to contain "+r(t)},this.is.not["null"]().and.not.undefined();var e=this.obj;"string"==typeof e?this.assert(e.indexOf(String(t))>=0):a.isIndexable(e)?this.assert(a.some(e,function(e){return n(e,t).result})):this.have.properties(t)}),e.add("containDeepOrdered",function(e){this.params={operator:"to contain "+r(e)};var n=this.obj;if("string"==typeof n)this.is.equal(String(e));else if(a.isIndexable(n)&&a.isIndexable(e)){for(var o=0,s=0,i=a.length(n),u=a.length(e);i>o&&u>s;o++)try{t(n[o]).containDeepOrdered(e[s]),s++}catch(c){if(c instanceof t.AssertionError)continue;throw c}this.assert(s===u)}else null!=n&&null!=e&&"object"==typeof n&&"object"==typeof e?(a.forEach(e,function(e,r){t(n[r]).containDeepOrdered(e)}),a.isEmptyObject(e)&&this.eql(e)):this.eql(e)}),e.add("containDeep",function(e){this.params={operator:"to contain "+r(e)};var n=this.obj;if("string"==typeof n)this.is.equal(String(e));else if(a.isIndexable(n)&&a.isIndexable(e)){var o={};a.forEach(e,function(e){this.assert(a.some(n,function(r,a){if(a in o)return!1;try{return t(r).containDeep(e),o[a]=!0,!0}catch(n){if(n instanceof t.AssertionError)return!1;throw n}}))},this)}else null!=n&&null!=e&&"object"==typeof n&&"object"==typeof e?(a.forEach(e,function(e,r){t(n[r]).containDeep(e)}),a.isEmptyObject(e)&&this.eql(e)):this.eql(e)})}},{"../util":18,"should-equal":20}],10:[function(t,e,r){function a(t,e,r){return((t.path.length>0?"at "+t.path.map(s.formatProp).join(" -> "):"")+(t.a===e?"":", A has "+s.format(t.a))+(t.b===r?"":" and B has "+s.format(t.b))+(t.showReason?" because "+t.reason:"")).trim()}var n=t("should-equal"),o=t("should-type"),s=t("../util");e.exports=function(t,e){function r(r,a,n){e.add(r,function(e){1!==arguments.length?e=Array.prototype.slice.call(arguments):t(e).be.Array(),this.params={operator:a,expected:e};var r=this.obj,o=!1;s.forEach(e,function(e){try{return t(e)[n](r),o=!0,!1}catch(a){if(a instanceof t.AssertionError)return;throw a}}),this.assert(o)})}e.add("eql",function(e,r){this.params={operator:"to equal",expected:e,message:r};var s=n(this.obj,e,t.config);this.params.details=s.result?"":a(s,this.obj,e),this.params.showDiff=n(o(this.obj),o(e)).result,this.assert(s.result)}),e.add("equal",function(t,e){this.params={operator:"to be",expected:t,message:e},this.params.showDiff=n(o(this.obj),o(t)).result,this.assert(t===this.obj)}),e.alias("equal","exactly"),e.alias("eql","deepEqual"),r("equalOneOf","to be equals one of","equal"),r("oneOf","to be one of","eql")}},{"../util":18,"should-equal":20,"should-type":23}],11:[function(t,e,r){var a=t("../util");e.exports=function(t,e){var r=t.format;e.add("throw",function(e,n){var o=this.obj,s={},i="",u=!1;if(a.isGeneratorFunction(o))return t(o())["throw"](e,n);if(a.isGeneratorObject(o))return t(o.next.bind(o))["throw"](e,n);this.is.a.Function();var c=!0;try{o()}catch(h){u=!0,s=h}if(u)if(e){if("string"==typeof e)c=e==s.message;else if(e instanceof RegExp)c=e.test(s.message);else if("function"==typeof e)c=s instanceof e;else if(null!=e)try{t(s).match(e)}catch(h){if(!(h instanceof t.AssertionError))throw h;i=": "+h.message,c=!1}if(c){if("function"==typeof e&&n)try{t(s).match(n)}catch(h){if(!(h instanceof t.AssertionError))throw h;i=": "+h.message,c=!1}}else"string"==typeof e||e instanceof RegExp?i=" with a message matching "+r(e)+", but got '"+s.message+"'":"function"==typeof e&&(i=" of type "+a.functionName(e)+", but got "+a.functionName(s.constructor))}else i=" (got "+r(s)+")";this.params={operator:"to throw exception"+i},this.assert(u),this.assert(c)}),e.alias("throw","throwError")}},{"../util":18}],12:[function(t,e,r){var a=t("../util"),n=t("should-equal");e.exports=function(t,e){var r=t.format;e.add("match",function(e,o){if(this.params={operator:"to match "+r(e),message:o},!n(this.obj,e).result)if(e instanceof RegExp){if("string"==typeof this.obj)this.assert(e.exec(this.obj));else if(a.isIndexable(this.obj))a.forEach(this.obj,function(t){this.assert(e.exec(t))},this);else if(null!=this.obj&&"object"==typeof this.obj){var s=[],i=[];a.forEach(this.obj,function(t,n){e.exec(t)?i.push(a.formatProp(n)):s.push(a.formatProp(n)+" ("+r(t)+")")},this),s.length&&(this.params.operator+="\n not matched properties: "+s.join(", ")),i.length&&(this.params.operator+="\n matched properties: "+i.join(", ")),this.assert(0===s.length)}}else if("function"==typeof e){var u;u=e(this.obj),"boolean"==typeof u&&this.assert(u)}else null!=e&&"object"==typeof e?(s=[],i=[],a.forEach(e,function(e,n){try{t(this.obj).have.property(n).which.match(e),i.push(a.formatProp(n))}catch(o){if(!(o instanceof t.AssertionError))throw o;s.push(a.formatProp(n)+" ("+r(this.obj[n])+")")}},this),s.length&&(this.params.operator+="\n not matched properties: "+s.join(", ")),i.length&&(this.params.operator+="\n matched properties: "+i.join(", ")),this.assert(0===s.length)):this.assert(!1)}),e.add("matchEach",function(e,n){this.params={operator:"to match each "+r(e),message:n},a.forEach(this.obj,function(r){t(r).match(e)},this)}),e.add("matchAny",function(e,n){this.params={operator:"to match any "+r(e),message:n},this.assert(a.some(this.obj,function(r){try{return t(r).match(e),!0}catch(a){if(a instanceof t.AssertionError)return!1;throw a}}))}),e.alias("matchAny","matchSome"),e.alias("matchEach","matchEvery")}},{"../util":18,"should-equal":20}],13:[function(t,e,r){e.exports=function(t,e){e.add("NaN",function(){this.params={operator:"to be NaN"},this.assert(this.obj!==this.obj)}),e.add("Infinity",function(){this.params={operator:"to be Infinity"},this.is.a.Number().and.not.a.NaN().and.assert(!isFinite(this.obj))}),e.add("within",function(t,e,r){this.params={operator:"to be within "+t+".."+e,message:r},this.assert(this.obj>=t&&this.obj<=e)}),e.add("approximately",function(t,e,r){this.params={operator:"to be approximately "+t+" ±"+e,message:r},this.assert(Math.abs(this.obj-t)<=e)}),e.add("above",function(t,e){this.params={operator:"to be above "+t,message:e},this.assert(this.obj>t)}),e.add("below",function(t,e){this.params={operator:"to be below "+t,message:e},this.assert(this.obj<t)}),e.alias("above","greaterThan"),e.alias("below","lessThan"),e.add("aboveOrEqual",function(t,e){this.params={operator:"to be above or equal"+t,message:e},this.assert(this.obj>=t)}),e.add("belowOrEqual",function(t,e){this.params={operator:"to be below or equal"+t,message:e},this.assert(this.obj<=t)}),e.alias("aboveOrEqual","greaterThanOrEqual"),e.alias("belowOrEqual","lessThanOrEqual")}},{}],14:[function(t,e,r){var a=t("../util"),n=t("should-equal"),o=Array.prototype.slice;e.exports=function(t,e){function r(){var t={};if(arguments.length>1)t.names=o.call(arguments);else{var e=arguments[0];"string"==typeof e?t.names=[e]:a.isIndexable(e)?t.names=e:(t.names=Object.keys(e),t.values=e)}return t}var s=t.format;e.add("propertyWithDescriptor",function(e,r){this.params={actual:this.obj,operator:"to have own property with descriptor "+s(r)};var a=this.obj;this.have.ownProperty(e),t(Object.getOwnPropertyDescriptor(Object(a),e)).have.properties(r)}),e.add("enumerable",function(t,e){t=a.convertPropertyName(t),this.params={operator:"to have enumerable property "+a.formatProp(t)+(arguments.length>1?" equal to "+s(e):"")};var r={enumerable:!0};arguments.length>1&&(r.value=e),this.have.propertyWithDescriptor(t,r)}),e.add("enumerables",function(e){var n=r.apply(null,arguments);this.params={operator:"to have enumerables "+n.names.map(a.formatProp)};var o=this.obj;n.names.forEach(function(e){t(o).have.enumerable(e)})}),e.add("property",function(t,e){if(t=a.convertPropertyName(t),arguments.length>1){var r={};r[t]=e,this.have.properties(r)}else this.have.properties(t);this.obj=this.obj[t]}),e.add("properties",function(t){var e={};arguments.length>1?t=o.call(arguments):Array.isArray(t)||("string"==typeof t||"symbol"==typeof t?t=[t]:(e=t,t=Object.keys(t)));var r=Object(this.obj),i=[];t.forEach(function(t){t in r||i.push(a.formatProp(t))});var u=i;0===u.length?u=t.map(a.formatProp):this.anyOne&&(u=t.filter(function(t){return i.indexOf(a.formatProp(t))<0}).map(a.formatProp));var c=(1===u.length?"to have property ":"to have "+(this.anyOne?"any of ":"")+"properties ")+u.join(", ");this.params={obj:this.obj,operator:c},this.assert(0===i.length||this.anyOne&&i.length!=t.length);var h=Object.keys(e);if(h.length){var f=[];u=[],h.forEach(function(t){var o=e[t];n(r[t],o).result?u.push(a.formatProp(t)+" of "+s(o)):f.push(a.formatProp(t)+" of "+s(o)+" (got "+s(r[t])+")")}),(0!==f.length&&!this.anyOne||this.anyOne&&0===u.length)&&(u=f),c=(1===u.length?"to have property ":"to have "+(this.anyOne?"any of ":"")+"properties ")+u.join(", "),this.params={obj:this.obj,operator:c},this.assert(0===f.length||this.anyOne&&f.length!=h.length)}}),e.add("length",function(t,e){this.have.property("length",t,e)}),e.alias("length","lengthOf");var i=Object.prototype.hasOwnProperty;e.add("ownProperty",function(t,e){t=a.convertPropertyName(t),this.params={actual:this.obj,operator:"to have own property "+a.formatProp(t),message:e},this.assert(i.call(this.obj,t)),this.obj=this.obj[t]}),e.alias("ownProperty","hasOwnProperty"),e.add("empty",function(){if(this.params={operator:"to be empty"},void 0!==a.length(this.obj))t(this.obj).have.property("length",0);else{var e=Object(this.obj);for(var r in e)t(this.obj).not.have.ownProperty(r)}},!0),e.add("keys",function(t){arguments.length>1?t=o.call(arguments):1===arguments.length&&"string"==typeof t?t=[t]:0===arguments.length&&(t=[]),t=t.map(String);var e=Object(this.obj),r=[];t.forEach(function(t){i.call(this.obj,t)||r.push(a.formatProp(t))},this);var n=[];Object.keys(e).forEach(function(e){t.indexOf(e)<0&&n.push(a.formatProp(e))});var s=0===t.length?"to be empty":"to have "+(1===t.length?"key ":"keys ");this.params={operator:s+t.map(a.formatProp).join(", ")},r.length>0&&(this.params.operator+="\n missing keys: "+r.join(", ")),n.length>0&&(this.params.operator+="\n extra keys: "+n.join(", ")),this.assert(0===r.length&&0===n.length)}),e.alias("keys","key"),e.add("propertyByPath",function(e){arguments.length>1?e=o.call(arguments):1===arguments.length&&"string"==typeof e?e=[e]:0===arguments.length&&(e=[]);var r=e.map(a.formatProp);e=e.map(String);for(var n,s=t(Object(this.obj)),i=[];n=e.shift();)this.params={operator:"to have property by path "+r.join(", ")+" - failed on "+a.formatProp(n)},s=s.have.property(n),i.push(n);this.params={obj:this.obj,operator:"to have property by path "+r.join(", ")},this.obj=s.obj})}},{"../util":18,"should-equal":20}],15:[function(t,e,r){e.exports=function(t,e){e.add("startWith",function(e,r){this.params={operator:"to start with "+t.format(e),message:r},this.assert(0===this.obj.indexOf(e))}),e.add("endWith",function(e,r){this.params={operator:"to end with "+t.format(e),message:r},this.assert(this.obj.indexOf(e,this.obj.length-e.length)>=0)})}},{}],16:[function(t,e,r){var a=t("../util");e.exports=function(t,e){e.add("Number",function(){this.params={operator:"to be a number"},this.have.type("number")}),e.add("arguments",function(){this.params={operator:"to be arguments"},this.have["class"]("Arguments")}),e.alias("arguments","Arguments"),e.add("type",function(e,r){this.params={operator:"to have type "+e,message:r},t(typeof this.obj).be.exactly(e)}),e.add("instanceof",function(t,e){this.params={operator:"to be an instance of "+a.functionName(t),message:e},this.assert(Object(this.obj)instanceof t)}),e.alias("instanceof","instanceOf"),e.add("Function",function(){this.params={operator:"to be a function"},this.have.type("function")}),e.add("Object",function(){this.params={operator:"to be an object"},this.is.not["null"]().and.have.type("object")}),e.add("String",function(){this.params={operator:"to be a string"},this.have.type("string")}),e.add("Array",function(){this.params={operator:"to be an array"},this.have["class"]("Array")}),e.add("Boolean",function(){this.params={operator:"to be a boolean"},this.have.type("boolean")}),e.add("Error",function(){this.params={operator:"to be an error"},this.have.instanceOf(Error)}),e.add("null",function(){this.params={operator:"to be null"},this.assert(null===this.obj)}),e.alias("null","Null"),e.add("class",function(t){this.params={operator:"to have [[Class]] "+t},this.assert(Object.prototype.toString.call(this.obj)==="[object "+t+"]")}),e.alias("class","Class"),e.add("undefined",function(){this.params={operator:"to be undefined"},this.assert(void 0===this.obj)}),e.alias("undefined","Undefined"),e.add("iterable",function(){this.params={operator:"to be iterable"},t(this.obj).have.property(Symbol.iterator).which.is.a.Function()}),e.add("iterator",function(){this.params={operator:"to be iterator"},t(this.obj).have.property("next").which.is.a.Function()}),e.add("generator",function(){this.params={operator:"to be generator"},t(this.obj).be.iterable.and.iterator.and.it.is.equal(this.obj[Symbol.iterator]())})}},{"../util":18}],17:[function(t,e,r){var a=t("./util"),n=function o(t){return new o.Assertion(t)};n.AssertionError=t("./assertion-error"),n.Assertion=t("./assertion"),n.format=a.format,n.type=t("should-type"),n.util=a,n.config=t("./config"),r=e.exports=n,n.extend=function(t,e){t=t||"should",e=e||Object.prototype;var r=Object.getOwnPropertyDescriptor(e,t);return Object.defineProperty(e,t,{set:function(){},get:function(){return n(a.isWrapperType(this)?this.valueOf():this)},configurable:!0}),{name:t,descriptor:r,proto:e}},n.noConflict=function(t){return t=t||n._prevShould,t&&(delete t.proto[t.name],t.descriptor&&Object.defineProperty(t.proto,t.name,t.descriptor)),n},n.use=function(t){return t(n,n.Assertion),this},n.use(t("./ext/assert")).use(t("./ext/chain")).use(t("./ext/bool")).use(t("./ext/number")).use(t("./ext/eql")).use(t("./ext/type")).use(t("./ext/string")).use(t("./ext/property")).use(t("./ext/error")).use(t("./ext/match")).use(t("./ext/contain"))},{"./assertion":3,"./assertion-error":2,"./config":4,"./ext/assert":6,"./ext/bool":7,"./ext/chain":8,"./ext/contain":9,"./ext/eql":10,"./ext/error":11,"./ext/match":12,"./ext/number":13,"./ext/property":14,"./ext/string":15,"./ext/type":16,"./util":18,"should-type":23}],18:[function(t,e,r){var a=t("should-type"),n=t("./config");r.isWrapperType=function(t){return t instanceof Number||t instanceof String||t instanceof Boolean},r.merge=function(t,e){if(t&&e)for(var r in e)t[r]=e[r];return t};var o=Object.prototype.hasOwnProperty;r.forEach=function s(t,e,a){if(r.isGeneratorFunction(t))return s(t(),e,a);if(r.isGeneratorObject(t))for(var n=t.next();!n.done;){if(e.call(a,n.value,"value",t)===!1)return;n=t.next()}else for(var i in t)if(o.call(t,i)&&e.call(a,t[i],i,t)===!1)return},r.some=function(t,e,a){var n=!1;return r.forEach(t,function(r,o){return e.call(a,r,o,t)?(n=!0,!1):void 0},a),n},r.isEmptyObject=function(t){for(var e in t)if(o.call(t,e))return!1;return!0},r.isIndexable=function(t){var e=a(t);return e.type===a.OBJECT&&e.cls===a.ARRAY||e.type===a.OBJECT&&e.cls===a.BUFFER||e.type===a.OBJECT&&e.cls===a.ARGUMENTS||e.type===a.OBJECT&&e.cls===a.ARRAY_BUFFER||e.type===a.OBJECT&&e.cls===a.TYPED_ARRAY||e.type===a.OBJECT&&e.cls===a.DATA_VIEW||e.type===a.OBJECT&&e.cls===a.STRING||e.type===a.STRING},r.length=function(t){var e=a(t);switch(e.type){case a.STRING:return t.length;case a.OBJECT:switch(e.cls){case a.ARRAY_BUFFER:case a.TYPED_ARRAY:case a.DATA_VIEW:return t.byteLength;case a.ARRAY:case a.BUFFER:case a.ARGUMENTS:case a.FUNCTION:return t.length}}},r.convertPropertyName=function(t){return"symbol"==typeof t?t:String(t)},r.isGeneratorObject=function(t){return t?"function"==typeof t.next&&"function"==typeof t[Symbol.iterator]&&t[Symbol.iterator]()===t:!1},r.isGeneratorFunction=function(t){return"function"!=typeof t?!1:/^function\s*\*\s*/.test(t.toString())},r.format=function(t,e){return n.getFormatter(e).format(t)},r.functionName=t("should-format").Formatter.functionName,r.formatProp=function(t){return n.getFormatter().formatPropertyName(String(t))}},{"./config":4,"should-format":21,"should-type":23}],19:[function(t,e,r){e.exports=function(t){for(var e=arguments,r=1,a=e.length;a>r;r++)t=t.replace(/%s/,e[r]);return t}},{}],20:[function(t,e,r){function a(t,e,r,a,n){var o={result:t};return t||(o.path=e,o.reason=r,o.a=a,o.b=n),o}function n(t){return t.type+(t.cls?"("+t.cls+(t.sub?" "+t.sub:"")+")":"")}function o(t,e,r,s,p,l){function d(r,n){return a(r,l,n,t,e)}function m(a){return o(t[a],e[a],r,s,p,l.concat([a]))}var b=h;if(t===e)return d(0!==t||1/t==1/e,f.PLUS_0_AND_MINUS_0);var y,g,v=i(t),j=i(e),E=v.type!==j.type||v.cls!==j.cls;if(E||r.checkSubType&&v.sub!==j.sub||!r.checkSubType)return d(!1,u(f.DIFFERENT_TYPES,n(v),n(j)));switch(v.type){case"number":return t!==t?d(e!==e,f.NAN_NUMBER):0===t?d(1/t===1/e,f.PLUS_0_AND_MINUS_0):d(t===e,f.EQUALITY);case"boolean":case"string":return d(t===e,f.EQUALITY);case"function":var O=t.toString(),A=e.toString();if(b=o(O,A,r,s,p,l),!b.result)return b.reason=f.FUNCTION_SOURCES,b;break;case"object":switch(v.cls){case"regexp":for(g=["source","global","multiline","lastIndex","ignoreCase"];g.length;)if(b=m(g.shift()),!b.result)return b;break;case"date":if(+t!==+e)return d(!1,f.EQUALITY);break;case"number":case"boolean":case"string":if(b=o(t.valueOf(),e.valueOf(),r,s,p,l),!b.result)return b.reason=f.WRAPPED_VALUE,b;break;case"buffer":if(b=m("length"),!b.result)return b;for(y=t.length;y--;)if(b=m(y),!b.result)return b;return h;case"error":for(g=["name","message"];g.length;)if(b=m(g.shift()),!b.result)return b;break;case"array":case"arguments":case"typed-array":if(b=m("length"),!b.result)return b;break;case"array-buffer":if(b=m("byteLength"),!b.result)return b;break;case"map":case"set":if(b=m("size"),!b.result)return b;s.push(t),p.push(e);for(var x=t.entries(),S=x.next();!S.done;){var T=S.value[0];if("object"!=i(T).type){if(!e.has(T)){b=d(!1,f.SET_MAP_MISSING_KEY),b.a=T,b.b=T;break}if("map"==v.cls){var _=e.get(T);if(b=o(S.value[1],_,r,s,p,l),!b.result){b.a=S.value,b.b=_,b.reason=f.MAP_VALUE_EQUALITY;break}}}else for(var P=e.entries(),N=P.next();!N.done;){if(b=o(S.value[0],N.value[0],r,s,p,l),b.result){"map"==v.cls&&(b=o(S.value[1],N.value[1],r,s,p,l),b.result||(b.a=S.value,b.b=N.value,b.reason=f.MAP_VALUE_EQUALITY));break}b.reason=f.SET_MAP_MISSING_KEY,b.a=T,b.b=T,N=P.next()}if(!b.result)break;S=x.next()}if(s.pop(),p.pop(),!b.result)return b.reason=f.SET_MAP_MISSING_ENTRY,b}}for(y=s.length;y--;)if(s[y]==t)return d(p[y]==e,f.CIRCULAR_VALUES);s.push(t),p.push(e);var T;for(T in e)if(c.call(e,T)){if(b=d(c.call(t,T),u(f.MISSING_KEY,"A",T)),!b.result)break;if(b.result&&(b=m(T),!b.result))break}if(b.result)for(T in t)if(c.call(t,T)&&(b=d(c.call(e,T),u(f.MISSING_KEY,"B",T)),!b.result))return b;if(s.pop(),p.pop(),!b.result)return b;var R=!1,w=!1;return r.checkProtoEql&&(Object.getPrototypeOf?(R=Object.getPrototypeOf(t)===Object.getPrototypeOf(e),w=!0):t.__proto__&&e.__proto__&&(R=t.__proto__===e.__proto__,w=!0),w&&!R&&(b=d(R,f.EQUALITY_PROTOTYPE),b.showReason=!0,!b.result))?b:h}function s(t,e,r){r=r||{},"boolean"!=typeof r.checkProtoEql&&(r.checkProtoEql=p.checkProtoEql),"boolean"!=typeof r.checkSubType&&(r.checkSubType=p.checkSubType);var a=o(t,e,r,[],[],[]);return a}var i=t("should-type"),u=t("./format"),c=Object.prototype.hasOwnProperty,h=a(!0),f={PLUS_0_AND_MINUS_0:"+0 is not equal to -0",DIFFERENT_TYPES:"A has type %s and B has type %s",NAN_NUMBER:"NaN is not equal to any number",EQUALITY:"A is not equal to B",EQUALITY_PROTOTYPE:"A and B have different prototypes",WRAPPED_VALUE:"A wrapped value is not equal to B wrapped value",FUNCTION_SOURCES:"function A is not equal to B by source code value (via .toString call)",MISSING_KEY:"%s has no key %s",CIRCULAR_VALUES:"A has circular reference that was visited not in the same time as B",SET_MAP_MISSING_KEY:"Set/Map missing key",MAP_VALUE_EQUALITY:"Values of the same key in A and B is not equal"},p={checkProtoEql:!0,checkSubType:!0};e.exports=s,s.r=f},{"./format":19,"should-type":23}],21:[function(t,e,r){function a(t){return function(e){var r=t(e);return r.sort(),r}}function n(t){t=t||{},this.seen=[],this.keys=a(t.keys===!1?Object.getOwnPropertyNames:Object.keys),this.maxLineLength="number"==typeof t.maxLineLength?t.maxLineLength:60,this.propSep=t.propSep||",",this.isUTCdate=!!t.isUTCdate}function o(t,e){var r=e?"UTC":"",a=t["get"+r+"FullYear"]()+"-"+u.pad0(t["get"+r+"Month"]()+1,2)+"-"+u.pad0(t["get"+r+"Date"](),2),n=u.pad0(t["get"+r+"Hours"](),2)+":"+u.pad0(t["get"+r+"Minutes"](),2)+":"+u.pad0(t["get"+r+"Seconds"](),2)+"."+u.pad0(t["get"+r+"Milliseconds"](),3),o=t.getTimezoneOffset(),s=Math.abs(o),i=Math.floor(s/60),c=s-60*i,h=(0>o?"+":"-")+u.pad0(i,2)+u.pad0(c,2);return a+" "+n+(e?"":" "+h)}function s(t,e){return new n(e).format(t)}var i=t("should-type"),u=t("./util");n.prototype={constructor:n,format:function(t){var e=i(t),r=e.type,a=e.type;e.cls&&(r+="_"+e.cls,a+="_"+e.cls),e.sub&&(a+="_"+e.sub);var n=this["_format_"+a]||this["_format_"+r]||this["_format_"+e.type]||this.defaultFormat;return n.call(this,t).trim()},_formatObject:function(t,e){e=e||{};var r=e.keys||this.keys(t),a=0,o=e.formatPropertyValue||this.formatPropertyValue,s=e.formatPropertyName||this.formatPropertyName,i=e.keyValueSep||": ",c=e.keyFilter||function(){return!0};this.seen.push(t);var h=[];r.forEach(function(e){if(c(e)){var r=s.call(this,e),n=(r?r+i:"")+o.call(this,t,e);a+=n.length,h.push(n)}},this),this.seen.pop(),(e.additionalProperties||[]).forEach(function(t){var e=t[0]+i+this.format(t[1]);a+=e.length,h.push(e)},this);var f=e.prefix||n.constructorName(t)||"";f.length>0&&(f+=" ");var p,l;Array.isArray(e.brackets)?(p=e.brackets&&e.brackets[0],l=e.brackets&&e.brackets[1]):(p="{",l="}");var d=e.value||"";return 0===h.length?d||f+p+l:a<=this.maxLineLength?f+p+" "+(d?d+" ":"")+h.join(this.propSep+" ")+" "+l:f+p+"\n"+(d?" "+d+"\n":"")+h.map(u.addSpaces).join(this.propSep+"\n")+"\n"+l},formatObject:function(t,e,r){r=r||this.keys(t);var a=0;return this.seen.push(t),r=r.map(function(e){var r=this.formatProperty(t,e);return a+=r.length,r},this),this.seen.pop(),0===r.length?"{}":a<=this.maxLineLength?"{ "+(e?e+" ":"")+r.join(this.propSep+" ")+" }":"{\n"+(e?" "+e+"\n":"")+r.map(u.addSpaces).join(this.propSep+"\n")+"\n}"},formatPropertyName:function(t){return t.match(/^[a-zA-Z_$][a-zA-Z_$0-9]*$/)?t:this.format(t)},formatProperty:function(t,e){var r=n.getPropertyDescriptor(t,e),a=this.formatPropertyName(e),o=r.get&&r.set?"[Getter/Setter]":r.get?"[Getter]":r.set?"[Setter]":this.seen.indexOf(r.value)>=0?"[Circular]":this.format(r.value);return a+": "+o},formatPropertyValue:function(t,e){var r=n.getPropertyDescriptor(t,e),a=r.get&&r.set?"[Getter/Setter]":r.get?"[Getter]":r.set?"[Setter]":this.seen.indexOf(r.value)>=0?"[Circular]":this.format(r.value);return a}},n.add=function(t,e,r,a){var o=Array.prototype.slice.call(arguments);a=o.pop(),n.prototype["_format_"+o.join("_")]=a},n.formatObjectWithPrefix=function(t){return function(e){var r=t.call(this,e),a=this.keys(e);return 0==a.length?r:this.formatObject(e,r,a)}};var c=/^\s*function\s*(\S*)\s*\(/;n.functionName=function(t){if(t.name)return t.name;var e=t.toString().match(c)[1];return e},n.constructorName=function(t){for(;t;){var e=Object.getOwnPropertyDescriptor(t,"constructor");if(void 0!==e&&"function"==typeof e.value){var r=n.functionName(e.value);if(""!==r)return r}t=Object.getPrototypeOf(t)}},n.getPropertyDescriptor=function(t,e){var r;try{r=Object.getOwnPropertyDescriptor(t,e)||{value:t[e]}}catch(a){r={value:a}}return r},n.generateFunctionForIndexedArray=function(t,e,r){return function(a){for(var n=this.byteArrayMaxLength||50,o=a[t],s=[],i=0,c=0;n>c&&o>c;c++){var h=a[c]||0,f=u.pad0(h.toString(16),r);i+=f.length,s.push(f)}var p=a.constructor.name||e||"";return p&&(p+=" "),0===s.length?p+"[]":i<=this.maxLineLength?p+"[ "+s.join(this.propSep+" ")+" ]":p+"[\n"+s.map(u.addSpaces).join(this.propSep+"\n")+"\n]"}},n.add("undefined",function(){return"undefined"}),n.add("null",function(){return"null"}),n.add("boolean",function(t){return t?"true":"false"}),n.add("symbol",function(t){return t.toString()}),["number","boolean"].forEach(function(t){n.add("object",t,function(t){return this._formatObject(t,{additionalProperties:[["[[PrimitiveValue]]",t.valueOf()]]})})}),n.add("object","string",function(t){var e=t.valueOf();return this._formatObject(t,{keyFilter:function(t){return!(t.match(/\d+/)&&parseInt(t,10)<e.length)},additionalProperties:[["[[PrimitiveValue]]",e]]})}),n.add("object","regexp",function(t){return this._formatObject(t,{value:String(t)})}),n.add("number",function(t){return 0===t&&0>1/t?"-0":String(t)}),n.add("string",function(t){return"'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'"}),n.add("object",function(t){return this._formatObject(t)}),n.add("object","arguments",function(t){return this._formatObject(t,{prefix:"Arguments",formatPropertyName:function(t){return t.match(/\d+/)?void 0:this.formatPropertyName(t)},brackets:["[","]"]})}),n.add("object","array",function(t){return this._formatObject(t,{formatPropertyName:function(t){return t.match(/\d+/)?void 0:this.formatPropertyName(t)},brackets:["[","]"]})}),n.add("object","date",function(t){return this._formatObject(t,{value:o(t,this.isUTCdate)})}),n.add("function",function(t){return this._formatObject(t,{additionalProperties:[["name",n.functionName(t)]]})}),n.add("object","error",function(t){return this._formatObject(t,{prefix:t.name,additionalProperties:[["message",t.message]]})}),n.add("object","buffer",n.generateFunctionForIndexedArray("length","Buffer",2)),n.add("object","array-buffer",n.generateFunctionForIndexedArray("byteLength","ArrayBuffer",2)),n.add("object","typed-array","int8",n.generateFunctionForIndexedArray("length","Int8Array",2)),n.add("object","typed-array","uint8",n.generateFunctionForIndexedArray("length","Uint8Array",2)),n.add("object","typed-array","uint8clamped",n.generateFunctionForIndexedArray("length","Uint8ClampedArray",2)),n.add("object","typed-array","int16",n.generateFunctionForIndexedArray("length","Int16Array",4)),n.add("object","typed-array","uint16",n.generateFunctionForIndexedArray("length","Uint16Array",4)),n.add("object","typed-array","int32",n.generateFunctionForIndexedArray("length","Int32Array",8)),
n.add("object","typed-array","uint32",n.generateFunctionForIndexedArray("length","Uint32Array",8)),n.add("object","promise",function(){return"[Promise]"}),n.add("object","xhr",function(){return"[XMLHttpRequest]"}),n.add("object","html-element",function(t){return t.outerHTML}),n.add("object","html-element","#text",function(t){return t.nodeValue}),n.add("object","html-element","#document",function(t){return t.documentElement.outerHTML}),n.add("object","host",function(){return"[Host]"}),n.add("object","set",function(t){var e=t.values(),r=0;this.seen.push(t);for(var a=[],n=e.next();!n.done;){var o=n.value,s=this.format(o);r+=s.length,a.push(s),n=e.next()}return this.seen.pop(),0===a.length?"Set {}":r<=this.maxLineLength?"Set { "+a.join(this.propSep+" ")+" }":"Set {\n"+a.map(u.addSpaces).join(this.propSep+"\n")+"\n}"}),n.add("object","map",function(t){var e=t.entries(),r=0;this.seen.push(t);for(var a=[],n=e.next();!n.done;){var o,s=n.value,i=this.format(s[0]),c=this.format(s[1]);o=i.length+c.length+4<=this.maxLineLength?i+" => "+c:i+" =>\n"+c,r+=i.length+c.length+4,a.push(o),n=e.next()}return this.seen.pop(),0===a.length?"Map {}":r<=this.maxLineLength?"Map { "+a.join(this.propSep+" ")+" }":"Map {\n"+a.map(u.addSpaces).join(this.propSep+"\n")+"\n}"}),n.prototype.defaultFormat=n.prototype._format_object,s.Formatter=n,e.exports=s},{"./util":22,"should-type":23}],22:[function(t,e,r){function a(t){return t.split("\n").map(function(t){return" "+t}).join("\n")}function n(t,e,r){t=String(t);var a=!1;if(0>e&&(a=!0,e=-e),t.length<e){var n=new Array(e-t.length+1).join(r);return a?t+n:n+t}return t}e.exports={addSpaces:a,pad:n,pad0:function(t,e){return n(t,e,"0")}}},{}],23:[function(t,e,r){function a(t,e,r){this.type=t,this.cls=e,this.sub=r}function n(){this.checks=[]}function o(t){return u.getType(t)}var s=Object.prototype.toString,i=t("./types");n.prototype={add:function(t){return this.checks.push(t),this},addTypeOf:function(t,e){return this.add(function(r,n){return n===t?new a(e):void 0})},addClass:function(t,e,r){return this.add(function(n,o,s){return s===t?new a(i.OBJECT,e,r):void 0})},getType:function(t){for(var e=typeof t,r=s.call(t),a=0,n=this.checks.length;n>a;a++){var o=this.checks[a].call(this,t,e,r);if("undefined"!=typeof o)return o}}};var u=new n;u.addTypeOf(i.NUMBER,i.NUMBER).addTypeOf(i.UNDEFINED,i.UNDEFINED).addTypeOf(i.STRING,i.STRING).addTypeOf(i.BOOLEAN,i.BOOLEAN).addTypeOf(i.FUNCTION,i.FUNCTION).addTypeOf(i.SYMBOL,i.SYMBOL).add(function(t,e){return null===t?new a(i.NULL):void 0}).addClass("[object String]",i.STRING).addClass("[object Boolean]",i.BOOLEAN).addClass("[object Number]",i.NUMBER).addClass("[object Array]",i.ARRAY).addClass("[object RegExp]",i.REGEXP).addClass("[object Error]",i.ERROR).addClass("[object Date]",i.DATE).addClass("[object Arguments]",i.ARGUMENTS).addClass("[object Math]").addClass("[object JSON]").addClass("[object ArrayBuffer]",i.ARRAY_BUFFER).addClass("[object Int8Array]",i.TYPED_ARRAY,"int8").addClass("[object Uint8Array]",i.TYPED_ARRAY,"uint8").addClass("[object Uint8ClampedArray]",i.TYPED_ARRAY,"uint8clamped").addClass("[object Int16Array]",i.TYPED_ARRAY,"int16").addClass("[object Uint16Array]",i.TYPED_ARRAY,"uint16").addClass("[object Int32Array]",i.TYPED_ARRAY,"int32").addClass("[object Uint32Array]",i.TYPED_ARRAY,"uint32").addClass("[object Float32Array]",i.TYPED_ARRAY,"float32").addClass("[object Float64Array]",i.TYPED_ARRAY,"float64").addClass("[object DataView]",i.DATA_VIEW).addClass("[object Map]",i.MAP).addClass("[object WeakMap]",i.WEAK_MAP).addClass("[object Set]",i.SET).addClass("[object WeakSet]",i.WEAK_SET).addClass("[object Promise]",i.PROMISE).addClass("[object Blob]",i.BLOB).addClass("[object File]",i.FILE).addClass("[object FileList]",i.FILE_LIST).addClass("[object XMLHttpRequest]",i.XHR).add(function(t){return typeof Promise===i.FUNCTION&&t instanceof Promise||typeof t.then===i.FUNCTION?new a(i.OBJECT,i.PROMISE):void 0}).add(function(t){return"undefined"!=typeof Buffer&&t instanceof Buffer?new a(i.OBJECT,i.BUFFER):void 0}).add(function(t){return"undefined"!=typeof Node&&t instanceof Node?new a(i.OBJECT,i.HTML_ELEMENT,t.nodeName):void 0}).add(function(t){return t.Boolean===Boolean&&t.Number===Number&&t.String===String&&t.Date===Date?new a(i.OBJECT,i.HOST):void 0}).add(function(){return new a(i.OBJECT)}),o.checker=u,o.TypeChecker=n,o.Type=a,Object.keys(i).forEach(function(t){o[t]=i[t]}),e.exports=o},{"./types":24}],24:[function(t,e,r){var a={NUMBER:"number",UNDEFINED:"undefined",STRING:"string",BOOLEAN:"boolean",OBJECT:"object",FUNCTION:"function",NULL:"null",ARRAY:"array",REGEXP:"regexp",DATE:"date",ERROR:"error",ARGUMENTS:"arguments",SYMBOL:"symbol",ARRAY_BUFFER:"array-buffer",TYPED_ARRAY:"typed-array",DATA_VIEW:"data-view",MAP:"map",SET:"set",WEAK_SET:"weak-set",WEAK_MAP:"weak-map",PROMISE:"promise",BUFFER:"buffer",HTML_ELEMENT:"html-element",HTML_ELEMENT_TEXT:"html-element-text",DOCUMENT:"document",WINDOW:"window",FILE:"file",FILE_LIST:"file-list",BLOB:"blob",HOST:"host",XHR:"xhr"};e.exports=a},{}]},{},[1])(1)});