Comparing version 4.4.3 to 4.4.4
@@ -0,1 +1,6 @@ | ||
4.4.4 / 2015-01-08 | ||
================== | ||
* Added .enumerables | ||
4.4.3 / 2015-01-08 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -43,2 +43,34 @@ /*! | ||
/** | ||
* Asserts given object has enumerable properties | ||
* | ||
* @name enumerables | ||
* @memberOf Assertion | ||
* @category assertion property | ||
* @param {Array|...string|Object} names Names of property | ||
* @example | ||
* | ||
* ({ a: 10, b: 10 }).should.have.enumerables('a'); | ||
*/ | ||
Assertion.add('enumerables', function(names) { | ||
if(arguments.length > 1) { | ||
names = aSlice.call(arguments); | ||
} else if(!util.isArray(names)) { | ||
if(util.isString(names)) { | ||
names = [names]; | ||
} else { | ||
values = names; | ||
names = Object.keys(names); | ||
} | ||
} | ||
this.params = { | ||
operator: "to have enumerables " + names.map(util.formatProp) | ||
}; | ||
names.forEach(function(name) { | ||
this.assert(this.obj.propertyIsEnumerable(name)); | ||
}, this); | ||
}); | ||
/** | ||
* Asserts given object has property with optionally value. **On success it change given object to be value of property**. | ||
@@ -45,0 +77,0 @@ * |
{ | ||
"name": "should", | ||
"description": "test framework agnostic BDD-style assertions", | ||
"version": "4.4.3", | ||
"version": "4.4.4", | ||
"author": "TJ Holowaychuk <tj@vision-media.ca> and contributors", | ||
@@ -6,0 +6,0 @@ "repository": { |
/* | ||
* should - test framework agnostic BDD-style assertions | ||
* @version v4.4.3 | ||
* @version v4.4.4 | ||
* @author TJ Holowaychuk <tj@vision-media.ca> and contributors | ||
@@ -8,2 +8,2 @@ * @link https://github.com/shouldjs/should.js | ||
*/ | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Should=t()}}(function(){return function t(e,r,n){function o(s,i){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!i&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};e[s][0].call(f.exports,function(t){var r=e[s][1][t];return o(r?r:t)},f,f.exports,t,e,r,n)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){var n=t("./util"),o=t("should-format"),a=function c(t){return new c.Assertion(t)};a.AssertionError=t("./assertion-error"),a.Assertion=t("./assertion"),a.format=o,a.config={checkProtoEql:!1},r=e.exports=a,a.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 a(n.isWrapperType(this)?this.valueOf():this)},configurable:!0}),{name:t,descriptor:r,proto:e}};var s=Object.prototype,i="should",u=a.extend(i,s);a.noConflict=function(t){return t=t||u,delete t.proto[t.name],t.descriptor&&Object.defineProperty(t.proto,t.name,t.descriptor),a},a.use=function(t){return t(this,this.Assertion),this},a.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,"./ext/assert":5,"./ext/bool":6,"./ext/chain":7,"./ext/contain":8,"./ext/eql":9,"./ext/error":10,"./ext/match":11,"./ext/number":12,"./ext/property":13,"./ext/string":14,"./ext/type":15,"./util":16,"should-format":19}],2:[function(t,e){var r=t("./util"),n=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,this.message=t.message;var e=t.stackStartFunction;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var o=n.stack;if(e){var a=r.functionName(e),s=o.indexOf("\n"+a);if(s>=0){var i=o.indexOf("\n",s+1);o=o.substring(i+1)}}this.stack=o}}};n.prototype=Object.create(Error.prototype),e.exports=n},{"./util":16}],3:[function(t,e){function r(t){this.obj=t}function n(t){return i+t}function o(t){return t.split("\n").map(n).join("\n")}var a=t("./assertion-error"),s=(t("./util"),t("should-format"));r.add=function(t,e,n){var o={enumerable:!0};"undefined"==typeof n&&(n=!1),o[n?"get":"value"]=function(){var t=new r(this.obj,s);t.anyOne=this.anyOne;try{e.apply(t,arguments)}catch(n){if(this.params=t.params,n instanceof a){if(this.negate)return this.obj=t.obj,this.negate=!1,this;this.nestedErrorMessage=n.message,this.fail()}throw n}return this.params=t.params,this.negate&&(t.negate=!0,this.nestedErrorMessage=t.params.message?t.params.message:t.getMessage(),this.fail()),this.obj=t.obj,this.negate=!1,this},Object.defineProperty(r.prototype,t,o)},r.alias=function(t,e){var n=Object.getOwnPropertyDescriptor(r.prototype,t);if(!n)throw new Error("Alias "+t+" -> "+e+" could not be created as "+t+" not defined");Object.defineProperty(r.prototype,e,n)};var i=" ";r.prototype={constructor:r,assert:function(t){if(t)return this;var e=this.params,r=e.message,n=!1;r||(r=this.getMessage(),n=!0),this.nestedErrorMessage&&r!=this.nestedErrorMessage&&(r=r+"\n"+o(this.nestedErrorMessage));var s=new a({message:r,actual:this.obj,expected:e.expected,stackStartFunction:e.stackStartFunction||this.assert});throw s.showDiff=e.showDiff,s.operator=e.operator,s.generatedMessage=n,s},fail:function(){return this.assert(!1)},getMessage:function(){var t=s("obj"in this.params?this.params.obj:this.obj),e="expected"in this.params?" "+s(this.params.expected):"",r="details"in this.params&&this.params.details?" ("+this.params.details+")":"";return"expected "+t+(this.negate?" not ":" ")+this.params.operator+e+r},get not(){return this.negate=!this.negate,this},get any(){return this.anyOne=!0,this}},e.exports=r},{"./assertion-error":2,"./util":16,"should-format":19}],4:[function(t,e){function r(t,e,n,o,a){var s=new i(t);s.params={operator:o,expected:e,message:n,stackStartFunction:a||r},s.fail()}function n(t,e){t||r(t,!0,e,"==",f.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 a(t,e,n,a){var i;s.isString(n)&&(a=n,n=null);try{e()}catch(u){i=u}if(a=(n&&n.name?" ("+n.name+")":".")+(a?" "+a:"."),t&&!i&&r(i,n,"Missing expected exception"+a),!t&&o(i,n)&&r(i,n,"Got unwanted exception"+a),t&&i&&n&&!o(i,n)||!t&&i)throw i}var s=t("./../util"),i=t("./../assertion"),u=t("should-equal"),c=Array.prototype.slice,f=e.exports=n;f.fail=r,f.ok=n,f.equal=function(t,e,n){t!=e&&r(t,e,n,"==",f.equal)},f.notEqual=function(t,e,n){t==e&&r(t,e,n,"!=",f.notEqual)},f.deepEqual=function(t,e,n){u(t,e).result||r(t,e,n,"deepEqual",f.deepEqual)},f.notDeepEqual=function(t,e,n){u(t,e).result&&r(t,e,n,"notDeepEqual",f.notDeepEqual)},f.strictEqual=function(t,e,n){t!==e&&r(t,e,n,"===",f.strictEqual)},f.notStrictEqual=function(t,e,n){t===e&&r(t,e,n,"!==",f.notStrictEqual)},f.throws=function(){a.apply(this,[!0].concat(c.call(arguments)))},f.doesNotThrow=function(){a.apply(this,[!1].concat(c.call(arguments)))},f.ifError=function(t){if(t)throw t}},{"./../assertion":3,"./../util":16,"should-equal":17}],5:[function(t,e){var r=t("../util"),n=t("./_assert"),o=t("../assertion-error");e.exports=function(t){var e=t.format;r.merge(t,n),t.exist=t.exists=function(r,n){if(null==r)throw new o({message:n||"expected "+e(r)+" to exist",stackStartFunction:t.exist})},t.not={},t.not.exist=t.not.exists=function(r,n){if(null!=r)throw new o({message:n||"expected "+e(r)+" to not exist",stackStartFunction:t.not.exist})}}},{"../assertion-error":2,"../util":16,"./_assert":4}],6:[function(t,e){e.exports=function(t,e){e.add("true",function(){this.is.exactly(!0)},!0),e.alias("true","True"),e.add("false",function(){this.is.exactly(!1)},!0),e.alias("false","False"),e.add("ok",function(){this.params={operator:"to be truthy"},this.assert(this.obj)},!0)}},{}],7:[function(t,e){e.exports=function(t,e){function r(t){Object.defineProperty(e.prototype,t,{get:function(){return this},enumerable:!0})}["an","of","a","and","be","have","with","is","which","the"].forEach(r)}},{}],8:[function(t,e){var r=t("../util"),n=t("should-equal");e.exports=function(t,e){var o=t.format;e.add("containEql",function(t){this.params={operator:"to contain "+o(t)};var e=this.obj;r.isArray(e)?this.assert(e.some(function(e){return n(e,t).result})):r.isString(e)?this.assert(e.indexOf(String(t))>=0):r.isObject(e)?r.forOwn(t,function(t,r){e.should.have.property(r,t)}):this.assert(!1)}),e.add("containDeepOrdered",function(e){this.params={operator:"to contain "+o(e)};var n=this.obj;if(r.isArray(n))if(r.isArray(e)){var a=0;n.forEach(function(r){try{t(r).not.be.Null.and.containDeepOrdered(e[a]),a++}catch(n){if(n instanceof t.AssertionError)return;throw n}},this),this.assert(a==e.length)}else this.assert(!1);else r.isString(n)?this.assert(n.indexOf(String(e))>=0):r.isObject(n)?r.isObject(e)?r.forOwn(e,function(e,r){t(n[r]).not.be.Null.and.containDeepOrdered(e)}):this.assert(!1):this.eql(e)}),e.add("containDeep",function(e){this.params={operator:"to contain "+o(e)};var n=this.obj;if(r.isArray(n))if(r.isArray(e)){var a={};e.forEach(function(e){this.assert(n.some(function(r,n){if(n in a)return!1;try{return t(r).not.be.Null.and.containDeep(e),a[n]=!0,!0}catch(o){if(o instanceof t.AssertionError)return!1;throw o}}))},this)}else this.assert(!1);else r.isString(n)?this.assert(n.indexOf(String(e))>=0):r.isObject(n)?r.isObject(e)?r.forOwn(e,function(e,r){t(n[r]).not.be.Null.and.containDeep(e)}):this.assert(!1):this.eql(e)})}},{"../util":16,"should-equal":17}],9:[function(t,e){var r=t("should-equal"),n=t("../util");e.exports=function(t,e){e.add("eql",function(e,o){this.params={operator:"to equal",expected:e,showDiff:!0,message:o};var a=r(this.obj,e,t.config);a.result||(this.params.details=n.formatEqlResult(a,this.obj,e,t.format)),this.assert(a.result)}),e.add("equal",function(t,e){this.params={operator:"to be",expected:t,showDiff:!0,message:e},this.assert(t===this.obj)}),e.alias("equal","exactly")}},{"../util":16,"should-equal":17}],10:[function(t,e){var r=t("../util");e.exports=function(t,e){var n=t.format;e.add("throw",function(e,o){var a=this.obj,s={},i="",u=!1;this.is.a.Function;var c=!0;try{a()}catch(f){u=!0,s=f}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(r.isObject(e))try{s.should.match(e)}catch(f){if(!(f instanceof t.AssertionError))throw f;i=": "+f.message,c=!1}if(c){if("function"==typeof e&&o)try{s.should.match(o)}catch(f){if(!(f instanceof t.AssertionError))throw f;i=": "+f.message,c=!1}}else"string"==typeof e||e instanceof RegExp?i=" with a message matching "+n(e)+", but got '"+s.message+"'":"function"==typeof e&&(i=" of type "+r.functionName(e)+", but got "+r.functionName(s.constructor))}else i=" (got "+n(s)+")";this.params={operator:"to throw exception"+i},this.assert(u),this.assert(c)}),e.alias("throw","throwError")}},{"../util":16}],11:[function(t,e){var r=t("../util"),n=t("should-equal");e.exports=function(t,e){var o=t.format;e.add("match",function(a,s){if(this.params={operator:"to match "+o(a),message:s},!n(this.obj,a).result)if(r.isRegExp(a)){if(r.isString(this.obj))this.assert(a.exec(this.obj));else if(r.isArray(this.obj))this.obj.forEach(function(t){this.assert(a.exec(t))},this);else if(r.isObject(this.obj)){var i=[],u=[];r.forOwn(this.obj,function(t,e){a.exec(t)?u.push(r.formatProp(e)):i.push(r.formatProp(e)+" ("+o(t)+")")},this),i.length&&(this.params.operator+="\n not matched properties: "+i.join(", ")),u.length&&(this.params.operator+="\n matched properties: "+u.join(", ")),this.assert(0==i.length)}}else if(r.isFunction(a)){var c;c=a(this.obj),c instanceof e&&(this.params.operator+="\n "+c.getMessage()),r.isBoolean(c)&&this.assert(c)}else r.isObject(a)?(i=[],u=[],r.forOwn(a,function(e,n){try{t(this.obj[n]).match(e),u.push(r.formatProp(n))}catch(a){if(!(a instanceof t.AssertionError))throw a;i.push(r.formatProp(n)+" ("+o(this.obj[n])+")")}},this),i.length&&(this.params.operator+="\n not matched properties: "+i.join(", ")),u.length&&(this.params.operator+="\n matched properties: "+u.join(", ")),this.assert(0==i.length)):this.assert(!1)}),e.add("matchEach",function(t,e){this.params={operator:"to match each "+o(t),message:e};var a=t;r.isRegExp(t)?a=function(e){return!!t.exec(e)}:r.isFunction(t)||(a=function(e){return n(e,t).result}),r.forOwn(this.obj,function(t,e){var n=a(t,e);r.isBoolean(n)&&this.assert(n)},this)})}},{"../util":16,"should-equal":17}],12:[function(t,e){e.exports=function(t,e){e.add("NaN",function(){this.params={operator:"to be NaN"},this.assert(this.obj!==this.obj)},!0),e.add("Infinity",function(){this.params={operator:"to be Infinity"},this.obj.should.be.a.Number.and.not.a.NaN.and.assert(!isFinite(this.obj))},!0),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")}},{}],13:[function(t,e){var r=t("../util"),n=t("should-equal"),o=Array.prototype.slice;e.exports=function(t,e){var a=t.format;e.add("enumerable",function(t,e){t=String(t),this.params={operator:"to have enumerable property "+r.formatProp(t)},this.assert(this.obj.propertyIsEnumerable(t)),arguments.length>1&&(this.params.operator+=" equal to "+a(e),this.assert(n(e,this.obj[t]).result))}),e.add("property",function(t,e){if(t=String(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):r.isArray(t)||(r.isString(t)?t=[t]:(e=t,t=Object.keys(t)));var s=Object(this.obj),i=[];t.forEach(function(t){t in s||i.push(r.formatProp(t))});var u=i;0===u.length?u=t.map(r.formatProp):this.anyOne&&(u=t.filter(function(t){return i.indexOf(r.formatProp(t))<0}).map(r.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 f=Object.keys(e);if(f.length){var h=[];u=[],f.forEach(function(t){var o=e[t];n(s[t],o).result?u.push(r.formatProp(t)+" of "+a(o)):h.push(r.formatProp(t)+" of "+a(o)+" (got "+a(s[t])+")")}),(0!==h.length&&!this.anyOne||this.anyOne&&0===u.length)&&(u=h),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===h.length||this.anyOne&&h.length!=f.length)}}),e.add("length",function(t,e){this.have.property("length",t,e)}),e.alias("length","lengthOf");var s=Object.prototype.hasOwnProperty;e.add("ownProperty",function(t,e){t=String(t),this.params={obj:this.obj,operator:"to have own property "+r.formatProp(t),message:e},this.assert(s.call(this.obj,t)),this.obj=this.obj[t]}),e.alias("ownProperty","hasOwnProperty"),e.add("empty",function(){if(this.params={operator:"to be empty"},r.isString(this.obj)||r.isArray(this.obj)||r.isArguments(this.obj))this.obj.should.have.property("length",0);else{var t=Object(this.obj);for(var e in t)this.obj.should.not.have.ownProperty(e)}},!0),e.add("keys",function(t){arguments.length>1?t=o.call(arguments):1===arguments.length&&r.isString(t)?t=[t]:0===arguments.length&&(t=[]),t=t.map(String);var e=Object(this.obj),n=[];t.forEach(function(t){s.call(this.obj,t)||n.push(r.formatProp(t))},this);var a=[];Object.keys(e).forEach(function(e){t.indexOf(e)<0&&a.push(r.formatProp(e))});var i=0===t.length?"to be empty":"to have "+(1===t.length?"key ":"keys ");this.params={operator:i+t.map(r.formatProp).join(", ")},n.length>0&&(this.params.operator+="\n missing keys: "+n.join(", ")),a.length>0&&(this.params.operator+="\n extra keys: "+a.join(", ")),this.assert(0===n.length&&0===a.length)}),e.alias("keys","key"),e.add("propertyByPath",function(e){arguments.length>1?e=o.call(arguments):1===arguments.length&&r.isString(e)?e=[e]:0===arguments.length&&(e=[]);var n=e.map(r.formatProp);e=e.map(String);for(var a,s=t(Object(this.obj)),i=[];a=e.shift();)this.params={operator:"to have property by path "+n.join(", ")+" - failed on "+r.formatProp(a)},s=s.have.property(a),i.push(a);this.params={obj:this.obj,operator:"to have property by path "+n.join(", ")},this.obj=s.obj})}},{"../util":16,"should-equal":17}],14:[function(t,e){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)})}},{}],15:[function(t,e){var r=t("../util");e.exports=function(t,e){e.add("Number",function(){this.params={operator:"to be a number"},this.assert(r.isNumber(this.obj))},!0),e.add("arguments",function(){this.params={operator:"to be arguments"},this.assert(r.isArguments(this.obj))},!0),e.alias("arguments","Arguments"),e.add("type",function(t,e){this.params={operator:"to have type "+t,message:e},(typeof this.obj).should.be.exactly(t,e)}),e.add("instanceof",function(t,e){this.params={operator:"to be an instance of "+r.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.assert(r.isFunction(this.obj))},!0),e.add("Object",function(){this.params={operator:"to be an object"},this.assert(r.isObject(this.obj))},!0),e.add("String",function(){this.params={operator:"to be a string"},this.assert(r.isString(this.obj))},!0),e.add("Array",function(){this.params={operator:"to be an array"},this.assert(r.isArray(this.obj))},!0),e.add("Boolean",function(){this.params={operator:"to be a boolean"},this.assert(r.isBoolean(this.obj))},!0),e.add("Error",function(){this.params={operator:"to be an error"},this.assert(r.isError(this.obj))},!0),e.add("null",function(){this.params={operator:"to be null"},this.assert(null===this.obj)},!0),e.alias("null","Null")}},{"../util":16}],16:[function(t,e,r){function n(t){return f(t)&&(t.__ArrayLike||Array.isArray(t))}function o(t){return"number"==typeof t}function a(t){return"string"==typeof t}function s(t){return"boolean"==typeof t}function i(t){return"undefined"!=typeof Buffer&&t instanceof Buffer}function u(t){return f(t)&&"[object Date]"===c(t)}function c(t){return Object.prototype.toString.call(t)}function f(t){return"object"==typeof t&&null!==t}function h(t){return f(t)&&"[object RegExp]"===c(t)}function p(t){return null==t}function l(t){return null===t}function m(t){return"[object Arguments]"===c(t)}function b(t){return f(t)&&"[object Error]"===c(t)||t instanceof Error}function g(t){return void 0===t}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},r.isArray=n,r.isNumber=o,r.isBoolean=s,r.isString=a,r.isBuffer=i,r.isDate=u,r.isObject=f,r.isRegExp=h,r.isNullOrUndefined=p,r.isNull=l,r.isArguments=m,r.isFunction=function(t){return"function"==typeof t||t instanceof Function},r.isError=b,r.isUndefined=g;var d=Object.prototype.hasOwnProperty;r.forOwn=function(t,e,r){for(var n in t)d.call(t,n)&&e.call(r,t[n],n)};var y=/^\s*function\s*(\S*)\s*\(/;r.functionName=function(t){if(t.name)return t.name;var e=t.toString().match(y)[1];return e};var j=t("should-format").formatPropertyName;r.formatProp=function(t){return j(String(t))},r.formatEqlResult=function(t,e,n,o){return((t.path.length>0?"at "+t.path.map(r.formatProp).join(" -> "):"")+(t.a===e?"":", A has "+o(t.a))+(t.b===n?"":" and B has "+o(t.b))+(t.showReason?" because "+t.reason:"")).trim()}},{"should-format":19}],17:[function(t,e){function r(t,e,r,n,o,a){var s={result:t};return t||(s.path=e,s.reason=r,s.a=n,s.b=o,s.showReason=a),s}function n(t){for(var e=arguments,r=1,n=e.length;n>r;r++)t=t.replace(/%s/,e[r]);return t}function o(t,e,m,b,g,d){if(d=d||[],m=m||{checkProtoEql:!0},t===e)return r(0!==t||1/t==1/e,d,u.PLUS_0_AND_MINUS_0,t,e);var y,j,E=a(t),v=a(e);if(E!==v)return r(!1,d,n(u.DIFFERENT_TYPES,E,v),t,e);switch(E){case"number":return t!==t?r(e!==e,d,u.NAN_NUMBER,t,e):0===t?r(1/t===1/e,d,u.PLUS_0_AND_MINUS_0,t,e):r(t===e,d,u.EQUALITY,t,e);case"regexp":if(j=t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase)break;return r(!1,d,u.EQUALITY,t,e);case"boolean":case"string":return r(t===e,d,u.EQUALITY,t,e);case"date":if(j=+t===+e)break;return r(!1,d,u.EQUALITY,t,e);case"object-number":case"object-boolean":case"object-string":if(j=t.valueOf()===e.valueOf())break;return r(!1,d,u.WRAPPED_VALUE,t.valueOf(),e.valueOf());case"buffer":if(t.length!==e.length)return r(!1,d.concat(c),u.EQUALITY,t.length,e.length);for(y=t.length;y--;)if(t[y]!==e[y])return r(!1,d.concat([y]),u.EQUALITY,t[y],e[y]);return i;case"error":if(t.name!==e.name)return r(!1,d.concat(f),u.EQUALITY,t.name,e.name);if(t.message!==e.message)return r(!1,d.concat(h),u.EQUALITY,t.message,e.message);break;case"array-buffer":if(t.byteLength!==e.byteLength)return r(!1,d.concat(p),u.EQUALITY,t.byteLength,e.byteLength);for(y=t.byteLength;y--;)if(t[y]!==e[y])return r(!1,d.concat([y]),u.EQUALITY,t[y],e[y]);return i}for(b||(b=[]),g||(g=[]),y=b.length;y--;)if(b[y]==t)return r(g[y]==e,d,u.CIRCULAR_VALUES,t,e);b.push(t),g.push(e);var O,A,x;if(("array"===E||"arguments"===E)&&t.length!==e.length)return r(!1,d.concat(c),u.EQUALITY,t.length,e.length);if("function"===v){var S=t.toString(),N=e.toString();if(S!==N)return r(!1,d,u.FUNCTION_SOURCES,S,N)}for(x in e)if(s.call(e,x)){if(O=s.call(t,x),!O)return r(!1,d,n(u.MISSING_KEY,"A",x),t,e);if(A=o(t[x],e[x],m,b,g,d.concat([x])),!A.result)return A}for(x in t)if(s.call(t,x)&&(O=s.call(e,x),!O))return r(!1,d,n(u.MISSING_KEY,"B",x),t,e);var R=!1,P=!1;return m.checkProtoEql&&(Object.getPrototypeOf?(R=Object.getPrototypeOf(t)===Object.getPrototypeOf(e),P=!0):t.__proto__&&e.__proto__&&(R=t.__proto__===e.__proto__,P=!0),P&&!R)?r(!1,d,u.EQUALITY_PROTOTYPE,t,e,!0):(b.pop(),g.pop(),"function"!==v||(A=o(t.prototype,e.prototype,m,b,g,d.concat(l)),A.result)?i:A)}var a=t("should-type"),s=Object.prototype.hasOwnProperty,i=r(!0),u={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 does not have key %s",CIRCULAR_VALUES:"A has circular reference that was visited not in the same time as B"},c=["length"],f=["name"],h=["message"],p=["byteLength"],l=["prototype"];e.exports=o},{"should-type":18}],18:[function(t,e){var r=Object.prototype.toString,n={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",WRAPPER_NUMBER:"object-number",WRAPPER_BOOLEAN:"object-boolean",WRAPPER_STRING:"object-string",BUFFER:"buffer",HTML_ELEMENT:"html-element",HTML_ELEMENT_TEXT:"html-element-text",DOCUMENT:"document",WINDOW:"window",FILE:"file",FILE_LIST:"file-list",BLOB:"blob",XHR:"xhr"};e.exports=function o(t){var e=typeof t;switch(e){case n.NUMBER:return n.NUMBER;case n.UNDEFINED:return n.UNDEFINED;case n.STRING:return n.STRING;case n.BOOLEAN:return n.BOOLEAN;case n.FUNCTION:return n.FUNCTION;case n.SYMBOL:return n.SYMBOL;case n.OBJECT:if(null===t)return n.NULL;var a=r.call(t);switch(a){case"[object String]":return n.WRAPPER_STRING;case"[object Boolean]":return n.WRAPPER_BOOLEAN;case"[object Number]":return n.WRAPPER_NUMBER;case"[object Array]":return n.ARRAY;case"[object RegExp]":return n.REGEXP;case"[object Error]":return n.ERROR;case"[object Date]":return n.DATE;case"[object Arguments]":return n.ARGUMENTS;case"[object Math]":return n.OBJECT;case"[object JSON]":return n.OBJECT;case"[object ArrayBuffer]":return n.ARRAY_BUFFER;case"[object Int8Array]":return n.TYPED_ARRAY;case"[object Uint8Array]":return n.TYPED_ARRAY;case"[object Uint8ClampedArray]":return n.TYPED_ARRAY;case"[object Int16Array]":return n.TYPED_ARRAY;case"[object Uint16Array]":return n.TYPED_ARRAY;case"[object Int32Array]":return n.TYPED_ARRAY;case"[object Uint32Array]":return n.TYPED_ARRAY;case"[object Float32Array]":return n.TYPED_ARRAY;case"[object Float64Array]":return n.TYPED_ARRAY;case"[object DataView]":return n.DATA_VIEW;case"[object Map]":return n.MAP;case"[object WeakMap]":return n.WEAK_MAP;case"[object Set]":return n.SET;case"[object WeakSet]":return n.WEAK_SET;case"[object Promise]":return n.PROMISE;case"[object Window]":return n.WINDOW;case"[object HTMLDocument]":return n.DOCUMENT;case"[object Blob]":return n.BLOB;case"[object File]":return n.FILE;case"[object FileList]":return n.FILE_LIST;case"[object XMLHttpRequest]":return n.XHR;case"[object Text]":return n.HTML_ELEMENT_TEXT;default:if(typeof Promise===n.FUNCTION&&t instanceof Promise||o(t.then)===n.FUNCTION&&t.then.length>=2)return n.PROMISE;if("undefined"!=typeof Buffer&&t instanceof Buffer)return n.BUFFER;if(/^\[object HTML\w+Element\]$/.test(a))return n.HTML_ELEMENT;if("[object Object]"===a)return n.OBJECT}}},Object.keys(n).forEach(function(t){e.exports[t]=n[t]})},{}],19:[function(t,e){function r(t){return function(e){var r=t(e);return r.sort(),r}}function n(t,e){m.formats[t]=e}function o(t){return" "+t}function a(t,e,r,n){n=n||e.keys(t);var a=0;return e.seen.push(t),n=n.map(function(r){var n=s(t,e,r);return a+=n.length,n}),e.seen.pop(),0===n.length?"{}":a<=e.maxLineLength?"{ "+(r?r+" ":"")+n.join(e.propSep+" ")+" }":"{\n"+(r?r+"\n":"")+n.map(o).join(e.propSep+"\n")+"\n}"}function s(t,e,r){var n;try{n=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]}}catch(o){n={value:o}}var a=m.formatPropertyName(r,e),s=n.get&&n.set?"[Getter/Setter]":n.get?"[Getter]":n.set?"[Setter]":e.seen.indexOf(n.value)>=0?"[Circular]":m(n.value,e);return a+": "+s}function i(t){return 10>t?"0"+t:""+t}function u(t){return 100>t?"0"+i(t):""+t}function c(t){var e=t.getTimezoneOffset(),r=Math.abs(e),n=Math.floor(r/60),o=r-60*n,a="GMT"+(0>e?"+":"-")+i(n)+i(o);return t.toLocaleDateString()+" "+t.toLocaleTimeString()+"."+u(t.getMilliseconds())+" "+a}function f(t){return function(e,r){var n=t(e),o=r.keys(e);return 0==o.length?n:a(e,r,n,o)}}function h(t){if(t.name)return t.name;var e=t.toString().match(b)[1];return e}function p(t,e){return function(r){var n="",o=50,a=r[t];if(a>0){for(var s=0;o>s&&a>s;s++){var u=r[s]||0;n+=" "+i(u.toString(16))}a>o&&(n+=" ... ")}return"["+(r.constructor.name||e)+(n?":"+n:"")+"]"}}var l=t("should-type"),m=function(t,e){e=e||{},"seen"in e||(e.seen=[]),e.keys=r("keys"in e&&e.keys===!1?Object.getOwnPropertyNames:Object.keys),"maxLineLength"in e||(e.maxLineLength=60),"propSep"in e||(e.propSep=",");var n=l(t);return(m.formats[n]||m.formats.object)(t,e)};e.exports=m,m.formats={},["undefined","boolean","null"].forEach(function(t){n(t,String)}),["number","boolean"].forEach(function(t){var e=t.substring(0,1).toUpperCase()+t.substring(1);n("object-"+t,f(function(t){return"["+e+": "+m(t.valueOf())+"]"}))}),n("object-string",function(t,e){var r=t.valueOf(),n="[String: "+m(r)+"]",o=e.keys(t);return o=o.filter(function(t){return!(t.match(/\d+/)&&parseInt(t,10)<r.length)}),0==o.length?n:a(t,e,n,o)}),n("regexp",f(String)),n("number",function(t){return 0===t&&0>1/t?"-0":String(t)}),n("string",function(t){return"'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'"}),n("object",a),n("array",function(t,e){var r=e.keys(t),n=0;e.seen.push(t);var a=r.map(function(r){var o;try{o=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]}}catch(a){o={value:a}}var i;return i=r.match(/\d+/)?m(o.value,e):s(o.value,e,r),n+=i.length,i});return e.seen.pop(),0===a.length?"[]":n<=e.maxLineLength?"[ "+a.join(e.propSep+" ")+" ]":"[\n"+a.map(o).join(e.propSep+"\n")+"\n]"}),m.formatPropertyName=function(t,e){return t.match(/^[a-zA-Z_$][a-zA-Z_$0-9]*$/)?t:m(t,e)},n("date",f(c));var b=/^\s*function\s*(\S*)\s*\(/;n("function",f(function(t){var e=h(t);return"[Function"+(e?": "+e:"")+"]"})),n("error",f(function(t){var e=t.name,r=t.message;return"["+e+(r?": "+r:"")+"]"})),n("buffer",p("length","Buffer")),n("array-buffer",p("byteLength")),n("typed-array",p("byteLength")),n("promise",function(){return"[Promise]"}),n("xhr",function(){return"[XMLHttpRequest]"}),n("html-element",function(t){return t.outerHTML}),n("html-element-text",function(t){return t.nodeValue}),n("document",function(t){return t.documentElement.outerHTML}),n("window",function(){return"[Window]"})},{"should-type":20}],20:[function(t,e,r){arguments[4][18][0].apply(r,arguments)},{dup:18}]},{},[1])(1)}); | ||
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Should=t()}}(function(){return function t(e,r,n){function o(s,i){if(!r[s]){if(!e[s]){var u="function"==typeof require&&require;if(!i&&u)return u(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var f=r[s]={exports:{}};e[s][0].call(f.exports,function(t){var r=e[s][1][t];return o(r?r:t)},f,f.exports,t,e,r,n)}return r[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(t,e,r){var n=t("./util"),o=t("should-format"),a=function c(t){return new c.Assertion(t)};a.AssertionError=t("./assertion-error"),a.Assertion=t("./assertion"),a.format=o,a.config={checkProtoEql:!1},r=e.exports=a,a.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 a(n.isWrapperType(this)?this.valueOf():this)},configurable:!0}),{name:t,descriptor:r,proto:e}};var s=Object.prototype,i="should",u=a.extend(i,s);a.noConflict=function(t){return t=t||u,delete t.proto[t.name],t.descriptor&&Object.defineProperty(t.proto,t.name,t.descriptor),a},a.use=function(t){return t(this,this.Assertion),this},a.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,"./ext/assert":5,"./ext/bool":6,"./ext/chain":7,"./ext/contain":8,"./ext/eql":9,"./ext/error":10,"./ext/match":11,"./ext/number":12,"./ext/property":13,"./ext/string":14,"./ext/type":15,"./util":16,"should-format":19}],2:[function(t,e){var r=t("./util"),n=function(t){this.name="AssertionError",this.actual=t.actual,this.expected=t.expected,this.operator=t.operator,this.message=t.message;var e=t.stackStartFunction;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var n=new Error;if(n.stack){var o=n.stack;if(e){var a=r.functionName(e),s=o.indexOf("\n"+a);if(s>=0){var i=o.indexOf("\n",s+1);o=o.substring(i+1)}}this.stack=o}}};n.prototype=Object.create(Error.prototype),e.exports=n},{"./util":16}],3:[function(t,e){function r(t){this.obj=t}function n(t){return i+t}function o(t){return t.split("\n").map(n).join("\n")}var a=t("./assertion-error"),s=(t("./util"),t("should-format"));r.add=function(t,e,n){var o={enumerable:!0};"undefined"==typeof n&&(n=!1),o[n?"get":"value"]=function(){var t=new r(this.obj,s);t.anyOne=this.anyOne;try{e.apply(t,arguments)}catch(n){if(this.params=t.params,n instanceof a){if(this.negate)return this.obj=t.obj,this.negate=!1,this;this.nestedErrorMessage=n.message,this.fail()}throw n}return this.params=t.params,this.negate&&(t.negate=!0,this.nestedErrorMessage=t.params.message?t.params.message:t.getMessage(),this.fail()),this.obj=t.obj,this.negate=!1,this},Object.defineProperty(r.prototype,t,o)},r.alias=function(t,e){var n=Object.getOwnPropertyDescriptor(r.prototype,t);if(!n)throw new Error("Alias "+t+" -> "+e+" could not be created as "+t+" not defined");Object.defineProperty(r.prototype,e,n)};var i=" ";r.prototype={constructor:r,assert:function(t){if(t)return this;var e=this.params,r=e.message,n=!1;r||(r=this.getMessage(),n=!0),this.nestedErrorMessage&&r!=this.nestedErrorMessage&&(r=r+"\n"+o(this.nestedErrorMessage));var s=new a({message:r,actual:this.obj,expected:e.expected,stackStartFunction:e.stackStartFunction||this.assert});throw s.showDiff=e.showDiff,s.operator=e.operator,s.generatedMessage=n,s},fail:function(){return this.assert(!1)},getMessage:function(){var t=s("obj"in this.params?this.params.obj:this.obj),e="expected"in this.params?" "+s(this.params.expected):"",r="details"in this.params&&this.params.details?" ("+this.params.details+")":"";return"expected "+t+(this.negate?" not ":" ")+this.params.operator+e+r},get not(){return this.negate=!this.negate,this},get any(){return this.anyOne=!0,this}},e.exports=r},{"./assertion-error":2,"./util":16,"should-format":19}],4:[function(t,e){function r(t,e,n,o,a){var s=new i(t);s.params={operator:o,expected:e,message:n,stackStartFunction:a||r},s.fail()}function n(t,e){t||r(t,!0,e,"==",f.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 a(t,e,n,a){var i;s.isString(n)&&(a=n,n=null);try{e()}catch(u){i=u}if(a=(n&&n.name?" ("+n.name+")":".")+(a?" "+a:"."),t&&!i&&r(i,n,"Missing expected exception"+a),!t&&o(i,n)&&r(i,n,"Got unwanted exception"+a),t&&i&&n&&!o(i,n)||!t&&i)throw i}var s=t("./../util"),i=t("./../assertion"),u=t("should-equal"),c=Array.prototype.slice,f=e.exports=n;f.fail=r,f.ok=n,f.equal=function(t,e,n){t!=e&&r(t,e,n,"==",f.equal)},f.notEqual=function(t,e,n){t==e&&r(t,e,n,"!=",f.notEqual)},f.deepEqual=function(t,e,n){u(t,e).result||r(t,e,n,"deepEqual",f.deepEqual)},f.notDeepEqual=function(t,e,n){u(t,e).result&&r(t,e,n,"notDeepEqual",f.notDeepEqual)},f.strictEqual=function(t,e,n){t!==e&&r(t,e,n,"===",f.strictEqual)},f.notStrictEqual=function(t,e,n){t===e&&r(t,e,n,"!==",f.notStrictEqual)},f.throws=function(){a.apply(this,[!0].concat(c.call(arguments)))},f.doesNotThrow=function(){a.apply(this,[!1].concat(c.call(arguments)))},f.ifError=function(t){if(t)throw t}},{"./../assertion":3,"./../util":16,"should-equal":17}],5:[function(t,e){var r=t("../util"),n=t("./_assert"),o=t("../assertion-error");e.exports=function(t){var e=t.format;r.merge(t,n),t.exist=t.exists=function(r,n){if(null==r)throw new o({message:n||"expected "+e(r)+" to exist",stackStartFunction:t.exist})},t.not={},t.not.exist=t.not.exists=function(r,n){if(null!=r)throw new o({message:n||"expected "+e(r)+" to not exist",stackStartFunction:t.not.exist})}}},{"../assertion-error":2,"../util":16,"./_assert":4}],6:[function(t,e){e.exports=function(t,e){e.add("true",function(){this.is.exactly(!0)},!0),e.alias("true","True"),e.add("false",function(){this.is.exactly(!1)},!0),e.alias("false","False"),e.add("ok",function(){this.params={operator:"to be truthy"},this.assert(this.obj)},!0)}},{}],7:[function(t,e){e.exports=function(t,e){function r(t){Object.defineProperty(e.prototype,t,{get:function(){return this},enumerable:!0})}["an","of","a","and","be","have","with","is","which","the"].forEach(r)}},{}],8:[function(t,e){var r=t("../util"),n=t("should-equal");e.exports=function(t,e){var o=t.format;e.add("containEql",function(t){this.params={operator:"to contain "+o(t)};var e=this.obj;r.isArray(e)?this.assert(e.some(function(e){return n(e,t).result})):r.isString(e)?this.assert(e.indexOf(String(t))>=0):r.isObject(e)?r.forOwn(t,function(t,r){e.should.have.property(r,t)}):this.assert(!1)}),e.add("containDeepOrdered",function(e){this.params={operator:"to contain "+o(e)};var n=this.obj;if(r.isArray(n))if(r.isArray(e)){var a=0;n.forEach(function(r){try{t(r).not.be.Null.and.containDeepOrdered(e[a]),a++}catch(n){if(n instanceof t.AssertionError)return;throw n}},this),this.assert(a==e.length)}else this.assert(!1);else r.isString(n)?this.assert(n.indexOf(String(e))>=0):r.isObject(n)?r.isObject(e)?r.forOwn(e,function(e,r){t(n[r]).not.be.Null.and.containDeepOrdered(e)}):this.assert(!1):this.eql(e)}),e.add("containDeep",function(e){this.params={operator:"to contain "+o(e)};var n=this.obj;if(r.isArray(n))if(r.isArray(e)){var a={};e.forEach(function(e){this.assert(n.some(function(r,n){if(n in a)return!1;try{return t(r).not.be.Null.and.containDeep(e),a[n]=!0,!0}catch(o){if(o instanceof t.AssertionError)return!1;throw o}}))},this)}else this.assert(!1);else r.isString(n)?this.assert(n.indexOf(String(e))>=0):r.isObject(n)?r.isObject(e)?r.forOwn(e,function(e,r){t(n[r]).not.be.Null.and.containDeep(e)}):this.assert(!1):this.eql(e)})}},{"../util":16,"should-equal":17}],9:[function(t,e){var r=t("should-equal"),n=t("../util");e.exports=function(t,e){e.add("eql",function(e,o){this.params={operator:"to equal",expected:e,showDiff:!0,message:o};var a=r(this.obj,e,t.config);a.result||(this.params.details=n.formatEqlResult(a,this.obj,e,t.format)),this.assert(a.result)}),e.add("equal",function(t,e){this.params={operator:"to be",expected:t,showDiff:!0,message:e},this.assert(t===this.obj)}),e.alias("equal","exactly")}},{"../util":16,"should-equal":17}],10:[function(t,e){var r=t("../util");e.exports=function(t,e){var n=t.format;e.add("throw",function(e,o){var a=this.obj,s={},i="",u=!1;this.is.a.Function;var c=!0;try{a()}catch(f){u=!0,s=f}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(r.isObject(e))try{s.should.match(e)}catch(f){if(!(f instanceof t.AssertionError))throw f;i=": "+f.message,c=!1}if(c){if("function"==typeof e&&o)try{s.should.match(o)}catch(f){if(!(f instanceof t.AssertionError))throw f;i=": "+f.message,c=!1}}else"string"==typeof e||e instanceof RegExp?i=" with a message matching "+n(e)+", but got '"+s.message+"'":"function"==typeof e&&(i=" of type "+r.functionName(e)+", but got "+r.functionName(s.constructor))}else i=" (got "+n(s)+")";this.params={operator:"to throw exception"+i},this.assert(u),this.assert(c)}),e.alias("throw","throwError")}},{"../util":16}],11:[function(t,e){var r=t("../util"),n=t("should-equal");e.exports=function(t,e){var o=t.format;e.add("match",function(a,s){if(this.params={operator:"to match "+o(a),message:s},!n(this.obj,a).result)if(r.isRegExp(a)){if(r.isString(this.obj))this.assert(a.exec(this.obj));else if(r.isArray(this.obj))this.obj.forEach(function(t){this.assert(a.exec(t))},this);else if(r.isObject(this.obj)){var i=[],u=[];r.forOwn(this.obj,function(t,e){a.exec(t)?u.push(r.formatProp(e)):i.push(r.formatProp(e)+" ("+o(t)+")")},this),i.length&&(this.params.operator+="\n not matched properties: "+i.join(", ")),u.length&&(this.params.operator+="\n matched properties: "+u.join(", ")),this.assert(0==i.length)}}else if(r.isFunction(a)){var c;c=a(this.obj),c instanceof e&&(this.params.operator+="\n "+c.getMessage()),r.isBoolean(c)&&this.assert(c)}else r.isObject(a)?(i=[],u=[],r.forOwn(a,function(e,n){try{t(this.obj[n]).match(e),u.push(r.formatProp(n))}catch(a){if(!(a instanceof t.AssertionError))throw a;i.push(r.formatProp(n)+" ("+o(this.obj[n])+")")}},this),i.length&&(this.params.operator+="\n not matched properties: "+i.join(", ")),u.length&&(this.params.operator+="\n matched properties: "+u.join(", ")),this.assert(0==i.length)):this.assert(!1)}),e.add("matchEach",function(t,e){this.params={operator:"to match each "+o(t),message:e};var a=t;r.isRegExp(t)?a=function(e){return!!t.exec(e)}:r.isFunction(t)||(a=function(e){return n(e,t).result}),r.forOwn(this.obj,function(t,e){var n=a(t,e);r.isBoolean(n)&&this.assert(n)},this)})}},{"../util":16,"should-equal":17}],12:[function(t,e){e.exports=function(t,e){e.add("NaN",function(){this.params={operator:"to be NaN"},this.assert(this.obj!==this.obj)},!0),e.add("Infinity",function(){this.params={operator:"to be Infinity"},this.obj.should.be.a.Number.and.not.a.NaN.and.assert(!isFinite(this.obj))},!0),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")}},{}],13:[function(t,e){var r=t("../util"),n=t("should-equal"),o=Array.prototype.slice;e.exports=function(t,e){var a=t.format;e.add("enumerable",function(t,e){t=String(t),this.params={operator:"to have enumerable property "+r.formatProp(t)},this.assert(this.obj.propertyIsEnumerable(t)),arguments.length>1&&(this.params.operator+=" equal to "+a(e),this.assert(n(e,this.obj[t]).result))}),e.add("enumerables",function(t){arguments.length>1?t=o.call(arguments):r.isArray(t)||(r.isString(t)?t=[t]:(values=t,t=Object.keys(t))),this.params={operator:"to have enumerables "+t.map(r.formatProp)},t.forEach(function(t){this.assert(this.obj.propertyIsEnumerable(t))},this)}),e.add("property",function(t,e){if(t=String(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):r.isArray(t)||(r.isString(t)?t=[t]:(e=t,t=Object.keys(t)));var s=Object(this.obj),i=[];t.forEach(function(t){t in s||i.push(r.formatProp(t))});var u=i;0===u.length?u=t.map(r.formatProp):this.anyOne&&(u=t.filter(function(t){return i.indexOf(r.formatProp(t))<0}).map(r.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 f=Object.keys(e);if(f.length){var h=[];u=[],f.forEach(function(t){var o=e[t];n(s[t],o).result?u.push(r.formatProp(t)+" of "+a(o)):h.push(r.formatProp(t)+" of "+a(o)+" (got "+a(s[t])+")")}),(0!==h.length&&!this.anyOne||this.anyOne&&0===u.length)&&(u=h),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===h.length||this.anyOne&&h.length!=f.length)}}),e.add("length",function(t,e){this.have.property("length",t,e)}),e.alias("length","lengthOf");var s=Object.prototype.hasOwnProperty;e.add("ownProperty",function(t,e){t=String(t),this.params={obj:this.obj,operator:"to have own property "+r.formatProp(t),message:e},this.assert(s.call(this.obj,t)),this.obj=this.obj[t]}),e.alias("ownProperty","hasOwnProperty"),e.add("empty",function(){if(this.params={operator:"to be empty"},r.isString(this.obj)||r.isArray(this.obj)||r.isArguments(this.obj))this.obj.should.have.property("length",0);else{var t=Object(this.obj);for(var e in t)this.obj.should.not.have.ownProperty(e)}},!0),e.add("keys",function(t){arguments.length>1?t=o.call(arguments):1===arguments.length&&r.isString(t)?t=[t]:0===arguments.length&&(t=[]),t=t.map(String);var e=Object(this.obj),n=[];t.forEach(function(t){s.call(this.obj,t)||n.push(r.formatProp(t))},this);var a=[];Object.keys(e).forEach(function(e){t.indexOf(e)<0&&a.push(r.formatProp(e))});var i=0===t.length?"to be empty":"to have "+(1===t.length?"key ":"keys ");this.params={operator:i+t.map(r.formatProp).join(", ")},n.length>0&&(this.params.operator+="\n missing keys: "+n.join(", ")),a.length>0&&(this.params.operator+="\n extra keys: "+a.join(", ")),this.assert(0===n.length&&0===a.length)}),e.alias("keys","key"),e.add("propertyByPath",function(e){arguments.length>1?e=o.call(arguments):1===arguments.length&&r.isString(e)?e=[e]:0===arguments.length&&(e=[]);var n=e.map(r.formatProp);e=e.map(String);for(var a,s=t(Object(this.obj)),i=[];a=e.shift();)this.params={operator:"to have property by path "+n.join(", ")+" - failed on "+r.formatProp(a)},s=s.have.property(a),i.push(a);this.params={obj:this.obj,operator:"to have property by path "+n.join(", ")},this.obj=s.obj})}},{"../util":16,"should-equal":17}],14:[function(t,e){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)})}},{}],15:[function(t,e){var r=t("../util");e.exports=function(t,e){e.add("Number",function(){this.params={operator:"to be a number"},this.assert(r.isNumber(this.obj))},!0),e.add("arguments",function(){this.params={operator:"to be arguments"},this.assert(r.isArguments(this.obj))},!0),e.alias("arguments","Arguments"),e.add("type",function(t,e){this.params={operator:"to have type "+t,message:e},(typeof this.obj).should.be.exactly(t,e)}),e.add("instanceof",function(t,e){this.params={operator:"to be an instance of "+r.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.assert(r.isFunction(this.obj))},!0),e.add("Object",function(){this.params={operator:"to be an object"},this.assert(r.isObject(this.obj))},!0),e.add("String",function(){this.params={operator:"to be a string"},this.assert(r.isString(this.obj))},!0),e.add("Array",function(){this.params={operator:"to be an array"},this.assert(r.isArray(this.obj))},!0),e.add("Boolean",function(){this.params={operator:"to be a boolean"},this.assert(r.isBoolean(this.obj))},!0),e.add("Error",function(){this.params={operator:"to be an error"},this.assert(r.isError(this.obj))},!0),e.add("null",function(){this.params={operator:"to be null"},this.assert(null===this.obj)},!0),e.alias("null","Null")}},{"../util":16}],16:[function(t,e,r){function n(t){return f(t)&&(t.__ArrayLike||Array.isArray(t))}function o(t){return"number"==typeof t}function a(t){return"string"==typeof t}function s(t){return"boolean"==typeof t}function i(t){return"undefined"!=typeof Buffer&&t instanceof Buffer}function u(t){return f(t)&&"[object Date]"===c(t)}function c(t){return Object.prototype.toString.call(t)}function f(t){return"object"==typeof t&&null!==t}function h(t){return f(t)&&"[object RegExp]"===c(t)}function p(t){return null==t}function l(t){return null===t}function m(t){return"[object Arguments]"===c(t)}function b(t){return f(t)&&"[object Error]"===c(t)||t instanceof Error}function g(t){return void 0===t}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},r.isArray=n,r.isNumber=o,r.isBoolean=s,r.isString=a,r.isBuffer=i,r.isDate=u,r.isObject=f,r.isRegExp=h,r.isNullOrUndefined=p,r.isNull=l,r.isArguments=m,r.isFunction=function(t){return"function"==typeof t||t instanceof Function},r.isError=b,r.isUndefined=g;var d=Object.prototype.hasOwnProperty;r.forOwn=function(t,e,r){for(var n in t)d.call(t,n)&&e.call(r,t[n],n)};var y=/^\s*function\s*(\S*)\s*\(/;r.functionName=function(t){if(t.name)return t.name;var e=t.toString().match(y)[1];return e};var j=t("should-format").formatPropertyName;r.formatProp=function(t){return j(String(t))},r.formatEqlResult=function(t,e,n,o){return((t.path.length>0?"at "+t.path.map(r.formatProp).join(" -> "):"")+(t.a===e?"":", A has "+o(t.a))+(t.b===n?"":" and B has "+o(t.b))+(t.showReason?" because "+t.reason:"")).trim()}},{"should-format":19}],17:[function(t,e){function r(t,e,r,n,o,a){var s={result:t};return t||(s.path=e,s.reason=r,s.a=n,s.b=o,s.showReason=a),s}function n(t){for(var e=arguments,r=1,n=e.length;n>r;r++)t=t.replace(/%s/,e[r]);return t}function o(t,e,m,b,g,d){if(d=d||[],m=m||{checkProtoEql:!0},t===e)return r(0!==t||1/t==1/e,d,u.PLUS_0_AND_MINUS_0,t,e);var y,j,E=a(t),v=a(e);if(E!==v)return r(!1,d,n(u.DIFFERENT_TYPES,E,v),t,e);switch(E){case"number":return t!==t?r(e!==e,d,u.NAN_NUMBER,t,e):0===t?r(1/t===1/e,d,u.PLUS_0_AND_MINUS_0,t,e):r(t===e,d,u.EQUALITY,t,e);case"regexp":if(j=t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase)break;return r(!1,d,u.EQUALITY,t,e);case"boolean":case"string":return r(t===e,d,u.EQUALITY,t,e);case"date":if(j=+t===+e)break;return r(!1,d,u.EQUALITY,t,e);case"object-number":case"object-boolean":case"object-string":if(j=t.valueOf()===e.valueOf())break;return r(!1,d,u.WRAPPED_VALUE,t.valueOf(),e.valueOf());case"buffer":if(t.length!==e.length)return r(!1,d.concat(c),u.EQUALITY,t.length,e.length);for(y=t.length;y--;)if(t[y]!==e[y])return r(!1,d.concat([y]),u.EQUALITY,t[y],e[y]);return i;case"error":if(t.name!==e.name)return r(!1,d.concat(f),u.EQUALITY,t.name,e.name);if(t.message!==e.message)return r(!1,d.concat(h),u.EQUALITY,t.message,e.message);break;case"array-buffer":if(t.byteLength!==e.byteLength)return r(!1,d.concat(p),u.EQUALITY,t.byteLength,e.byteLength);for(y=t.byteLength;y--;)if(t[y]!==e[y])return r(!1,d.concat([y]),u.EQUALITY,t[y],e[y]);return i}for(b||(b=[]),g||(g=[]),y=b.length;y--;)if(b[y]==t)return r(g[y]==e,d,u.CIRCULAR_VALUES,t,e);b.push(t),g.push(e);var O,A,x;if(("array"===E||"arguments"===E)&&t.length!==e.length)return r(!1,d.concat(c),u.EQUALITY,t.length,e.length);if("function"===v){var S=t.toString(),N=e.toString();if(S!==N)return r(!1,d,u.FUNCTION_SOURCES,S,N)}for(x in e)if(s.call(e,x)){if(O=s.call(t,x),!O)return r(!1,d,n(u.MISSING_KEY,"A",x),t,e);if(A=o(t[x],e[x],m,b,g,d.concat([x])),!A.result)return A}for(x in t)if(s.call(t,x)&&(O=s.call(e,x),!O))return r(!1,d,n(u.MISSING_KEY,"B",x),t,e);var R=!1,P=!1;return m.checkProtoEql&&(Object.getPrototypeOf?(R=Object.getPrototypeOf(t)===Object.getPrototypeOf(e),P=!0):t.__proto__&&e.__proto__&&(R=t.__proto__===e.__proto__,P=!0),P&&!R)?r(!1,d,u.EQUALITY_PROTOTYPE,t,e,!0):(b.pop(),g.pop(),"function"!==v||(A=o(t.prototype,e.prototype,m,b,g,d.concat(l)),A.result)?i:A)}var a=t("should-type"),s=Object.prototype.hasOwnProperty,i=r(!0),u={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 does not have key %s",CIRCULAR_VALUES:"A has circular reference that was visited not in the same time as B"},c=["length"],f=["name"],h=["message"],p=["byteLength"],l=["prototype"];e.exports=o},{"should-type":18}],18:[function(t,e){var r=Object.prototype.toString,n={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",WRAPPER_NUMBER:"object-number",WRAPPER_BOOLEAN:"object-boolean",WRAPPER_STRING:"object-string",BUFFER:"buffer",HTML_ELEMENT:"html-element",HTML_ELEMENT_TEXT:"html-element-text",DOCUMENT:"document",WINDOW:"window",FILE:"file",FILE_LIST:"file-list",BLOB:"blob",XHR:"xhr"};e.exports=function o(t){var e=typeof t;switch(e){case n.NUMBER:return n.NUMBER;case n.UNDEFINED:return n.UNDEFINED;case n.STRING:return n.STRING;case n.BOOLEAN:return n.BOOLEAN;case n.FUNCTION:return n.FUNCTION;case n.SYMBOL:return n.SYMBOL;case n.OBJECT:if(null===t)return n.NULL;var a=r.call(t);switch(a){case"[object String]":return n.WRAPPER_STRING;case"[object Boolean]":return n.WRAPPER_BOOLEAN;case"[object Number]":return n.WRAPPER_NUMBER;case"[object Array]":return n.ARRAY;case"[object RegExp]":return n.REGEXP;case"[object Error]":return n.ERROR;case"[object Date]":return n.DATE;case"[object Arguments]":return n.ARGUMENTS;case"[object Math]":return n.OBJECT;case"[object JSON]":return n.OBJECT;case"[object ArrayBuffer]":return n.ARRAY_BUFFER;case"[object Int8Array]":return n.TYPED_ARRAY;case"[object Uint8Array]":return n.TYPED_ARRAY;case"[object Uint8ClampedArray]":return n.TYPED_ARRAY;case"[object Int16Array]":return n.TYPED_ARRAY;case"[object Uint16Array]":return n.TYPED_ARRAY;case"[object Int32Array]":return n.TYPED_ARRAY;case"[object Uint32Array]":return n.TYPED_ARRAY;case"[object Float32Array]":return n.TYPED_ARRAY;case"[object Float64Array]":return n.TYPED_ARRAY;case"[object DataView]":return n.DATA_VIEW;case"[object Map]":return n.MAP;case"[object WeakMap]":return n.WEAK_MAP;case"[object Set]":return n.SET;case"[object WeakSet]":return n.WEAK_SET;case"[object Promise]":return n.PROMISE;case"[object Window]":return n.WINDOW;case"[object HTMLDocument]":return n.DOCUMENT;case"[object Blob]":return n.BLOB;case"[object File]":return n.FILE;case"[object FileList]":return n.FILE_LIST;case"[object XMLHttpRequest]":return n.XHR;case"[object Text]":return n.HTML_ELEMENT_TEXT;default:if(typeof Promise===n.FUNCTION&&t instanceof Promise||o(t.then)===n.FUNCTION&&t.then.length>=2)return n.PROMISE;if("undefined"!=typeof Buffer&&t instanceof Buffer)return n.BUFFER;if(/^\[object HTML\w+Element\]$/.test(a))return n.HTML_ELEMENT;if("[object Object]"===a)return n.OBJECT}}},Object.keys(n).forEach(function(t){e.exports[t]=n[t]})},{}],19:[function(t,e){function r(t){return function(e){var r=t(e);return r.sort(),r}}function n(t,e){m.formats[t]=e}function o(t){return" "+t}function a(t,e,r,n){n=n||e.keys(t);var a=0;return e.seen.push(t),n=n.map(function(r){var n=s(t,e,r);return a+=n.length,n}),e.seen.pop(),0===n.length?"{}":a<=e.maxLineLength?"{ "+(r?r+" ":"")+n.join(e.propSep+" ")+" }":"{\n"+(r?r+"\n":"")+n.map(o).join(e.propSep+"\n")+"\n}"}function s(t,e,r){var n;try{n=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]}}catch(o){n={value:o}}var a=m.formatPropertyName(r,e),s=n.get&&n.set?"[Getter/Setter]":n.get?"[Getter]":n.set?"[Setter]":e.seen.indexOf(n.value)>=0?"[Circular]":m(n.value,e);return a+": "+s}function i(t){return 10>t?"0"+t:""+t}function u(t){return 100>t?"0"+i(t):""+t}function c(t){var e=t.getTimezoneOffset(),r=Math.abs(e),n=Math.floor(r/60),o=r-60*n,a="GMT"+(0>e?"+":"-")+i(n)+i(o);return t.toLocaleDateString()+" "+t.toLocaleTimeString()+"."+u(t.getMilliseconds())+" "+a}function f(t){return function(e,r){var n=t(e),o=r.keys(e);return 0==o.length?n:a(e,r,n,o)}}function h(t){if(t.name)return t.name;var e=t.toString().match(b)[1];return e}function p(t,e){return function(r){var n="",o=50,a=r[t];if(a>0){for(var s=0;o>s&&a>s;s++){var u=r[s]||0;n+=" "+i(u.toString(16))}a>o&&(n+=" ... ")}return"["+(r.constructor.name||e)+(n?":"+n:"")+"]"}}var l=t("should-type"),m=function(t,e){e=e||{},"seen"in e||(e.seen=[]),e.keys=r("keys"in e&&e.keys===!1?Object.getOwnPropertyNames:Object.keys),"maxLineLength"in e||(e.maxLineLength=60),"propSep"in e||(e.propSep=",");var n=l(t);return(m.formats[n]||m.formats.object)(t,e)};e.exports=m,m.formats={},["undefined","boolean","null"].forEach(function(t){n(t,String)}),["number","boolean"].forEach(function(t){var e=t.substring(0,1).toUpperCase()+t.substring(1);n("object-"+t,f(function(t){return"["+e+": "+m(t.valueOf())+"]"}))}),n("object-string",function(t,e){var r=t.valueOf(),n="[String: "+m(r)+"]",o=e.keys(t);return o=o.filter(function(t){return!(t.match(/\d+/)&&parseInt(t,10)<r.length)}),0==o.length?n:a(t,e,n,o)}),n("regexp",f(String)),n("number",function(t){return 0===t&&0>1/t?"-0":String(t)}),n("string",function(t){return"'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'"}),n("object",a),n("array",function(t,e){var r=e.keys(t),n=0;e.seen.push(t);var a=r.map(function(r){var o;try{o=Object.getOwnPropertyDescriptor(t,r)||{value:t[r]}}catch(a){o={value:a}}var i;return i=r.match(/\d+/)?m(o.value,e):s(o.value,e,r),n+=i.length,i});return e.seen.pop(),0===a.length?"[]":n<=e.maxLineLength?"[ "+a.join(e.propSep+" ")+" ]":"[\n"+a.map(o).join(e.propSep+"\n")+"\n]"}),m.formatPropertyName=function(t,e){return t.match(/^[a-zA-Z_$][a-zA-Z_$0-9]*$/)?t:m(t,e)},n("date",f(c));var b=/^\s*function\s*(\S*)\s*\(/;n("function",f(function(t){var e=h(t);return"[Function"+(e?": "+e:"")+"]"})),n("error",f(function(t){var e=t.name,r=t.message;return"["+e+(r?": "+r:"")+"]"})),n("buffer",p("length","Buffer")),n("array-buffer",p("byteLength")),n("typed-array",p("byteLength")),n("promise",function(){return"[Promise]"}),n("xhr",function(){return"[XMLHttpRequest]"}),n("html-element",function(t){return t.outerHTML}),n("html-element-text",function(t){return t.nodeValue}),n("document",function(t){return t.documentElement.outerHTML}),n("window",function(){return"[Window]"})},{"should-type":20}],20:[function(t,e,r){arguments[4][18][0].apply(r,arguments)},{dup:18}]},{},[1])(1)}); |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
4
207843
29
4425