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

should

Package Overview
Dependencies
Maintainers
4
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

should - npm Package Compare versions

Comparing version 4.6.5 to 5.0.0

2

bower.json
{
"name": "should",
"main": "should.js",
"version": "4.6.1",
"version": "5.0.0",
"homepage": "https://github.com/shouldjs/should.js",

@@ -6,0 +6,0 @@ "repository": {

@@ -0,1 +1,10 @@

5.0.0 / 2015-02-10
==================
* Remove old .eql implementation
* Refactor nested errors
* Added separate reporting message for false negative results like 10.should.not.equal(10)
* Make error.message lazy fix old perfomance bottlenecks for constructing messages for big objects
* Added .propertyWithDescriptor
4.6.5 / 2015-02-05

@@ -2,0 +11,0 @@ ==================

var util = require('./util');
var format = require('should-format');

@@ -11,15 +12,22 @@ /**

var AssertionError = function AssertionError(options) {
this.name = 'AssertionError';
this.actual = options.actual;
this.expected = options.expected;
this.operator = options.operator;
util.merge(this, options);
this.message = options.message;
if(!options.message) {
Object.defineProperty(this, 'message', {
get: function() {
if(!this._message) {
this._message = this.generateMessage();
this.generatedMessage = true;
}
return this._message;
},
configurable: true,
enumerable: false
}
)
}
var stackStartFunction = options.stackStartFunction;
if(Error.captureStackTrace) {
Error.captureStackTrace(this, stackStartFunction);
}
else {
Error.captureStackTrace(this, this.stackStartFunction);
} else {
// non v8 browsers so we can have a stacktrace

@@ -30,5 +38,5 @@ var err = new Error();

if(stackStartFunction) {
if(this.stackStartFunction) {
// try to strip useless frames
var fn_name = util.functionName(stackStartFunction);
var fn_name = util.functionName(this.stackStartFunction);
var idx = out.indexOf('\n' + fn_name);

@@ -48,5 +56,35 @@ if(idx >= 0) {

var indent = ' ';
function prependIndent(line) {
return indent + line;
}
function indentLines(text) {
return text.split('\n').map(prependIndent).join('\n');
}
// assert.AssertionError instanceof Error
AssertionError.prototype = Object.create(Error.prototype);
AssertionError.prototype = Object.create(Error.prototype, {
name: {
value: 'AssertionError'
},
generateMessage: {
value: function() {
if(!this.operator && this.previous) {
return this.previous.message;
}
var actual = format(this.actual);
var expected = 'expected' in this ? ' ' + format(this.expected) : '';
var details = 'details' in this && this.details ? ' (' + this.details + ')' : '';
var previous = this.previous ? '\n' + indentLines(this.previous.message) : '';
return 'expected ' + actual + (this.negate ? ' not ' : ' ') + this.operator + expected + details + previous;
}
}
});
module.exports = AssertionError;

@@ -12,9 +12,9 @@ var AssertionError = require('./assertion-error');

*/
function Assertion(obj, subAssertion) {
function Assertion(obj) {
this.obj = obj;
this.anyOne = false;
this.negate = false;
this.nestedErrorMessage = null;
this.sub = subAssertion;
this.params = {actual: obj};
}

@@ -46,6 +46,6 @@

if(typeof isGetter == 'undefined') isGetter = false;
isGetter = !!isGetter;
prop[isGetter ? 'get' : 'value'] = function() {
var context = new Assertion(this.obj, true);
var context = new Assertion(this.obj, this, name);
context.anyOne = this.anyOne;

@@ -56,5 +56,2 @@

} catch(e) {
//copy data from sub context to this
this.params = context.params;
//check for fail

@@ -69,6 +66,21 @@ if(e instanceof AssertionError) {

context.params = e.params;
this.nestedErrorMessage = e.params ? context.getMessage(): e.message;
//console.log('catch', name, context.params.operator, e.operator);
//console.log(name, e.actual, context.obj, context.params.actual, this.params.actual);
/*if(e.operator !== context.params.operator) {// it means assertion happen because own context
if(!('obj' in context.params)) {
if(!('actual' in context.params)) {
context.params.actual = context.obj;
}
}
util.merge(e, context.params);
//e.operato
//e.operator = context.params.operator;
}*/
if(context != e.assertion) {
context.params.previous = e;
}
//positive fail
this.fail();
context.negate = false;
context.fail();
}

@@ -78,16 +90,14 @@ // throw if it is another exception

}
//copy data from sub context to this
this.params = context.params;
//negative pass
if(this.negate) {
context.negate = true;
this.nestedErrorMessage = context.getMessage();
this.fail();
context.negate = true;//because .fail will set negate
context.params.details = "false negative fail";
context.fail();
}
//positive pass
if(!this.params.operator) this.params = context.params;//shortcut
this.obj = context.obj;
this.negate = false;
//positive pass
return this.proxied();

@@ -129,11 +139,2 @@ };

var indent = ' ';
function prependIndent(line) {
return indent + line;
}
function indentLines(text) {
return text.split('\n').map(prependIndent).join('\n');
}
Assertion.prototype = {

@@ -168,51 +169,18 @@ constructor: Assertion,

var params = this.normalizedParams();
var params = this.params;
var err;
if(this.sub) {
err = new AssertionError({params: params});
} else {
var msg = this.getMessage();
var generatedMessage = msg === this.params.message;
err = new AssertionError({
message: msg,
actual: params.obj,
expected: params.expected,
stackStartFunction: params.stackStartFunction || this.assert
});
err.showDiff = params.showDiff;
err.operator = params.operator;
err.generatedMessage = generatedMessage;
if('obj' in params && !('actual' in params)) {
params.actual = params.obj;
} else if(!('obj' in params) && !('actual' in params)) {
params.actual = this.obj;
}
throw err;
},
params.stackStartFunction = params.stackStartFunction || this.assert;
params.negate = this.negate;
normalizedParams: function() {
if(!('obj' in this.params)) this.params.obj = this.obj;
this.params.negate = this.negate;
this.params.nestedErrorMessage = this.nestedErrorMessage;
params.assertion = this;
return this.params;
throw new AssertionError(params);
},
generateMessage: function() {
var actual = format(this.params.obj);
var expected = 'expected' in this.params ? ' ' + format(this.params.expected) : '';
var details = 'details' in this.params && this.params.details ? ' (' + this.params.details + ')' : '';
return 'expected ' + actual + (this.params.negate ? ' not ' : ' ') + this.params.operator + expected + details;
},
getMessage: function() {
this.normalizedParams();
var msg = this.params.message || this.generateMessage();
if(this.params.nestedErrorMessage && msg != this.params.nestedErrorMessage) {
msg = msg + '\n' + indentLines(this.params.nestedErrorMessage);
}
return msg;
},
/**

@@ -219,0 +187,0 @@ * Shortcut for `Assertion#assert(false)`.

var config = {
checkProtoEql: false,
useOldDeepEqual: false
checkProtoEql: false
};
module.exports = config;

@@ -214,3 +214,3 @@ // implement assert interface using already written peaces of should.js

if(util.isString(expected)) {
if(typeof expected == 'string') {
message = expected;

@@ -217,0 +217,0 @@ expected = null;

@@ -1,7 +0,1 @@

/*!
* Should
* Copyright(c) 2010-2014 TJ Holowaychuk <tj@vision-media.ca>
* MIT Licensed
*/
module.exports = function(should, Assertion) {

@@ -8,0 +2,0 @@ /**

@@ -7,7 +7,8 @@ /*!

var util = require('../util'),
_eql = require('../eql');
var util = require('../util');
var eql = require('should-equal');
module.exports = function(should, Assertion) {
var i = should.format;
var type = should.type;

@@ -39,20 +40,17 @@ /**

Assertion.add('containEql', function(other) {
var eql = _eql();
this.params = { operator: 'to contain ' + i(other) };
this.params = {operator: 'to contain ' + i(other)};
this.is.not.null.and.not.undefined;
var obj = this.obj;
if(util.isArray(obj)) {
this.assert(obj.some(function(item) {
return eql(item, other).result;
var tpe = should.type(obj);
if(tpe == should.type.STRING) {
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isIndexable(obj)) {
this.assert(util.some(obj, function(v) {
return eql(v, other).result;
}));
} else if(util.isString(obj)) {
// expect obj to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isObject(obj)) {
// object contains object case
util.forOwn(other, function(value, key) {
obj.should.have.property(key, value);
});
} else {
//other uncovered cases
this.assert(false);
this.have.properties(other);
}

@@ -84,25 +82,23 @@ });

Assertion.add('containDeepOrdered', function(other) {
var eql = _eql();
this.params = { operator: 'to contain ' + i(other) };
this.params = {operator: 'to contain ' + i(other)};
var obj = this.obj;
if(util.isArray(obj) && util.isArray(other)) {
var otherIdx = 0;
obj.forEach(function(item) {
if(type(obj) == type.STRING) {// expect other to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isIndexable(obj) && util.isIndexable(other)) {
for(var objIdx = 0, otherIdx = 0, objLength = util.length(obj), otherLength = util.length(other); objIdx < objLength && otherIdx < otherLength; objIdx++) {
try {
should(item).containDeepOrdered(other[otherIdx]);
should(obj[objIdx]).containDeepOrdered(other[otherIdx]);
otherIdx++;
} catch(e) {
if(e instanceof should.AssertionError) {
return;
continue;
}
throw e;
}
}, this);
}
this.assert(otherIdx == other.length);
} else if(util.isString(obj)) {// expect other to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isObject(obj) && util.isObject(other)) {// object contains object case
util.forOwn(other, function(value, key) {
this.assert(otherIdx == otherLength);
} else if(obj != null && other != null && typeof obj == 'object' && typeof other == 'object') {// object contains object case
util.forEach(other, function(value, key) {
should(obj[key]).containDeepOrdered(value);

@@ -133,10 +129,11 @@ });

Assertion.add('containDeep', function(other) {
var eql = _eql();
this.params = { operator: 'to contain ' + i(other) };
this.params = {operator: 'to contain ' + i(other)};
var obj = this.obj;
if(util.isArray(obj) && util.isArray(other)) {
if(typeof obj == 'string') {// expect other to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isIndexable(obj) && util.isIndexable(other)) {
var usedKeys = {};
other.forEach(function(otherItem) {
this.assert(obj.some(function(item, index) {
util.forEach(other, function(otherItem) {
this.assert(util.some(obj, function(item, index) {
if(index in usedKeys) return false;

@@ -156,6 +153,4 @@

}, this);
} else if(util.isString(obj)) {// expect other to be string
this.assert(obj.indexOf(String(other)) >= 0);
} else if(util.isObject(obj) && util.isObject(other)) {// object contains object case
util.forOwn(other, function(value, key) {
} else if(obj != null && other != null && typeof obj == 'object' && typeof other == 'object') {// object contains object case
util.forEach(other, function(value, key) {
should(obj[key]).containDeep(value);

@@ -162,0 +157,0 @@ });

@@ -7,9 +7,12 @@ /*!

var _eql = require('../eql');
var config = require('../config');
var eql = require('should-equal');
var type = require('should-type');
var util = require('../util');
var type = require('should-type');
function formatEqlResult(r, a, b, format) {
return ((r.path.length > 0 ? 'at ' + r.path.map(util.formatProp).join(' -> ') : '') +
(r.a === a ? '' : ', A has ' + format(r.a)) +
(r.b === b ? '' : ' and B has ' + format(r.b)) +
(r.showReason ? ' because ' + r.reason: '')).trim();
}

@@ -38,16 +41,10 @@ module.exports = function(should, Assertion) {

Assertion.add('eql', function(val, description) {
var eql = _eql();
this.params = {operator: 'to equal', expected: val, message: description};
var strictResult = eql(this.obj, val, should.config);
this.params.details = strictResult.result ? '': formatEqlResult(strictResult, this.obj, val, should.format);
var result = config.useOldDeepEqual ? strictResult: strictResult.result;
if(!config.useOldDeepEqual && !strictResult.result) {
this.params.details = util.formatEqlResult(strictResult, this.obj, val, should.format);
}
this.params.showDiff = type(this.obj) == type(val);
this.assert(result);
this.assert(strictResult.result);
});

@@ -54,0 +51,0 @@

@@ -57,3 +57,3 @@ /*!

errorMatched = err instanceof message;
} else if(util.isObject(message)) {
} else if(null != message) {
try {

@@ -60,0 +60,0 @@ err.should.match(message);

@@ -7,4 +7,4 @@ /*!

var util = require('../util'),
_eql = require('../eql');
var util = require('../util');
var eql = require('should-equal');

@@ -54,20 +54,18 @@ module.exports = function(should, Assertion) {

Assertion.add('match', function(other, description) {
var eql = _eql();
this.params = {operator: 'to match ' + i(other), message: description};
if(!eql(this.obj, other).result) {
if(util.isRegExp(other)) { // something - regex
if(other instanceof RegExp) { // something - regex
if(util.isString(this.obj)) {
if(typeof this.obj == 'string') {
this.assert(other.exec(this.obj));
} else if(util.isArray(this.obj)) {
this.obj.forEach(function(item) {
} else if(util.isIndexable(this.obj)) {
util.forEach(this.obj, function(item) {
this.assert(other.exec(item));// should we try to convert to String and exec?
}, this);
} else if(util.isObject(this.obj)) {
} else if(null != this.obj && typeof this.obj == 'object') {
var notMatchedProps = [], matchedProps = [];
util.forOwn(this.obj, function(value, name) {
util.forEach(this.obj, function(value, name) {
if(other.exec(value)) matchedProps.push(util.formatProp(name));

@@ -84,3 +82,3 @@ else notMatchedProps.push(util.formatProp(name) + ' (' + i(value) + ')');

} // should we try to convert to String and exec?
} else if(util.isFunction(other)) {
} else if(typeof other == 'function') {
var res;

@@ -90,15 +88,15 @@

if(res instanceof Assertion) {
this.params.operator += '\n ' + res.getMessage();
}
//if(res instanceof Assertion) {
// this.params.operator += '\n ' + res.getMessage();
//}
//if we throw exception ok - it is used .should inside
if(util.isBoolean(res)) {
if(typeof res == 'boolean') {
this.assert(res); // if it is just boolean function assert on it
}
} else if(util.isObject(other)) { // try to match properties (for Object and Array)
} else if(other != null && typeof other == 'object') { // try to match properties (for Object and Array)
notMatchedProps = [];
matchedProps = [];
util.forOwn(other, function(value, key) {
util.forEach(other, function(value, key) {
try {

@@ -149,3 +147,2 @@ should(this.obj[key]).match(value);

Assertion.add('matchEach', function(other, description) {
var eql = _eql();
this.params = {operator: 'to match each ' + i(other), message: description};

@@ -155,7 +152,7 @@

if(util.isRegExp(other))
if(other instanceof RegExp)
f = function(it) {
return !!other.exec(it);
};
else if(!util.isFunction(other))
else if(typeof other != 'function')
f = function(it) {

@@ -165,7 +162,7 @@ return eql(it, other).result;

util.forOwn(this.obj, function(value, key) {
util.forEach(this.obj, function(value, key) {
var res = f(value, key);
//if we throw exception ok - it is used .should inside
if(util.isBoolean(res)) {
if(typeof res == 'boolean') {
this.assert(res); // if it is just boolean function assert on it

@@ -172,0 +169,0 @@ }

@@ -39,3 +39,3 @@ /*!

this.obj.should.be.a.Number
this.is.a.Number
.and.not.a.NaN

@@ -42,0 +42,0 @@ .and.assert(!isFinite(this.obj));

@@ -7,4 +7,4 @@ /*!

var util = require('../util'),
_eql = require('../eql');
var util = require('../util');
var eql = require('should-equal');

@@ -15,5 +15,43 @@ var aSlice = Array.prototype.slice;

var i = should.format;
/**
* Asserts given object has some descriptor. **On success it change given object to be value of property**.
*
* @name propertyWithDescriptor
* @memberOf Assertion
* @category assertion property
* @param {string} name Name of property
* @param {Object} desc Descriptor like used in Object.defineProperty (not required to add all properties)
* @example
*
* ({ a: 10 }).should.have.propertyWithDescriptor('a', { enumerable: true });
*/
Assertion.add('propertyWithDescriptor', function(name, desc) {
this.params = {actual: this.obj, operator: 'to have own property with descriptor ' + i(desc)};
var obj = this.obj;
this.have.ownProperty(name);
should(Object.getOwnPropertyDescriptor(Object(obj), name)).have.properties(desc);
});
function processPropsArgs() {
var args = {};
if(arguments.length > 1) {
args.names = aSlice.call(arguments);
} else {
var arg = arguments[0];
var t = should.type(arg);
if(t == should.type.STRING) {
args.names = [arg];
} else if(util.isIndexable(arg)) {
args.names = arg;
} else {
args.names = Object.keys(arg);
args.values = arg;
}
}
return args;
}
/**
* Asserts given object has enumerable property with optionally value
* Asserts given object has enumerable property with optionally value. **On success it change given object to be value of property**.
*

@@ -32,14 +70,9 @@ * @name enumerable

var eql = _eql();
this.params = {
operator: "to have enumerable property " + util.formatProp(name)
operator: "to have enumerable property " + util.formatProp(name) + (arguments.length > 1 ? " equal to " + i(val): "")
};
this.assert(this.obj.propertyIsEnumerable(name));
if(arguments.length > 1) {
this.params.operator += " equal to " + i(val);
this.assert(eql(val, this.obj[name]).result);
}
var desc = { enumerable: true };
if(arguments.length > 1) desc.value = val;
this.have.propertyWithDescriptor(name, desc);
});

@@ -59,20 +92,12 @@

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);
}
}
var args = processPropsArgs.apply(null, arguments);
this.params = {
operator: "to have enumerables " + names.map(util.formatProp)
operator: "to have enumerables " + args.names.map(util.formatProp)
};
names.forEach(function(name) {
this.assert(this.obj.propertyIsEnumerable(name));
}, this);
var obj = this.obj;
args.names.forEach(function(name) {
obj.should.have.enumerable(name);
});
});

@@ -117,7 +142,6 @@

var values = {};
var eql = _eql();
if(arguments.length > 1) {
names = aSlice.call(arguments);
} else if(!util.isArray(names)) {
if(util.isString(names)) {
} else if(!Array.isArray(names)) {
if(typeof names == 'string') {
names = [names];

@@ -223,3 +247,3 @@ } else {

this.params = {
obj: this.obj,
actual: this.obj,
operator: 'to have own property ' + util.formatProp(name),

@@ -251,3 +275,3 @@ message: description

if(util.isString(this.obj) || util.isArray(this.obj) || util.isArguments(this.obj)) {
if(util.length(this.obj) !== void 0) {
this.obj.should.have.property('length', 0);

@@ -277,3 +301,3 @@ } else {

if(arguments.length > 1) keys = aSlice.call(arguments);
else if(arguments.length === 1 && util.isString(keys)) keys = [keys];
else if(arguments.length === 1 && should.type(keys) == should.type.STRING) keys = [keys];
else if(arguments.length === 0) keys = [];

@@ -280,0 +304,0 @@

@@ -17,5 +17,5 @@ /*!

Assertion.add('Number', function() {
this.params = { operator: 'to be a number' };
this.params = {operator: 'to be a number'};
this.assert(util.isNumber(this.obj));
this.have.type('number');
}, true);

@@ -31,5 +31,5 @@

Assertion.add('arguments', function() {
this.params = { operator: 'to be arguments' };
this.params = {operator: 'to be arguments'};
this.assert(util.isArguments(this.obj));
this.have.class('Arguments');
}, true);

@@ -48,5 +48,5 @@

Assertion.add('type', function(type, description) {
this.params = { operator: 'to have type ' + type, message: description };
this.params = {operator: 'to have type ' + type, message: description};
(typeof this.obj).should.be.exactly(type, description);
should(typeof this.obj).be.exactly(type);
});

@@ -64,3 +64,3 @@

Assertion.add('instanceof', function(constructor, description) {
this.params = { operator: 'to be an instance of ' + util.functionName(constructor), message: description };
this.params = {operator: 'to be an instance of ' + util.functionName(constructor), message: description};

@@ -79,5 +79,5 @@ this.assert(Object(this.obj) instanceof constructor);

Assertion.add('Function', function() {
this.params = { operator: 'to be a function' };
this.params = {operator: 'to be a function'};
this.assert(util.isFunction(this.obj));
this.have.type('function');
}, true);

@@ -92,5 +92,5 @@

Assertion.add('Object', function() {
this.params = { operator: 'to be an object' };
this.params = {operator: 'to be an object'};
this.assert(util.isObject(this.obj));
this.is.not.null.and.have.type('object');
}, true);

@@ -105,5 +105,5 @@

Assertion.add('String', function() {
this.params = { operator: 'to be a string' };
this.params = {operator: 'to be a string'};
this.assert(util.isString(this.obj));
this.have.type('string');
}, true);

@@ -118,5 +118,5 @@

Assertion.add('Array', function() {
this.params = { operator: 'to be an array' };
this.params = {operator: 'to be an array'};
this.assert(util.isArray(this.obj));
this.have.class('Array');
}, true);

@@ -131,5 +131,5 @@

Assertion.add('Boolean', function() {
this.params = { operator: 'to be a boolean' };
this.params = {operator: 'to be a boolean'};
this.assert(util.isBoolean(this.obj));
this.have.type('boolean');
}, true);

@@ -144,5 +144,5 @@

Assertion.add('Error', function() {
this.params = { operator: 'to be an error' };
this.params = {operator: 'to be an error'};
this.assert(util.isError(this.obj));
this.have.instanceOf(Error);
}, true);

@@ -158,3 +158,3 @@

Assertion.add('null', function() {
this.params = { operator: 'to be null' };
this.params = {operator: 'to be null'};

@@ -166,3 +166,31 @@ this.assert(this.obj === null);

/**
* Assert given object has some internal [[Class]], via Object.prototype.toString call
* @name class
* @alias Assertion#Class
* @memberOf Assertion
* @category assertion types
*/
Assertion.add('class', function(cls) {
this.params = {operator: 'to have [[Class]] ' + cls};
this.assert(Object.prototype.toString.call(this.obj) === '[object ' + cls + ']');
});
Assertion.alias('class', 'Class');
/**
* Assert given object is undefined
* @name undefined
* @alias Assertion#Undefined
* @memberOf Assertion
* @category assertion types
*/
Assertion.add('undefined', function() {
this.params = {operator: 'to be undefined'};
this.assert(this.obj === void 0);
}, true);
Assertion.alias('undefined', 'Undefined');
};

@@ -9,3 +9,2 @@ /*!

var util = require('./util');
var inspect = require('should-format');

@@ -29,3 +28,4 @@ /**

should.format = inspect;
should.format = require('should-format');
should.type = require('should-type');

@@ -144,3 +144,3 @@ /**

should.use = function(f) {
f(this, this.Assertion);
f(should, should.Assertion);
return this;

@@ -147,0 +147,0 @@ };

@@ -7,2 +7,4 @@ /*!

var type = require('should-type');
/**

@@ -18,17 +20,2 @@ * Check if given obj just a primitive type wrapper

/**
* Merge object b with object a.
*
* var a = { foo: 'bar' }
* , b = { bar: 'baz' };
*
* utils.merge(a, b);
* // => { foo: 'bar', bar: 'baz' }
*
* @param {Object} a
* @param {Object} b
* @return {Object}
* @private
*/
exports.merge = function(a, b) {

@@ -43,91 +30,9 @@ if(a && b) {

function isArray(arr) {
return isObject(arr) && (arr.__ArrayLike || Array.isArray(arr));
}
exports.isArray = isArray;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
exports.isString = isString;
function isBuffer(arg) {
return typeof Buffer !== 'undefined' && arg instanceof Buffer;
}
exports.isBuffer = isBuffer;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isArguments(object) {
return objectToString(object) === '[object Arguments]';
}
exports.isArguments = isArguments;
exports.isFunction = function(arg) {
return typeof arg === 'function' || arg instanceof Function;
};
function isError(e) {
return (isObject(e) && objectToString(e) === '[object Error]') || (e instanceof Error);
}
exports.isError = isError;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
var hasOwnProperty = Object.prototype.hasOwnProperty;
exports.forOwn = function(obj, f, context) {
exports.forEach = function(obj, f, context) {
for(var prop in obj) {
if(hasOwnProperty.call(obj, prop)) {
f.call(context, obj[prop], prop);
if(f.call(context, obj[prop], prop, obj) === false)
return;
}

@@ -137,2 +42,13 @@ }

exports.some = function(obj, f, context) {
var res = false;
exports.forEach(obj, function(value, key) {
if(f.call(context, value, key, obj)) {
res = true;
return false;
}
}, context);
return res;
};
var functionNameRE = /^\s*function\s*(\S*)\s*\(/;

@@ -154,8 +70,2 @@

exports.formatEqlResult = function(r, a, b, format) {
return ((r.path.length > 0 ? 'at ' + r.path.map(exports.formatProp).join(' -> ') : '') +
(r.a === a ? '' : ', A has ' + format(r.a)) +
(r.b === b ? '' : ' and B has ' + format(r.b)) +
(r.showReason ? ' because ' + r.reason: '')).trim();
};

@@ -169,2 +79,29 @@ exports.isEmptyObject = function(obj) {

return true;
};
};
exports.isIndexable = function(obj) {
var t = type(obj);
return t == type.ARRAY ||
t == type.BUFFER ||
t == type.ARGUMENTS ||
t == type.ARRAY_BUFFER ||
t == type.TYPED_ARRAY ||
t == type.DATA_VIEW ||
t == type.STRING;
}
exports.length = function(obj) {
switch(type(obj)) {
case type.ARRAY_BUFFER:
case type.TYPED_ARRAY:
case type.DATA_VIEW:
return obj.byteLength;
case type.ARRAY:
case type.BUFFER:
case type.ARGUMENTS:
case type.FUNCTION:
case type.STRING:
return obj.length;
}
}
{
"name": "should",
"description": "test framework agnostic BDD-style assertions",
"version": "4.6.5",
"version": "5.0.0",
"author": "TJ Holowaychuk <tj@vision-media.ca> and contributors",

@@ -12,3 +12,3 @@ "repository": {

"scripts": {
"test": "mocha -R mocha-better-spec-reporter ./test/**/*.test.js ./test/*.test.js",
"test": "mocha -R mocha-better-spec-reporter --check-leaks ./test/*.test.js ./test/**/*.test.js",
"zuul": "zuul -- ./test/**/*.test.js ./test/*.test.js",

@@ -15,0 +15,0 @@ "browser": "gulp script"

@@ -9,12 +9,8 @@ # should.js

_should_ extends the `Object.prototype` with a single non-enumerable getter that allows you to express how that object should behave. It also returns itself when required with `require`.
_should_ extends the `Object.prototype` with a single non-enumerable getter that allows you to express how that object should behave. It also returns itself when required with `require`. It does not mean that you should use it like getter - it is possible to use it as function call. For this use `.noConflict` function.
### Breaking changes for 4.x
### Upgrading instractions
Please check [wiki](https://github.com/shouldjs/should.js/wiki/Breaking-changes-4.x).
Please check [wiki page](https://github.com/shouldjs/should.js/wiki/Breaking-changes) for upgrading instructions.
### .eql implementation in 4.x
In 4.x `.eql` implementation was changed to fix old bug in deepEqual from node's `assert` module. To do not allow to assume that `10` is equal to `'10'`. You can still use old .eql implementation via `should.config` flags.
## Example

@@ -125,530 +121,2 @@ ```javascript

## .ok
Assert that a chained object is truthy in javascript (ie: not '', null, undefined, 0 , NaN).
Assert truthfulness:
```javascript
true.should.be.ok;
'yay'.should.be.ok;
(1).should.be.ok;
({}).should.be.ok;
```
or negated:
```javascript
false.should.not.be.ok;
''.should.not.be.ok;
(0).should.not.be.ok;
```
*Warning:* No assertions can be performed on null and undefined values.
e.g.
```js
undefined.should.not.be.ok;
```
will give you `Uncaught TypeError: Cannot read property 'should' of undefined)`.
In order to test for null use
```js
(err === null).should.be.true;
```
## .true
Assert if a chained object === true:
```javascript
true.should.be.true;
'1'.should.not.be.true;
```
## .false
Assert if a chained object === false:
```javascript
false.should.be.false;
(0).should.not.be.false;
```
## .eql(otherValue)
Asserts if a chained object is *equal* to otherValue. The object is compared by its actual content, not just reference equality.
```javascript
({ foo: 'bar' }).should.eql({ foo: 'bar' });
[1,2,3].should.eql([1,2,3]);
// see next example it is correct, even if it is different types, but actual content the same
[1, 2, 3].should.eql({ '0': 1, '1': 2, '2': 3 });
```
By default for now `.eql` does not check object prototypes, so such test will pass:
```js
var b = {a: 2};
var a = Object.create(null);
a.a = 2;
b.should.be.eql(a);
```
If you do not want such behaviour you can do:
```js
should.config.checkProtoEql = true;
```
somewhere at the beginning of tests (or in tests where you need to test prototypes) and test upper will fail.
## .equal(otherValue) and .exactly(otherValue)
Asserts if a chained object is strictly equal to `otherValue` (using `===`). It means primitive values compared as is (there is no any type conversion) and reference values compared by references.
```javascript
(4).should.equal(4);
'test'.should.equal('test');
[1,2,3].should.not.equal([1,2,3]);
(4).should.be.exactly(4);
```
## .startWith(str)
Assert that a string starts with `str`.
```javascript
'foobar'.should.startWith('foo');
'foobar'.should.not.startWith('bar');
```
## .endWith(str)
Assert that a string ends with `str`.
```javascript
'foobar'.should.endWith('bar');
'foobar'.should.not.endWith('foo');
```
## .within(from, to)
Assert inclusive numeric range (`<= to` and `>= from`):
```javascript
user.age.should.be.within(5, 50);
(5).should.be.within(5, 10).and.within(5, 5);
```
## .approximately(num, delta)
Assert a floating point number is near `num` within the `delta` margin:
```javascript
(99.99).should.be.approximately(100, 0.1);
```
## .above(num) and .greaterThan(num)
Assert a numeric value is above the given value (`> num`):
```javascript
user.age.should.be.above(5);
user.age.should.not.be.above(100);
(5).should.be.above(0);
(5).should.not.be.above(5);
```
## .below(num) and .lessThan(num)
Assert a numeric value is below the given value (`< num`):
```javascript
user.age.should.be.below(100);
user.age.should.not.be.below(5);
(5).should.be.below(6);
(5).should.not.be.below(5);
```
## .NaN
Assert a numeric value is NaN:
```javascript
(undefined + 0).should.be.NaN;
```
## .Infinity
Assert a numeric value is Infinity:
```javascript
(1/0).should.be.Infinity;
```
## .type(str)
Assert a given object is of a particular type (using __typeof__ operator):
```javascript
user.should.be.type('object');
'test'.should.be.type('string');
```
## .instanceof(constructor) and .instanceOf(constructor)
Assert a given object is an instance of `constructor` (using __instanceof__ operator):
```javascript
user.should.be.an.instanceof(User);
[].should.be.an.instanceOf(Array);
```
## .arguments
Assert a given object is an `Arguments`:
```javascript
var args = (function(){ return arguments; })(1,2,3);
args.should.be.arguments;
[].should.not.be.arguments;
```
## .Object, .Number, .Array, .Boolean, .Function, .String, .Error
Assert a given object is instance of the given constructor (shortcut for `.instanceof` assertion).
```javascript
({}).should.be.an.Object;
(1).should.be.a.Number;
[].should.be.an.Array.and.an.Object;
(true).should.be.a.Boolean;
''.should.be.a.String;
```
## .enumerable(name[, value])
Assert a property exists, is enumerable, and has an optional value (compare using `.eql`):
```javascript
'asd'.should.not.have.enumerable('0');
user.should.have.enumerable('name');
user.should.have.enumerable('age', 15);
user.should.not.have.enumerable('rawr');
user.should.not.have.enumerable('age', 0);
[1, 2].should.have.enumerable('0', 1);
```
## .property(name[, value])
Assert property exists and has an optional value (compare using `.eql`):
```javascript
user.should.have.property('name');
user.should.have.property('age', 15);
user.should.not.have.property('rawr');
user.should.not.have.property('age', 0);
[1, 2].should.have.property('0', 1);
```
__NB__ `.property` changes the chain's object to the given property's value, so be careful when chaining after `.property`!
## .properties(propName1, propName2, ...) or .properties([propName1, propName2, ...]) or .properties(obj)
`obj` should be an object that maps properties to their actual values.
Assert all given properties exist and have given values (compare using `.eql`):
```javascript
user.should.have.properties('name', 'age');
user.should.have.properties(['name', 'age']);
user.should.have.properties({
name: 'denis',
age: 24
});
```
## .length(number) and .lengthOf(number)
Assert _length_ property exists and has a value of the given number (shortcut for `.property('length', number)`):
```javascript
user.pets.should.have.length(5);
user.pets.should.have.a.lengthOf(5);
({ length: 10}).should.have.length(10);
```
__NB__ `.length` and `.lengthOf` change the chain's object to the given length value, so be careful when chaining!
## .ownProperty(str) and .hasOwnProperty(str)
Assert given object has own property (using `.hasOwnProperty`):
```javascript
({ foo: 'bar' }).should.have.ownProperty('foo').equal('bar');
```
__NB__ `.ownProperty` and `.hasOwnProperty` change the chain's object to the given property value, so be careful when chaining!
## .empty
Assert given value is empty. Strings, arrays, arguments with a length of 0, and objects without their own properties, are considered empty.
```javascript
[].should.be.empty;
''.should.be.empty;
({}).should.be.empty;
(function() {
arguments.should.be.empty;
})();
```
## .keys([key1, key2, ...]) and .keys(key1, key2, ...) and .key(key)
Assert own object keys, which must match _exactly_,
and will fail if you omit a key or two:
```javascript
var obj = { foo: 'bar', baz: 'raz' };
obj.should.have.keys('foo', 'baz');
obj.should.have.keys(['foo', 'baz']);
({}).should.have.keys();
({}).should.have.keys('key'); //fail AssertionError: expected {} to have key 'key'missing keys: 'key'
```
## .propertyByPath([name1, ...]) or .propertyByPath(name1, name2, ...)
Assert property exists and has optional value (compare using `.eql`):
```javascript
var obj = { foo: 'bar', baz: 'raz', zad: { a: 10 } };
obj.should.have.propertyByPath('zad', 'a');
obj.should.not.have.propertyByPath(0, 1, 2);
```
__NB__ `.propertyByPath` changes the chain's object to the given property's value if found
## .containEql(otherValue)
Assert given value to contain something *.eql* to otherValue. See examples to understand better:
```javascript
'hello boy'.should.containEql('boy');
[1,2,3].should.containEql(3);
[[1],[2],[3]].should.containEql([3]);
[[1],[2],[3, 4]].should.not.containEql([3]);
({ b: 10 }).should.containEql({ b: 10 });
([1, 2, { a: 10 }]).should.containEql({ a: 10 });
[1, 2, 3].should.not.containEql({ a: 1 });
[{a: 'a'}, {b: 'b', c: 'c'}].should.containEql({a: 'a'});
[{a: 'a'}, {b: 'b', c: 'c'}].should.not.containEql({b: 'b'});
```
When `.containEql` check arrays it check elements to be in the same order in `otherValue` and object just to be presented.
## .containDeep(otherValue)
Assert given value to contain something *.eql* to otherValue within depth.
Again see examples:
```javascript
'hello boy'.should.containDeep('boy');
[1,2,3].should.containDeep([3]);
[1,2,3].should.containDeep([1, 3]);
//but not
[1,2,3].should.containDeep([3, 1]);
({ a: { b: 10 }, b: { c: 10, d: 11, a: { b: 10, c: 11} }}).should
.containDeep({ a: { b: 10 }, b: { c: 10, a: { c: 11 }}});
[1, 2, 3, { a: { b: { d: 12 }}}].should.containDeep([{ a: { b: {d: 12}}}]);
[[1],[2],[3]].should.containDeep([[3]]);
[[1],[2],[3, 4]].should.containDeep([[3]]);
[{a: 'a'}, {b: 'b', c: 'c'}].should.containDeep([{a: 'a'}]);
[{a: 'a'}, {b: 'b', c: 'c'}].should.containDeep([{b: 'b'}]);
```
It does not search somewhere in depth it check all pattern in depth. Objects are checked
by properties key and value; arrays are checked like sub sequences. Everyting is compared using `.eql`.
Main difference with `.containEql` is that this assertion requires full type chain -
if asserted value is an object, otherValue should be also an object (which is sub object of given).
The same is true for arrays, otherValue should be an array which compared to be subsequence of given object.
Also exists assertion `.containDeepOrdered` which check arrays in the same order.
## .match(otherValue)
Assert given object matches `otherValue`.
Given: String, otherValue: regexp. Uses `RegExp#exec(str)`:
```javascript
username.should.match(/^\w+$/)
```
Given: Array, otherValue: regexp - assert each value match to regexp.
```javascript
['a', 'b', 'c'].should.match(/[a-z]/);
['a', 'b', 'c'].should.not.match(/[d-z]/);
```
Given: Object, otherValue: regexp - assert own property's values to match regexp.
```javascript
({ a: 'foo', c: 'barfoo' }).should.match(/foo$/);
({ a: 'a' }).should.not.match(/^http/);
```
Given: Anything, otherValue: function - assert if given value matched to function.
Function can use `.should` inside or return 'true' or 'false', in all other cases it do nothing. If you return value that return assertion, you will receive better error messages.
```javascript
(5).should.match(function(n) { return n > 0; });
(5).should.not.match(function(n) { return n < 0; });
(5).should.not.match(function(it) { it.should.be.an.Array; });
(5).should.match(function(it) { return it.should.be.a.Number; });
```
Now compare messages:
```javascript
(5).should.not.match(function(it) { it.should.be.a.Number; });
//AssertionError: expected 5 not to match [Function]
(5).should.not.match(function(it) { return it.should.be.a.Number; });
//AssertionError: expected 5 not to match [Function]
// expected 5 to be a number
```
Given: object, otherValue: another object - assert that object properties match to properties of another object in meaning that describe above cases. See examples:
```javascript
({ a: 10, b: 'abc', c: { d: 10 }, d: 0 }).should
.match({ a: 10, b: /c$/, c: function(it) { return it.should.have.property('d', 10); }});
[10, 'abc', { d: 10 }, 0].should
.match({ '0': 10, '1': /c$/, '2': function(it) { return it.should.have.property('d', 10); } });
[10, 'abc', { d: 10 }, 0].should
.match([10, /c$/, function(it) { return it.should.have.property('d', 10); }]);
```
## .matchEach(otherValue)
Assert given property keys and values each match given check object.
If `otherValue` is RegExp, then each property value checked to match it:
```javascript
(['a', 'b', 'c']).should.matchEach(/[a-c]/);
```
If `otherValue` is Function, then check each property value and key matched it:
```javascript
[10, 11, 12].should.matchEach(function(it) { return it >= 10; });
[10, 11, 12].should.matchEach(function(it) { return it >= 10; });
```
In other cases it checks that each property value is `.eql` to `otherValue`:
```javascript
[10, 10].should.matchEach(10);
```
## .throw() and throwError()
Assert an exception is thrown:
```js
(function(){
throw new Error('fail');
}).should.throw();
```
Assert an exception is not thrown:
```js
(function(){
}).should.not.throw();
```
Assert exception message matches string:
```js
(function(){
throw new Error('fail');
}).should.throw('fail');
```
Assert error message matches regexp:
```js
(function(){
throw new Error('failed to foo');
}).should.throw(/^fail/);
```
Error properties to match some other properties (used `.match`):
```js
var error = new Error();
error.a = 10;
(function(){ throw error; }).should.throw({ a: 10 });
(function(){ throw error; }).should.throw(Error, { a: 10 });
```
If you need to pass arguments and/or context to execute function use `Function#bind(context, arg1, ...)`:
```js
function isPositive(n) {
if(n <= 0) throw new Error('Given number is not positive')
}
isPositive.bind(null, 10).should.not.throw();
isPositive.bind(null, -10).should.throw();
```
If you need to check something in an asynchronous function, you must do it in 2 steps:
```js
// first we need to check that function is called
var called = false;
collection.findOne({ _id: 10 }, function(err, res) {
called = true;
//second we test what you want
res.should.be....
});
called.should.be.true;
```
In case you are using something like `Mocha`, you should use an asynchronous test, and call `done()` in the proper place to make sure that your asynchronous function is called before the test finishes.
```js
collection.findOne({ _id: 10 }, function(err, res) {
if(err) return done(err);
//second we test what you want
res.should.be....
done();
});
```
In general, if you need to check that something is executed, you are best using `spies`. A good example is [sinon](http://sinonjs.org/).
## Optional Error description
As it can often be difficult to ascertain exactly where failed assertions are coming from in your tests, an optional description parameter can be passed to several should matchers. The description will follow the failed assertion in the error:
(1).should.eql(0, 'some useful description')
AssertionError: some useful description
at Object.eql (/Users/swift/code/should.js/node_modules/should/lib/should.js:280:10)
...
The methods that support this optional description are: `eql`, `equal`, `within`, `instanceof`, `above`, `below`, `match`, `length`, `ownProperty`.
## Mocha example
For example you can use should with the [Mocha test framework](http://visionmedia.github.io/mocha/) by simply including it:
```javascript
var should = require('should');
var mylib = require('mylib');
describe('mylib', function() {
it('should have a version with the format #.#.#', function() {
mylib.version.should.match(/^\d+\.\d+\.\d+$/);
});
});
```
## Adding own assertions

@@ -669,3 +137,3 @@

- `operator` - it is string which describe your assertion
- `obj` it is actual value, you can assume it is your own this.obj if you need to define you own
- `actual` it is actual value, you can assume it is your own this.obj if you need to define you own
- `expected` it is any value that expected to be matched this.obj

@@ -732,4 +200,6 @@

Also it is possible use it without extension.
## License
MIT &copy; 2010-2014 TJ Holowaychuk
/*
* should - test framework agnostic BDD-style assertions
* @version v4.6.5
* @version v5.0.0
* @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).proxied()};a.AssertionError=t("./assertion-error"),a.Assertion=t("./assertion"),a.format=o,a.config=t("./config"),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}},a.noConflict=function(t){return t=t||u,t&&(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"));var s=Object.prototype,i="should",u=a.extend(i,s)},{"./assertion":3,"./assertion-error":2,"./config":4,"./ext/assert":7,"./ext/bool":8,"./ext/chain":9,"./ext/contain":10,"./ext/eql":11,"./ext/error":12,"./ext/match":13,"./ext/number":14,"./ext/property":15,"./ext/string":16,"./ext/type":17,"./util":19,"should-format":21}],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":19}],3:[function(t,e){function r(t,e){this.obj=t,this.anyOne=!1,this.negate=!1,this.nestedErrorMessage=null,this.sub=e}function n(t){return u+t}function o(t){return t.split("\n").map(n).join("\n")}var a=t("./assertion-error"),s=t("./util"),i=t("should-format");r.add=function(t,e,n){var o={enumerable:!0,configurable:!0};"undefined"==typeof n&&(n=!1),o[n?"get":"value"]=function(){var t=new r(this.obj,!0);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.proxied();t.params=n.params,this.nestedErrorMessage=n.params?t.getMessage():n.message,this.fail()}throw n}return this.params=t.params,this.negate&&(t.negate=!0,this.nestedErrorMessage=t.getMessage(),this.fail()),this.obj=t.obj,this.negate=!1,this.proxied()},Object.defineProperty(r.prototype,t,o)},r.addChain=function(t,e){e=e||function(){},Object.defineProperty(r.prototype,t,{get:function(){return e(),this.proxied()},enumerable:!0})},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 u=" ";r.prototype={constructor:r,assert:function(t){if(t)return this.proxied();var e,r=this.normalizedParams();if(this.sub)e=new a({params:r});else{var n=this.getMessage(),o=n===this.params.message;e=new a({message:n,actual:r.obj,expected:r.expected,stackStartFunction:r.stackStartFunction||this.assert}),e.showDiff=r.showDiff,e.operator=r.operator,e.generatedMessage=o}throw e},normalizedParams:function(){return"obj"in this.params||(this.params.obj=this.obj),this.params.negate=this.negate,this.params.nestedErrorMessage=this.nestedErrorMessage,this.params},generateMessage:function(){var t=i(this.params.obj),e="expected"in this.params?" "+i(this.params.expected):"",r="details"in this.params&&this.params.details?" ("+this.params.details+")":"";return"expected "+t+(this.params.negate?" not ":" ")+this.params.operator+e+r},getMessage:function(){this.normalizedParams();var t=this.params.message||this.generateMessage();return this.params.nestedErrorMessage&&t!=this.params.nestedErrorMessage&&(t=t+"\n"+o(this.params.nestedErrorMessage)),t},fail:function(){return this.assert(!1)},get not(){return this.negate=!this.negate,this.proxied()},get any(){return this.anyOne=!0,this.proxied()},proxied:function(){return"function"==typeof Proxy?new Proxy(this,{get:function(t,e){if(e in t)return t[e];throw new Error("Assertion has no property "+s.formatProp(e))}}):this}},e.exports=r},{"./assertion-error":2,"./util":19,"should-format":21}],4:[function(t,e){var r={checkProtoEql:!1,useOldDeepEqual:!1};e.exports=r},{}],5:[function(t,e){var r=t("./config"),n=t("./node-equal"),o=t("should-equal");e.exports=function(){return r.useOldDeepEqual?n:o}},{"./config":4,"./node-equal":18,"should-equal":20}],6:[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":19,"should-equal":20}],7:[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":19,"./_assert":6}],8:[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)}},{}],9:[function(t,e){e.exports=function(t,e){["an","of","a","and","be","have","with","is","which","the"].forEach(function(t){e.addChain(t)})}},{}],10:[function(t,e){var r=t("../util"),n=t("../eql");e.exports=function(t,e){var o=t.format;e.add("containEql",function(t){var e=n();this.params={operator:"to contain "+o(t)};var a=this.obj;r.isArray(a)?this.assert(a.some(function(r){return e(r,t).result})):r.isString(a)?this.assert(a.indexOf(String(t))>=0):r.isObject(a)?r.forOwn(t,function(t,e){a.should.have.property(e,t)}):this.assert(!1)}),e.add("containDeepOrdered",function(e){n();this.params={operator:"to contain "+o(e)};var a=this.obj;if(r.isArray(a)&&r.isArray(e)){var s=0;a.forEach(function(r){try{t(r).containDeepOrdered(e[s]),s++}catch(n){if(n instanceof t.AssertionError)return;throw n}},this),this.assert(s==e.length)}else r.isString(a)?this.assert(a.indexOf(String(e))>=0):r.isObject(a)&&r.isObject(e)?(r.forOwn(e,function(e,r){t(a[r]).containDeepOrdered(e)}),r.isEmptyObject(e)&&this.eql(e)):this.eql(e)}),e.add("containDeep",function(e){n();this.params={operator:"to contain "+o(e)};var a=this.obj;if(r.isArray(a)&&r.isArray(e)){var s={};e.forEach(function(e){this.assert(a.some(function(r,n){if(n in s)return!1;try{return t(r).containDeep(e),s[n]=!0,!0}catch(o){if(o instanceof t.AssertionError)return!1;throw o}}))},this)}else r.isString(a)?this.assert(a.indexOf(String(e))>=0):r.isObject(a)&&r.isObject(e)?(r.forOwn(e,function(e,r){t(a[r]).containDeep(e)}),r.isEmptyObject(e)&&this.eql(e)):this.eql(e)})}},{"../eql":5,"../util":19}],11:[function(t,e){var r=t("../eql"),n=t("../config"),o=t("../util"),a=t("should-type");e.exports=function(t,e){e.add("eql",function(e,s){var i=r();this.params={operator:"to equal",expected:e,message:s};var u=i(this.obj,e,t.config),c=n.useOldDeepEqual?u:u.result;n.useOldDeepEqual||u.result||(this.params.details=o.formatEqlResult(u,this.obj,e,t.format)),this.params.showDiff=a(this.obj)==a(e),this.assert(c)}),e.add("equal",function(t,e){this.params={operator:"to be",expected:t,message:e},this.params.showDiff=a(this.obj)==a(t),this.assert(t===this.obj)}),e.alias("equal","exactly")}},{"../config":4,"../eql":5,"../util":19,"should-type":23}],12:[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":19}],13:[function(t,e){var r=t("../util"),n=t("../eql");e.exports=function(t,e){var o=t.format;e.add("match",function(a,s){var i=n();if(this.params={operator:"to match "+o(a),message:s},!i(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 u=[],c=[];r.forOwn(this.obj,function(t,e){a.exec(t)?c.push(r.formatProp(e)):u.push(r.formatProp(e)+" ("+o(t)+")")},this),u.length&&(this.params.operator+="\n not matched properties: "+u.join(", ")),c.length&&(this.params.operator+="\n matched properties: "+c.join(", ")),this.assert(0==u.length)}}else if(r.isFunction(a)){var f;f=a(this.obj),f instanceof e&&(this.params.operator+="\n "+f.getMessage()),r.isBoolean(f)&&this.assert(f)}else r.isObject(a)?(u=[],c=[],r.forOwn(a,function(e,n){try{t(this.obj[n]).match(e),c.push(r.formatProp(n))}catch(a){if(!(a instanceof t.AssertionError))throw a;u.push(r.formatProp(n)+" ("+o(this.obj[n])+")")}},this),u.length&&(this.params.operator+="\n not matched properties: "+u.join(", ")),c.length&&(this.params.operator+="\n matched properties: "+c.join(", ")),this.assert(0==u.length)):this.assert(!1)}),e.add("matchEach",function(t,e){var a=n();this.params={operator:"to match each "+o(t),message:e};var s=t;r.isRegExp(t)?s=function(e){return!!t.exec(e)}:r.isFunction(t)||(s=function(e){return a(e,t).result}),r.forOwn(this.obj,function(t,e){var n=s(t,e);r.isBoolean(n)&&this.assert(n)},this)})}},{"../eql":5,"../util":19}],14:[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")}},{}],15:[function(t,e){var r=t("../util"),n=t("../eql"),o=Array.prototype.slice;e.exports=function(t,e){var a=t.format;e.add("enumerable",function(t,e){t=String(t);var o=n();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(o(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={},s=n();arguments.length>1?t=o.call(arguments):r.isArray(t)||(r.isString(t)?t=[t]:(e=t,t=Object.keys(t)));var i=Object(this.obj),u=[];t.forEach(function(t){t in i||u.push(r.formatProp(t))});var c=u;0===c.length?c=t.map(r.formatProp):this.anyOne&&(c=t.filter(function(t){return u.indexOf(r.formatProp(t))<0}).map(r.formatProp));var f=(1===c.length?"to have property ":"to have "+(this.anyOne?"any of ":"")+"properties ")+c.join(", ");this.params={obj:this.obj,operator:f},this.assert(0===u.length||this.anyOne&&u.length!=t.length);var l=Object.keys(e);if(l.length){var h=[];c=[],l.forEach(function(t){var n=e[t];s(i[t],n).result?c.push(r.formatProp(t)+" of "+a(n)):h.push(r.formatProp(t)+" of "+a(n)+" (got "+a(i[t])+")")}),(0!==h.length&&!this.anyOne||this.anyOne&&0===c.length)&&(c=h),f=(1===c.length?"to have property ":"to have "+(this.anyOne?"any of ":"")+"properties ")+c.join(", "),this.params={obj:this.obj,operator:f},this.assert(0===h.length||this.anyOne&&h.length!=l.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})}},{"../eql":5,"../util":19}],16:[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)})}},{}],17:[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":19}],18:[function(t,e){function r(t,e){if(t===e)return!0;if(o.isBuffer(t)&&o.isBuffer(e)){if(t.length!=e.length)return!1;for(var r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}return o.isDate(t)&&o.isDate(e)?t.getTime()===e.getTime():o.isRegExp(t)&&o.isRegExp(e)?t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase:o.isObject(t)||o.isObject(e)?n(t,e):t==e}function n(t,e){if(o.isNullOrUndefined(t)||o.isNullOrUndefined(e))return!1;if(t.prototype!==e.prototype)return!1;if(o.isArguments(t))return o.isArguments(e)?(t=a.call(t),e=a.call(e),r(t,e)):!1;try{var n,s,i=Object.keys(t),u=Object.keys(e)}catch(c){return!1}if(i.length!=u.length)return!1;for(i.sort(),u.sort(),s=i.length-1;s>=0;s--)if(i[s]!=u[s])return!1;for(s=i.length-1;s>=0;s--)if(n=i[s],!r(t[n],e[n]))return!1;return!0}var o=t("./util");e.exports=r;var a=Array.prototype.slice},{"./util":19}],19:[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 l(t){return f(t)&&"[object RegExp]"===c(t)}function h(t){return null==t}function p(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=l,r.isNullOrUndefined=h,r.isNull=p,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()},r.isEmptyObject=function(t){for(var e in t)if(d.call(t,e))return!1;return!0}},{"should-format":21}],20:[function(t,e){function r(t,e,r,n,o){var a={result:t};return t||(a.path=e,a.reason=r,a.a=n,a.b=o),a}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,a,f,l,h,p){function m(n,o){var s=r(n,h,o,t,e);return!n&&a.collectAllFails&&p.push(s),s}function b(r){return o(t[r],e[r],a,f,l,h.concat([r]),p)}var g=u;if(t===e)return m(0!==t||1/t==1/e,c.PLUS_0_AND_MINUS_0);var d,y,j=s(t),E=s(e);if(j!==E)return m(!1,n(c.DIFFERENT_TYPES,j,E));switch(j){case"number":return t!==t?m(e!==e,c.NAN_NUMBER):0===t?m(1/t===1/e,c.PLUS_0_AND_MINUS_0):m(t===e,c.EQUALITY);case"regexp":for(y=["source","global","multiline","lastIndex","ignoreCase"];y.length;)if(g=b(y.shift()),!a.collectAllFails&&!g.result)return g;break;case"boolean":case"string":return m(t===e,c.EQUALITY);case"date":if(+t!==+e&&!a.collectAllFails)return m(!1,c.EQUALITY);break;case"object-number":case"object-boolean":case"object-string":if(g=o(t.valueOf(),e.valueOf(),a,f,l,h,p),!g.result&&!a.collectAllFails)return g.reason=c.WRAPPED_VALUE,g;break;case"buffer":if(g=b("length"),!a.collectAllFails&&!g.result)return g;for(d=t.length;d--;)if(g=b(d),!a.collectAllFails&&!g.result)return g;return u;case"error":for(y=["name","message"];y.length;)if(g=b(y.shift()),!a.collectAllFails&&!g.result)return g}for(f||(f=[]),l||(l=[]),d=f.length;d--;)if(f[d]==t)return m(l[d]==e,c.CIRCULAR_VALUES);f.push(t),l.push(e);var v;if(!("array"!==j&&"arguments"!==j&&"typed-array"!==j||(g=b("length"),a.collectAllFails||g.result)))return g;if(!("array-buffer"!==j&&"typed-array"!==j||(g=b("byteLength"),a.collectAllFails||g.result)))return g;if("function"===E){var O=t.toString(),A=e.toString();if(g=o(O,A,a,f,l,h,p),g.reason=c.FUNCTION_SOURCES,!a.collectAllFails&&!g.result)return g}for(v in e)if(i.call(e,v)){if(g=m(i.call(t,v),n(c.MISSING_KEY,"A",v)),!g.result&&!a.collectAllFails)return g;if(g.result&&(g=b(v),!g.result&&!a.collectAllFails))return g}for(v in t)if(i.call(t,v)&&(g=m(i.call(e,v),n(c.MISSING_KEY,"B",v)),!g.result&&!a.collectAllFails))return g;f.pop(),l.pop();var x=!1,S=!1;return(!a.checkProtoEql||(Object.getPrototypeOf?(x=Object.getPrototypeOf(t)===Object.getPrototypeOf(e),S=!0):t.__proto__&&e.__proto__&&(x=t.__proto__===e.__proto__,S=!0),!S||x||a.collectAllFails||(g=m(x,c.EQUALITY_PROTOTYPE),g.showReason=!0,g.result||a.collectAllFails)))&&("function"!==E||(g=b("prototype"),g.result||a.collectAllFails))?u:g}function a(t,e,r){r=r||f;var n=[],a=o(t,e,r||f,[],[],[],n);return r.collectAllFails?n:a}var s=t("should-type"),i=Object.prototype.hasOwnProperty,u=r(!0),c={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"},f={checkProtoEql:!0,collectAllFails:!1};e.exports=a,a.r=c},{"should-type":23}],21:[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.split("\n").map(function(t){return" "+t}).join("\n")}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 l(t){if(t.name)return t.name;var e=t.toString().match(b)[1];return e}function h(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 p=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=p(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=l(t);return"[Function"+(e?": "+e:"")+"]"})),n("error",f(function(t){var e=t.name,r=t.message;return"["+e+(r?": "+r:"")+"]"})),n("buffer",h("length","Buffer")),n("array-buffer",h("byteLength")),n("typed-array",h("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":22}],22:[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]})},{}],23:[function(t,e,r){arguments[4][22][0].apply(r,arguments)},{dup:22}]},{},[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 l=r[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return o(r?r:t)},l,l.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=function u(t){return new u.Assertion(t).proxied()};o.AssertionError=t("./assertion-error"),o.Assertion=t("./assertion"),o.format=t("should-format"),o.type=t("should-type"),o.config=t("./config"),r=e.exports=o,o.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 o(n.isWrapperType(this)?this.valueOf():this)},configurable:!0}),{name:t,descriptor:r,proto:e}},o.noConflict=function(t){return t=t||i,t&&(delete t.proto[t.name],t.descriptor&&Object.defineProperty(t.proto,t.name,t.descriptor)),o},o.use=function(t){return t(o,o.Assertion),this},o.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"));var a=Object.prototype,s="should",i=o.extend(s,a)},{"./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":17,"should-format":19,"should-type":20}],2:[function(t,e){function r(t){return i+t}function n(t){return t.split("\n").map(r).join("\n")}var o=t("./util"),a=t("should-format"),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 n=o.functionName(this.stackStartFunction),a=r.indexOf("\n"+n);if(a>=0){var s=r.indexOf("\n",a+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=a(this.actual),e="expected"in this?" "+a(this.expected):"",r="details"in this&&this.details?" ("+this.details+")":"",o=this.previous?"\n"+n(this.previous.message):"";return"expected "+t+(this.negate?" not ":" ")+this.operator+e+r+o}}}),e.exports=s},{"./util":17,"should-format":19}],3:[function(t,e){function r(t){this.obj=t,this.anyOne=!1,this.negate=!1,this.params={actual:t}}{var n=t("./assertion-error"),o=t("./util");t("should-format")}r.add=function(t,e,o){var a={enumerable:!0,configurable:!0};o=!!o,a[o?"get":"value"]=function(){var o=new r(this.obj,this,t);o.anyOne=this.anyOne;try{e.apply(o,arguments)}catch(a){if(a instanceof n){if(this.negate)return this.obj=o.obj,this.negate=!1,this.proxied();o!=a.assertion&&(o.params.previous=a),o.negate=!1,o.fail()}throw a}return this.negate&&(o.negate=!0,o.params.details="false negative fail",o.fail()),this.params.operator||(this.params=o.params),this.obj=o.obj,this.negate=!1,this.proxied()},Object.defineProperty(r.prototype,t,a)},r.addChain=function(t,e){e=e||function(){},Object.defineProperty(r.prototype,t,{get:function(){return e(),this.proxied()},enumerable:!0})},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)},r.prototype={constructor:r,assert:function(t){if(t)return this.proxied();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.proxied()},get any(){return this.anyOne=!0,this.proxied()},proxied:function(){return"function"==typeof Proxy?new Proxy(this,{get:function(t,e){if(e in t)return t[e];throw new Error("Assertion has no property "+o.formatProp(e))}}):this}},e.exports=r},{"./assertion-error":2,"./util":17,"should-format":19}],4:[function(t,e){var r={checkProtoEql:!1};e.exports=r},{}],5:[function(t,e){function r(t,e,n,o,a){var i=new s(t);i.params={operator:o,expected:e,message:n,stackStartFunction:a||r},i.fail()}function n(t,e){t||r(t,!0,e,"==",c.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 s;"string"==typeof n&&(a=n,n=null);try{e()}catch(i){s=i}if(a=(n&&n.name?" ("+n.name+")":".")+(a?" "+a:"."),t&&!s&&r(s,n,"Missing expected exception"+a),!t&&o(s,n)&&r(s,n,"Got unwanted exception"+a),t&&s&&n&&!o(s,n)||!t&&s)throw s}var s=(t("./../util"),t("./../assertion")),i=t("should-equal"),u=Array.prototype.slice,c=e.exports=n;c.fail=r,c.ok=n,c.equal=function(t,e,n){t!=e&&r(t,e,n,"==",c.equal)},c.notEqual=function(t,e,n){t==e&&r(t,e,n,"!=",c.notEqual)},c.deepEqual=function(t,e,n){i(t,e).result||r(t,e,n,"deepEqual",c.deepEqual)},c.notDeepEqual=function(t,e,n){i(t,e).result&&r(t,e,n,"notDeepEqual",c.notDeepEqual)},c.strictEqual=function(t,e,n){t!==e&&r(t,e,n,"===",c.strictEqual)},c.notStrictEqual=function(t,e,n){t===e&&r(t,e,n,"!==",c.notStrictEqual)},c["throws"]=function(){a.apply(this,[!0].concat(u.call(arguments)))},c.doesNotThrow=function(){a.apply(this,[!1].concat(u.call(arguments)))},c.ifError=function(t){if(t)throw t}},{"./../assertion":3,"./../util":17,"should-equal":18}],6:[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":17,"./_assert":5}],7:[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)}},{}],8:[function(t,e){e.exports=function(t,e){["an","of","a","and","be","have","with","is","which","the"].forEach(function(t){e.addChain(t)})}},{}],9:[function(t,e){var r=t("../util"),n=t("should-equal");e.exports=function(t,e){var o=t.format,a=t.type;e.add("containEql",function(e){this.params={operator:"to contain "+o(e)},this.is.not["null"].and.not.undefined;var a=this.obj,s=t.type(a);s==t.type.STRING?this.assert(a.indexOf(String(e))>=0):r.isIndexable(a)?this.assert(r.some(a,function(t){return n(t,e).result})):this.have.properties(e)}),e.add("containDeepOrdered",function(e){this.params={operator:"to contain "+o(e)};var n=this.obj;if(a(n)==a.STRING)this.assert(n.indexOf(String(e))>=0);else if(r.isIndexable(n)&&r.isIndexable(e)){for(var s=0,i=0,u=r.length(n),c=r.length(e);u>s&&c>i;s++)try{t(n[s]).containDeepOrdered(e[i]),i++}catch(l){if(l instanceof t.AssertionError)continue;throw l}this.assert(i==c)}else null!=n&&null!=e&&"object"==typeof n&&"object"==typeof e?(r.forEach(e,function(e,r){t(n[r]).containDeepOrdered(e)}),r.isEmptyObject(e)&&this.eql(e)):this.eql(e)}),e.add("containDeep",function(e){this.params={operator:"to contain "+o(e)};var n=this.obj;if("string"==typeof n)this.assert(n.indexOf(String(e))>=0);else if(r.isIndexable(n)&&r.isIndexable(e)){var a={};r.forEach(e,function(e){this.assert(r.some(n,function(r,n){if(n in a)return!1;try{return t(r).containDeep(e),a[n]=!0,!0}catch(o){if(o instanceof t.AssertionError)return!1;throw o}}))},this)}else null!=n&&null!=e&&"object"==typeof n&&"object"==typeof e?(r.forEach(e,function(e,r){t(n[r]).containDeep(e)}),r.isEmptyObject(e)&&this.eql(e)):this.eql(e)})}},{"../util":17,"should-equal":18}],10:[function(t,e){function r(t,e,r,n){return((t.path.length>0?"at "+t.path.map(a.formatProp).join(" -> "):"")+(t.a===e?"":", A has "+n(t.a))+(t.b===r?"":" and B has "+n(t.b))+(t.showReason?" because "+t.reason:"")).trim()}var n=t("should-equal"),o=t("should-type"),a=t("../util");e.exports=function(t,e){e.add("eql",function(e,a){this.params={operator:"to equal",expected:e,message:a};var s=n(this.obj,e,t.config);this.params.details=s.result?"":r(s,this.obj,e,t.format),this.params.showDiff=o(this.obj)==o(e),this.assert(s.result)}),e.add("equal",function(t,e){this.params={operator:"to be",expected:t,message:e},this.params.showDiff=o(this.obj)==o(t),this.assert(t===this.obj)}),e.alias("equal","exactly")}},{"../util":17,"should-equal":18,"should-type":20}],11:[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(l){u=!0,s=l}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{s.should.match(e)}catch(l){if(!(l instanceof t.AssertionError))throw l;i=": "+l.message,c=!1}if(c){if("function"==typeof e&&o)try{s.should.match(o)}catch(l){if(!(l instanceof t.AssertionError))throw l;i=": "+l.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":17}],12:[function(t,e){var r=t("../util"),n=t("should-equal");e.exports=function(t,e){var o=t.format;e.add("match",function(e,a){if(this.params={operator:"to match "+o(e),message:a},!n(this.obj,e).result)if(e instanceof RegExp){if("string"==typeof this.obj)this.assert(e.exec(this.obj));else if(r.isIndexable(this.obj))r.forEach(this.obj,function(t){this.assert(e.exec(t))},this);else if(null!=this.obj&&"object"==typeof this.obj){var s=[],i=[];r.forEach(this.obj,function(t,n){e.exec(t)?i.push(r.formatProp(n)):s.push(r.formatProp(n)+" ("+o(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=[],r.forEach(e,function(e,n){try{t(this.obj[n]).match(e),i.push(r.formatProp(n))}catch(a){if(!(a instanceof t.AssertionError))throw a;s.push(r.formatProp(n)+" ("+o(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(t,e){this.params={operator:"to match each "+o(t),message:e};var a=t;t instanceof RegExp?a=function(e){return!!t.exec(e)}:"function"!=typeof t&&(a=function(e){return n(e,t).result}),r.forEach(this.obj,function(t,e){var r=a(t,e);"boolean"==typeof r&&this.assert(r)},this)})}},{"../util":17,"should-equal":18}],13:[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.is.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")}},{}],14:[function(t,e){var r=t("../util"),n=t("should-equal"),o=Array.prototype.slice;e.exports=function(t,e){function a(){var e={};if(arguments.length>1)e.names=o.call(arguments);else{var n=arguments[0],a=t.type(n);a==t.type.STRING?e.names=[n]:r.isIndexable(n)?e.names=n:(e.names=Object.keys(n),e.values=n)}return e}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 n=this.obj;this.have.ownProperty(e),t(Object.getOwnPropertyDescriptor(Object(n),e)).have.properties(r)}),e.add("enumerable",function(t,e){t=String(t),this.params={operator:"to have enumerable property "+r.formatProp(t)+(arguments.length>1?" equal to "+s(e):"")};var n={enumerable:!0};arguments.length>1&&(n.value=e),this.have.propertyWithDescriptor(t,n)}),e.add("enumerables",function(){var t=a.apply(null,arguments);this.params={operator:"to have enumerables "+t.names.map(r.formatProp)};var e=this.obj;t.names.forEach(function(t){e.should.have.enumerable(t)})}),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):Array.isArray(t)||("string"==typeof t?t=[t]:(e=t,t=Object.keys(t)));var a=Object(this.obj),i=[];t.forEach(function(t){t in a||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 l=Object.keys(e);if(l.length){var h=[];u=[],l.forEach(function(t){var o=e[t];n(a[t],o).result?u.push(r.formatProp(t)+" of "+s(o)):h.push(r.formatProp(t)+" of "+s(o)+" (got "+s(a[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!=l.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=String(t),this.params={actual:this.obj,operator:"to have own property "+r.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!==r.length(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(e){arguments.length>1?e=o.call(arguments):1===arguments.length&&t.type(e)==t.type.STRING?e=[e]:0===arguments.length&&(e=[]),e=e.map(String);var n=Object(this.obj),a=[];e.forEach(function(t){i.call(this.obj,t)||a.push(r.formatProp(t))},this);var s=[];Object.keys(n).forEach(function(t){e.indexOf(t)<0&&s.push(r.formatProp(t))});var u=0===e.length?"to be empty":"to have "+(1===e.length?"key ":"keys ");this.params={operator:u+e.map(r.formatProp).join(", ")},a.length>0&&(this.params.operator+="\n missing keys: "+a.join(", ")),s.length>0&&(this.params.operator+="\n extra keys: "+s.join(", ")),this.assert(0===a.length&&0===s.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":17,"should-equal":18}],15:[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)})}},{}],16:[function(t,e){var r=t("../util");e.exports=function(t,e){e.add("Number",function(){this.params={operator:"to be a number"},this.have.type("number")},!0),e.add("arguments",function(){this.params={operator:"to be arguments"},this.have["class"]("Arguments")},!0),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 "+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.have.type("function")},!0),e.add("Object",function(){this.params={operator:"to be an object"},this.is.not["null"].and.have.type("object")},!0),e.add("String",function(){this.params={operator:"to be a string"},this.have.type("string")},!0),e.add("Array",function(){this.params={operator:"to be an array"},this.have["class"]("Array")},!0),e.add("Boolean",function(){this.params={operator:"to be a boolean"},this.have.type("boolean")},!0),e.add("Error",function(){this.params={operator:"to be an error"},this.have.instanceOf(Error)},!0),e.add("null",function(){this.params={operator:"to be null"},this.assert(null===this.obj)},!0),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)},!0),e.alias("undefined","Undefined")}},{"../util":17}],17:[function(t,e,r){var n=t("should-type");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(t,e,r){for(var n in t)if(o.call(t,n)&&e.call(r,t[n],n,t)===!1)return},r.some=function(t,e,n){var o=!1;return r.forEach(t,function(r,a){return e.call(n,r,a,t)?(o=!0,!1):void 0},n),o};var a=/^\s*function\s*(\S*)\s*\(/;r.functionName=function(t){if(t.name)return t.name;var e=t.toString().match(a)[1];return e};var s=t("should-format").formatPropertyName;r.formatProp=function(t){return s(String(t))},r.isEmptyObject=function(t){for(var e in t)if(o.call(t,e))return!1;return!0},r.isIndexable=function(t){var e=n(t);return e==n.ARRAY||e==n.BUFFER||e==n.ARGUMENTS||e==n.ARRAY_BUFFER||e==n.TYPED_ARRAY||e==n.DATA_VIEW||e==n.STRING},r.length=function(t){switch(n(t)){case n.ARRAY_BUFFER:case n.TYPED_ARRAY:case n.DATA_VIEW:return t.byteLength;case n.ARRAY:case n.BUFFER:case n.ARGUMENTS:case n.FUNCTION:case n.STRING:return t.length}}},{"should-format":19,"should-type":20}],18:[function(t,e){function r(t,e,r,n,o){var a={result:t};return t||(a.path=e,a.reason=r,a.a=n,a.b=o),a}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,a,l,h,f,p){function m(n,o){var s=r(n,f,o,t,e);return!n&&a.collectAllFails&&p.push(s),s}function b(r){return o(t[r],e[r],a,l,h,f.concat([r]),p)}var d=u;if(t===e)return m(0!==t||1/t==1/e,c.PLUS_0_AND_MINUS_0);var g,y,j=s(t),E=s(e);if(j!==E)return m(!1,n(c.DIFFERENT_TYPES,j,E));switch(j){case"number":return t!==t?m(e!==e,c.NAN_NUMBER):0===t?m(1/t===1/e,c.PLUS_0_AND_MINUS_0):m(t===e,c.EQUALITY);case"regexp":for(y=["source","global","multiline","lastIndex","ignoreCase"];y.length;)if(d=b(y.shift()),!a.collectAllFails&&!d.result)return d;break;case"boolean":case"string":return m(t===e,c.EQUALITY);case"date":if(+t!==+e&&!a.collectAllFails)return m(!1,c.EQUALITY);break;case"object-number":case"object-boolean":case"object-string":if(d=o(t.valueOf(),e.valueOf(),a,l,h,f,p),!d.result&&!a.collectAllFails)return d.reason=c.WRAPPED_VALUE,d;break;case"buffer":if(d=b("length"),!a.collectAllFails&&!d.result)return d;for(g=t.length;g--;)if(d=b(g),!a.collectAllFails&&!d.result)return d;return u;case"error":for(y=["name","message"];y.length;)if(d=b(y.shift()),!a.collectAllFails&&!d.result)return d}for(l||(l=[]),h||(h=[]),g=l.length;g--;)if(l[g]==t)return m(h[g]==e,c.CIRCULAR_VALUES);l.push(t),h.push(e);var v;if(!("array"!==j&&"arguments"!==j&&"typed-array"!==j||(d=b("length"),a.collectAllFails||d.result)))return d;if(!("array-buffer"!==j&&"typed-array"!==j||(d=b("byteLength"),a.collectAllFails||d.result)))return d;if("function"===E){var A=t.toString(),O=e.toString();if(d=o(A,O,a,l,h,f,p),d.reason=c.FUNCTION_SOURCES,!a.collectAllFails&&!d.result)return d}for(v in e)if(i.call(e,v)){if(d=m(i.call(t,v),n(c.MISSING_KEY,"A",v)),!d.result&&!a.collectAllFails)return d;if(d.result&&(d=b(v),!d.result&&!a.collectAllFails))return d}for(v in t)if(i.call(t,v)&&(d=m(i.call(e,v),n(c.MISSING_KEY,"B",v)),!d.result&&!a.collectAllFails))return d;l.pop(),h.pop();var x=!1,R=!1;return(!a.checkProtoEql||(Object.getPrototypeOf?(x=Object.getPrototypeOf(t)===Object.getPrototypeOf(e),R=!0):t.__proto__&&e.__proto__&&(x=t.__proto__===e.__proto__,R=!0),!R||x||a.collectAllFails||(d=m(x,c.EQUALITY_PROTOTYPE),d.showReason=!0,d.result||a.collectAllFails)))&&("function"!==E||(d=b("prototype"),d.result||a.collectAllFails))?u:d}function a(t,e,r){r=r||l;var n=[],a=o(t,e,r||l,[],[],[],n);return r.collectAllFails?n:a}var s=t("should-type"),i=Object.prototype.hasOwnProperty,u=r(!0),c={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"},l={checkProtoEql:!0,collectAllFails:!1};e.exports=a,a.r=c},{"should-type":20}],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.split("\n").map(function(t){return" "+t}).join("\n")}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 l(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 f(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 p=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=p(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,l(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",l(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",l(c));var b=/^\s*function\s*(\S*)\s*\(/;n("function",l(function(t){var e=h(t);return"[Function"+(e?": "+e:"")+"]"})),n("error",l(function(t){var e=t.name,r=t.message;return"["+e+(r?": "+r:"")+"]"})),n("buffer",f("length","Buffer")),n("array-buffer",f("byteLength")),n("typed-array",f("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){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]})},{}]},{},[1])(1)});

Sorry, the diff of this file is not supported yet

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc