diff --git a/.gitignore b/.gitignore index 417e97f55..9f563c044 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ coverage test/auth/* !test/auth/.gitkeep + +/chai.js +/chai.cjs diff --git a/History.md b/History.md index ae4d323e7..5b5ae7b02 100644 --- a/History.md +++ b/History.md @@ -1,7 +1,7 @@ ### Note As of 3.0.0, the History.md file has been deprecated. [Please refer to the full -commit logs available on GitHub](https://github.com/chaijs/chai/commits/master). +commit logs available on GitHub](https://github.com/chaijs/chai/commits). --- diff --git a/chai.js b/chai.js deleted file mode 100644 index f2b7952d3..000000000 --- a/chai.js +++ /dev/null @@ -1,11794 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.chai = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i - * MIT Licensed - */ - -var used = []; - -/*! - * Chai version - */ - -exports.version = '4.3.1'; - -/*! - * Assertion Error - */ - -exports.AssertionError = require('assertion-error'); - -/*! - * Utils for plugins (not exported) - */ - -var util = require('./chai/utils'); - -/** - * # .use(function) - * - * Provides a way to extend the internals of Chai. - * - * @param {Function} - * @returns {this} for chaining - * @api public - */ - -exports.use = function (fn) { - if (!~used.indexOf(fn)) { - fn(exports, util); - used.push(fn); - } - - return exports; -}; - -/*! - * Utility Functions - */ - -exports.util = util; - -/*! - * Configuration - */ - -var config = require('./chai/config'); -exports.config = config; - -/*! - * Primary `Assertion` prototype - */ - -var assertion = require('./chai/assertion'); -exports.use(assertion); - -/*! - * Core Assertions - */ - -var core = require('./chai/core/assertions'); -exports.use(core); - -/*! - * Expect interface - */ - -var expect = require('./chai/interface/expect'); -exports.use(expect); - -/*! - * Should interface - */ - -var should = require('./chai/interface/should'); -exports.use(should); - -/*! - * Assert interface - */ - -var assert = require('./chai/interface/assert'); -exports.use(assert); - -},{"./chai/assertion":3,"./chai/config":4,"./chai/core/assertions":5,"./chai/interface/assert":6,"./chai/interface/expect":7,"./chai/interface/should":8,"./chai/utils":22,"assertion-error":33}],3:[function(require,module,exports){ -/*! - * chai - * http://chaijs.com - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -var config = require('./config'); - -module.exports = function (_chai, util) { - /*! - * Module dependencies. - */ - - var AssertionError = _chai.AssertionError - , flag = util.flag; - - /*! - * Module export. - */ - - _chai.Assertion = Assertion; - - /*! - * Assertion Constructor - * - * Creates object for chaining. - * - * `Assertion` objects contain metadata in the form of flags. Three flags can - * be assigned during instantiation by passing arguments to this constructor: - * - * - `object`: This flag contains the target of the assertion. For example, in - * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will - * contain `numKittens` so that the `equal` assertion can reference it when - * needed. - * - * - `message`: This flag contains an optional custom error message to be - * prepended to the error message that's generated by the assertion when it - * fails. - * - * - `ssfi`: This flag stands for "start stack function indicator". It - * contains a function reference that serves as the starting point for - * removing frames from the stack trace of the error that's created by the - * assertion when it fails. The goal is to provide a cleaner stack trace to - * end users by removing Chai's internal functions. Note that it only works - * in environments that support `Error.captureStackTrace`, and only when - * `Chai.config.includeStack` hasn't been set to `false`. - * - * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag - * should retain its current value, even as assertions are chained off of - * this object. This is usually set to `true` when creating a new assertion - * from within another assertion. It's also temporarily set to `true` before - * an overwritten assertion gets called by the overwriting assertion. - * - * @param {Mixed} obj target of the assertion - * @param {String} msg (optional) custom error message - * @param {Function} ssfi (optional) starting point for removing stack frames - * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked - * @api private - */ - - function Assertion (obj, msg, ssfi, lockSsfi) { - flag(this, 'ssfi', ssfi || Assertion); - flag(this, 'lockSsfi', lockSsfi); - flag(this, 'object', obj); - flag(this, 'message', msg); - - return util.proxify(this); - } - - Object.defineProperty(Assertion, 'includeStack', { - get: function() { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - return config.includeStack; - }, - set: function(value) { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - config.includeStack = value; - } - }); - - Object.defineProperty(Assertion, 'showDiff', { - get: function() { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - return config.showDiff; - }, - set: function(value) { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - config.showDiff = value; - } - }); - - Assertion.addProperty = function (name, fn) { - util.addProperty(this.prototype, name, fn); - }; - - Assertion.addMethod = function (name, fn) { - util.addMethod(this.prototype, name, fn); - }; - - Assertion.addChainableMethod = function (name, fn, chainingBehavior) { - util.addChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - Assertion.overwriteProperty = function (name, fn) { - util.overwriteProperty(this.prototype, name, fn); - }; - - Assertion.overwriteMethod = function (name, fn) { - util.overwriteMethod(this.prototype, name, fn); - }; - - Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) { - util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - /** - * ### .assert(expression, message, negateMessage, expected, actual, showDiff) - * - * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. - * - * @name assert - * @param {Philosophical} expression to be tested - * @param {String|Function} message or function that returns message to display if expression fails - * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails - * @param {Mixed} expected value (remember to check for negation) - * @param {Mixed} actual (optional) will default to `this.obj` - * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails - * @api private - */ - - Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) { - var ok = util.test(this, arguments); - if (false !== showDiff) showDiff = true; - if (undefined === expected && undefined === _actual) showDiff = false; - if (true !== config.showDiff) showDiff = false; - - if (!ok) { - msg = util.getMessage(this, arguments); - var actual = util.getActual(this, arguments); - var assertionErrorObjectProperties = { - actual: actual - , expected: expected - , showDiff: showDiff - }; - - var operator = util.getOperator(this, arguments); - if (operator) { - assertionErrorObjectProperties.operator = operator; - } - - throw new AssertionError( - msg, - assertionErrorObjectProperties, - (config.includeStack) ? this.assert : flag(this, 'ssfi')); - } - }; - - /*! - * ### ._obj - * - * Quick reference to stored `actual` value for plugin developers. - * - * @api private - */ - - Object.defineProperty(Assertion.prototype, '_obj', - { get: function () { - return flag(this, 'object'); - } - , set: function (val) { - flag(this, 'object', val); - } - }); -}; - -},{"./config":4}],4:[function(require,module,exports){ -module.exports = { - - /** - * ### config.includeStack - * - * User configurable property, influences whether stack trace - * is included in Assertion error message. Default of false - * suppresses stack trace in the error message. - * - * chai.config.includeStack = true; // enable stack on error - * - * @param {Boolean} - * @api public - */ - - includeStack: false, - - /** - * ### config.showDiff - * - * User configurable property, influences whether or not - * the `showDiff` flag should be included in the thrown - * AssertionErrors. `false` will always be `false`; `true` - * will be true when the assertion has requested a diff - * be shown. - * - * @param {Boolean} - * @api public - */ - - showDiff: true, - - /** - * ### config.truncateThreshold - * - * User configurable property, sets length threshold for actual and - * expected values in assertion errors. If this threshold is exceeded, for - * example for large data structures, the value is replaced with something - * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`. - * - * Set it to zero if you want to disable truncating altogether. - * - * This is especially userful when doing assertions on arrays: having this - * set to a reasonable large value makes the failure messages readily - * inspectable. - * - * chai.config.truncateThreshold = 0; // disable truncating - * - * @param {Number} - * @api public - */ - - truncateThreshold: 40, - - /** - * ### config.useProxy - * - * User configurable property, defines if chai will use a Proxy to throw - * an error when a non-existent property is read, which protects users - * from typos when using property-based assertions. - * - * Set it to false if you want to disable this feature. - * - * chai.config.useProxy = false; // disable use of Proxy - * - * This feature is automatically disabled regardless of this config value - * in environments that don't support proxies. - * - * @param {Boolean} - * @api public - */ - - useProxy: true, - - /** - * ### config.proxyExcludedKeys - * - * User configurable property, defines which properties should be ignored - * instead of throwing an error if they do not exist on the assertion. - * This is only applied if the environment Chai is running in supports proxies and - * if the `useProxy` configuration setting is enabled. - * By default, `then` and `inspect` will not throw an error if they do not exist on the - * assertion object because the `.inspect` property is read by `util.inspect` (for example, when - * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking. - * - * // By default these keys will not throw an error if they do not exist on the assertion object - * chai.config.proxyExcludedKeys = ['then', 'inspect']; - * - * @param {Array} - * @api public - */ - - proxyExcludedKeys: ['then', 'catch', 'inspect', 'toJSON'] -}; - -},{}],5:[function(require,module,exports){ -/*! - * chai - * http://chaijs.com - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, _) { - var Assertion = chai.Assertion - , AssertionError = chai.AssertionError - , flag = _.flag; - - /** - * ### Language Chains - * - * The following are provided as chainable getters to improve the readability - * of your assertions. - * - * **Chains** - * - * - to - * - be - * - been - * - is - * - that - * - which - * - and - * - has - * - have - * - with - * - at - * - of - * - same - * - but - * - does - * - still - * - also - * - * @name language chains - * @namespace BDD - * @api public - */ - - [ 'to', 'be', 'been', 'is' - , 'and', 'has', 'have', 'with' - , 'that', 'which', 'at', 'of' - , 'same', 'but', 'does', 'still', "also" ].forEach(function (chain) { - Assertion.addProperty(chain); - }); - - /** - * ### .not - * - * Negates all assertions that follow in the chain. - * - * expect(function () {}).to.not.throw(); - * expect({a: 1}).to.not.have.property('b'); - * expect([1, 2]).to.be.an('array').that.does.not.include(3); - * - * Just because you can negate any assertion with `.not` doesn't mean you - * should. With great power comes great responsibility. It's often best to - * assert that the one expected output was produced, rather than asserting - * that one of countless unexpected outputs wasn't produced. See individual - * assertions for specific guidance. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.not.equal(1); // Not recommended - * - * @name not - * @namespace BDD - * @api public - */ - - Assertion.addProperty('not', function () { - flag(this, 'negate', true); - }); - - /** - * ### .deep - * - * Causes all `.equal`, `.include`, `.members`, `.keys`, and `.property` - * assertions that follow in the chain to use deep equality instead of strict - * (`===`) equality. See the `deep-eql` project page for info on the deep - * equality algorithm: https://github.com/chaijs/deep-eql. - * - * // Target object deeply (but not strictly) equals `{a: 1}` - * expect({a: 1}).to.deep.equal({a: 1}); - * expect({a: 1}).to.not.equal({a: 1}); - * - * // Target array deeply (but not strictly) includes `{a: 1}` - * expect([{a: 1}]).to.deep.include({a: 1}); - * expect([{a: 1}]).to.not.include({a: 1}); - * - * // Target object deeply (but not strictly) includes `x: {a: 1}` - * expect({x: {a: 1}}).to.deep.include({x: {a: 1}}); - * expect({x: {a: 1}}).to.not.include({x: {a: 1}}); - * - * // Target array deeply (but not strictly) has member `{a: 1}` - * expect([{a: 1}]).to.have.deep.members([{a: 1}]); - * expect([{a: 1}]).to.not.have.members([{a: 1}]); - * - * // Target set deeply (but not strictly) has key `{a: 1}` - * expect(new Set([{a: 1}])).to.have.deep.keys([{a: 1}]); - * expect(new Set([{a: 1}])).to.not.have.keys([{a: 1}]); - * - * // Target object deeply (but not strictly) has property `x: {a: 1}` - * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1}); - * expect({x: {a: 1}}).to.not.have.property('x', {a: 1}); - * - * @name deep - * @namespace BDD - * @api public - */ - - Assertion.addProperty('deep', function () { - flag(this, 'deep', true); - }); - - /** - * ### .nested - * - * Enables dot- and bracket-notation in all `.property` and `.include` - * assertions that follow in the chain. - * - * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]'); - * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'}); - * - * If `.` or `[]` are part of an actual property name, they can be escaped by - * adding two backslashes before them. - * - * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]'); - * expect({'.a': {'[b]': 'x'}}).to.nested.include({'\\.a.\\[b\\]': 'x'}); - * - * `.nested` cannot be combined with `.own`. - * - * @name nested - * @namespace BDD - * @api public - */ - - Assertion.addProperty('nested', function () { - flag(this, 'nested', true); - }); - - /** - * ### .own - * - * Causes all `.property` and `.include` assertions that follow in the chain - * to ignore inherited properties. - * - * Object.prototype.b = 2; - * - * expect({a: 1}).to.have.own.property('a'); - * expect({a: 1}).to.have.property('b'); - * expect({a: 1}).to.not.have.own.property('b'); - * - * expect({a: 1}).to.own.include({a: 1}); - * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2}); - * - * `.own` cannot be combined with `.nested`. - * - * @name own - * @namespace BDD - * @api public - */ - - Assertion.addProperty('own', function () { - flag(this, 'own', true); - }); - - /** - * ### .ordered - * - * Causes all `.members` assertions that follow in the chain to require that - * members be in the same order. - * - * expect([1, 2]).to.have.ordered.members([1, 2]) - * .but.not.have.ordered.members([2, 1]); - * - * When `.include` and `.ordered` are combined, the ordering begins at the - * start of both arrays. - * - * expect([1, 2, 3]).to.include.ordered.members([1, 2]) - * .but.not.include.ordered.members([2, 3]); - * - * @name ordered - * @namespace BDD - * @api public - */ - - Assertion.addProperty('ordered', function () { - flag(this, 'ordered', true); - }); - - /** - * ### .any - * - * Causes all `.keys` assertions that follow in the chain to only require that - * the target have at least one of the given keys. This is the opposite of - * `.all`, which requires that the target have all of the given keys. - * - * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd'); - * - * See the `.keys` doc for guidance on when to use `.any` or `.all`. - * - * @name any - * @namespace BDD - * @api public - */ - - Assertion.addProperty('any', function () { - flag(this, 'any', true); - flag(this, 'all', false); - }); - - /** - * ### .all - * - * Causes all `.keys` assertions that follow in the chain to require that the - * target have all of the given keys. This is the opposite of `.any`, which - * only requires that the target have at least one of the given keys. - * - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); - * - * Note that `.all` is used by default when neither `.all` nor `.any` are - * added earlier in the chain. However, it's often best to add `.all` anyway - * because it improves readability. - * - * See the `.keys` doc for guidance on when to use `.any` or `.all`. - * - * @name all - * @namespace BDD - * @api public - */ - - Assertion.addProperty('all', function () { - flag(this, 'all', true); - flag(this, 'any', false); - }); - - /** - * ### .a(type[, msg]) - * - * Asserts that the target's type is equal to the given string `type`. Types - * are case insensitive. See the `type-detect` project page for info on the - * type detection algorithm: https://github.com/chaijs/type-detect. - * - * expect('foo').to.be.a('string'); - * expect({a: 1}).to.be.an('object'); - * expect(null).to.be.a('null'); - * expect(undefined).to.be.an('undefined'); - * expect(new Error).to.be.an('error'); - * expect(Promise.resolve()).to.be.a('promise'); - * expect(new Float32Array).to.be.a('float32array'); - * expect(Symbol()).to.be.a('symbol'); - * - * `.a` supports objects that have a custom type set via `Symbol.toStringTag`. - * - * var myObj = { - * [Symbol.toStringTag]: 'myCustomType' - * }; - * - * expect(myObj).to.be.a('myCustomType').but.not.an('object'); - * - * It's often best to use `.a` to check a target's type before making more - * assertions on the same target. That way, you avoid unexpected behavior from - * any assertion that does different things based on the target's type. - * - * expect([1, 2, 3]).to.be.an('array').that.includes(2); - * expect([]).to.be.an('array').that.is.empty; - * - * Add `.not` earlier in the chain to negate `.a`. However, it's often best to - * assert that the target is the expected type, rather than asserting that it - * isn't one of many unexpected types. - * - * expect('foo').to.be.a('string'); // Recommended - * expect('foo').to.not.be.an('array'); // Not recommended - * - * `.a` accepts an optional `msg` argument which is a custom error message to - * show when the assertion fails. The message can also be given as the second - * argument to `expect`. - * - * expect(1).to.be.a('string', 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.a('string'); - * - * `.a` can also be used as a language chain to improve the readability of - * your assertions. - * - * expect({b: 2}).to.have.a.property('b'); - * - * The alias `.an` can be used interchangeably with `.a`. - * - * @name a - * @alias an - * @param {String} type - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function an (type, msg) { - if (msg) flag(this, 'message', msg); - type = type.toLowerCase(); - var obj = flag(this, 'object') - , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a '; - - this.assert( - type === _.type(obj).toLowerCase() - , 'expected #{this} to be ' + article + type - , 'expected #{this} not to be ' + article + type - ); - } - - Assertion.addChainableMethod('an', an); - Assertion.addChainableMethod('a', an); - - /** - * ### .include(val[, msg]) - * - * When the target is a string, `.include` asserts that the given string `val` - * is a substring of the target. - * - * expect('foobar').to.include('foo'); - * - * When the target is an array, `.include` asserts that the given `val` is a - * member of the target. - * - * expect([1, 2, 3]).to.include(2); - * - * When the target is an object, `.include` asserts that the given object - * `val`'s properties are a subset of the target's properties. - * - * expect({a: 1, b: 2, c: 3}).to.include({a: 1, b: 2}); - * - * When the target is a Set or WeakSet, `.include` asserts that the given `val` is a - * member of the target. SameValueZero equality algorithm is used. - * - * expect(new Set([1, 2])).to.include(2); - * - * When the target is a Map, `.include` asserts that the given `val` is one of - * the values of the target. SameValueZero equality algorithm is used. - * - * expect(new Map([['a', 1], ['b', 2]])).to.include(2); - * - * Because `.include` does different things based on the target's type, it's - * important to check the target's type before using `.include`. See the `.a` - * doc for info on testing a target's type. - * - * expect([1, 2, 3]).to.be.an('array').that.includes(2); - * - * By default, strict (`===`) equality is used to compare array members and - * object properties. Add `.deep` earlier in the chain to use deep equality - * instead (WeakSet targets are not supported). See the `deep-eql` project - * page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql. - * - * // Target array deeply (but not strictly) includes `{a: 1}` - * expect([{a: 1}]).to.deep.include({a: 1}); - * expect([{a: 1}]).to.not.include({a: 1}); - * - * // Target object deeply (but not strictly) includes `x: {a: 1}` - * expect({x: {a: 1}}).to.deep.include({x: {a: 1}}); - * expect({x: {a: 1}}).to.not.include({x: {a: 1}}); - * - * By default, all of the target's properties are searched when working with - * objects. This includes properties that are inherited and/or non-enumerable. - * Add `.own` earlier in the chain to exclude the target's inherited - * properties from the search. - * - * Object.prototype.b = 2; - * - * expect({a: 1}).to.own.include({a: 1}); - * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2}); - * - * Note that a target object is always only searched for `val`'s own - * enumerable properties. - * - * `.deep` and `.own` can be combined. - * - * expect({a: {b: 2}}).to.deep.own.include({a: {b: 2}}); - * - * Add `.nested` earlier in the chain to enable dot- and bracket-notation when - * referencing nested properties. - * - * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'}); - * - * If `.` or `[]` are part of an actual property name, they can be escaped by - * adding two backslashes before them. - * - * expect({'.a': {'[b]': 2}}).to.nested.include({'\\.a.\\[b\\]': 2}); - * - * `.deep` and `.nested` can be combined. - * - * expect({a: {b: [{c: 3}]}}).to.deep.nested.include({'a.b[0]': {c: 3}}); - * - * `.own` and `.nested` cannot be combined. - * - * Add `.not` earlier in the chain to negate `.include`. - * - * expect('foobar').to.not.include('taco'); - * expect([1, 2, 3]).to.not.include(4); - * - * However, it's dangerous to negate `.include` when the target is an object. - * The problem is that it creates uncertain expectations by asserting that the - * target object doesn't have all of `val`'s key/value pairs but may or may - * not have some of them. It's often best to identify the exact output that's - * expected, and then write an assertion that only accepts that exact output. - * - * When the target object isn't even expected to have `val`'s keys, it's - * often best to assert exactly that. - * - * expect({c: 3}).to.not.have.any.keys('a', 'b'); // Recommended - * expect({c: 3}).to.not.include({a: 1, b: 2}); // Not recommended - * - * When the target object is expected to have `val`'s keys, it's often best to - * assert that each of the properties has its expected value, rather than - * asserting that each property doesn't have one of many unexpected values. - * - * expect({a: 3, b: 4}).to.include({a: 3, b: 4}); // Recommended - * expect({a: 3, b: 4}).to.not.include({a: 1, b: 2}); // Not recommended - * - * `.include` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect([1, 2, 3]).to.include(4, 'nooo why fail??'); - * expect([1, 2, 3], 'nooo why fail??').to.include(4); - * - * `.include` can also be used as a language chain, causing all `.members` and - * `.keys` assertions that follow in the chain to require the target to be a - * superset of the expected set, rather than an identical set. Note that - * `.members` ignores duplicates in the subset when `.include` is added. - * - * // Target object's keys are a superset of ['a', 'b'] but not identical - * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b'); - * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b'); - * - * // Target array is a superset of [1, 2] but not identical - * expect([1, 2, 3]).to.include.members([1, 2]); - * expect([1, 2, 3]).to.not.have.members([1, 2]); - * - * // Duplicates in the subset are ignored - * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]); - * - * Note that adding `.any` earlier in the chain causes the `.keys` assertion - * to ignore `.include`. - * - * // Both assertions are identical - * expect({a: 1}).to.include.any.keys('a', 'b'); - * expect({a: 1}).to.have.any.keys('a', 'b'); - * - * The aliases `.includes`, `.contain`, and `.contains` can be used - * interchangeably with `.include`. - * - * @name include - * @alias contain - * @alias includes - * @alias contains - * @param {Mixed} val - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function SameValueZero(a, b) { - return (_.isNaN(a) && _.isNaN(b)) || a === b; - } - - function includeChainingBehavior () { - flag(this, 'contains', true); - } - - function include (val, msg) { - if (msg) flag(this, 'message', msg); - - var obj = flag(this, 'object') - , objType = _.type(obj).toLowerCase() - , flagMsg = flag(this, 'message') - , negate = flag(this, 'negate') - , ssfi = flag(this, 'ssfi') - , isDeep = flag(this, 'deep') - , descriptor = isDeep ? 'deep ' : ''; - - flagMsg = flagMsg ? flagMsg + ': ' : ''; - - var included = false; - - switch (objType) { - case 'string': - included = obj.indexOf(val) !== -1; - break; - - case 'weakset': - if (isDeep) { - throw new AssertionError( - flagMsg + 'unable to use .deep.include with WeakSet', - undefined, - ssfi - ); - } - - included = obj.has(val); - break; - - case 'map': - var isEql = isDeep ? _.eql : SameValueZero; - obj.forEach(function (item) { - included = included || isEql(item, val); - }); - break; - - case 'set': - if (isDeep) { - obj.forEach(function (item) { - included = included || _.eql(item, val); - }); - } else { - included = obj.has(val); - } - break; - - case 'array': - if (isDeep) { - included = obj.some(function (item) { - return _.eql(item, val); - }) - } else { - included = obj.indexOf(val) !== -1; - } - break; - - default: - // This block is for asserting a subset of properties in an object. - // `_.expectTypes` isn't used here because `.include` should work with - // objects with a custom `@@toStringTag`. - if (val !== Object(val)) { - throw new AssertionError( - flagMsg + 'the given combination of arguments (' - + objType + ' and ' - + _.type(val).toLowerCase() + ')' - + ' is invalid for this assertion. ' - + 'You can use an array, a map, an object, a set, a string, ' - + 'or a weakset instead of a ' - + _.type(val).toLowerCase(), - undefined, - ssfi - ); - } - - var props = Object.keys(val) - , firstErr = null - , numErrs = 0; - - props.forEach(function (prop) { - var propAssertion = new Assertion(obj); - _.transferFlags(this, propAssertion, true); - flag(propAssertion, 'lockSsfi', true); - - if (!negate || props.length === 1) { - propAssertion.property(prop, val[prop]); - return; - } - - try { - propAssertion.property(prop, val[prop]); - } catch (err) { - if (!_.checkError.compatibleConstructor(err, AssertionError)) { - throw err; - } - if (firstErr === null) firstErr = err; - numErrs++; - } - }, this); - - // When validating .not.include with multiple properties, we only want - // to throw an assertion error if all of the properties are included, - // in which case we throw the first property assertion error that we - // encountered. - if (negate && props.length > 1 && numErrs === props.length) { - throw firstErr; - } - return; - } - - // Assert inclusion in collection or substring in a string. - this.assert( - included - , 'expected #{this} to ' + descriptor + 'include ' + _.inspect(val) - , 'expected #{this} to not ' + descriptor + 'include ' + _.inspect(val)); - } - - Assertion.addChainableMethod('include', include, includeChainingBehavior); - Assertion.addChainableMethod('contain', include, includeChainingBehavior); - Assertion.addChainableMethod('contains', include, includeChainingBehavior); - Assertion.addChainableMethod('includes', include, includeChainingBehavior); - - /** - * ### .ok - * - * Asserts that the target is a truthy value (considered `true` in boolean context). - * However, it's often best to assert that the target is strictly (`===`) or - * deeply equal to its expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.ok; // Not recommended - * - * expect(true).to.be.true; // Recommended - * expect(true).to.be.ok; // Not recommended - * - * Add `.not` earlier in the chain to negate `.ok`. - * - * expect(0).to.equal(0); // Recommended - * expect(0).to.not.be.ok; // Not recommended - * - * expect(false).to.be.false; // Recommended - * expect(false).to.not.be.ok; // Not recommended - * - * expect(null).to.be.null; // Recommended - * expect(null).to.not.be.ok; // Not recommended - * - * expect(undefined).to.be.undefined; // Recommended - * expect(undefined).to.not.be.ok; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(false, 'nooo why fail??').to.be.ok; - * - * @name ok - * @namespace BDD - * @api public - */ - - Assertion.addProperty('ok', function () { - this.assert( - flag(this, 'object') - , 'expected #{this} to be truthy' - , 'expected #{this} to be falsy'); - }); - - /** - * ### .true - * - * Asserts that the target is strictly (`===`) equal to `true`. - * - * expect(true).to.be.true; - * - * Add `.not` earlier in the chain to negate `.true`. However, it's often best - * to assert that the target is equal to its expected value, rather than not - * equal to `true`. - * - * expect(false).to.be.false; // Recommended - * expect(false).to.not.be.true; // Not recommended - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.true; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(false, 'nooo why fail??').to.be.true; - * - * @name true - * @namespace BDD - * @api public - */ - - Assertion.addProperty('true', function () { - this.assert( - true === flag(this, 'object') - , 'expected #{this} to be true' - , 'expected #{this} to be false' - , flag(this, 'negate') ? false : true - ); - }); - - /** - * ### .false - * - * Asserts that the target is strictly (`===`) equal to `false`. - * - * expect(false).to.be.false; - * - * Add `.not` earlier in the chain to negate `.false`. However, it's often - * best to assert that the target is equal to its expected value, rather than - * not equal to `false`. - * - * expect(true).to.be.true; // Recommended - * expect(true).to.not.be.false; // Not recommended - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.false; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(true, 'nooo why fail??').to.be.false; - * - * @name false - * @namespace BDD - * @api public - */ - - Assertion.addProperty('false', function () { - this.assert( - false === flag(this, 'object') - , 'expected #{this} to be false' - , 'expected #{this} to be true' - , flag(this, 'negate') ? true : false - ); - }); - - /** - * ### .null - * - * Asserts that the target is strictly (`===`) equal to `null`. - * - * expect(null).to.be.null; - * - * Add `.not` earlier in the chain to negate `.null`. However, it's often best - * to assert that the target is equal to its expected value, rather than not - * equal to `null`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.null; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(42, 'nooo why fail??').to.be.null; - * - * @name null - * @namespace BDD - * @api public - */ - - Assertion.addProperty('null', function () { - this.assert( - null === flag(this, 'object') - , 'expected #{this} to be null' - , 'expected #{this} not to be null' - ); - }); - - /** - * ### .undefined - * - * Asserts that the target is strictly (`===`) equal to `undefined`. - * - * expect(undefined).to.be.undefined; - * - * Add `.not` earlier in the chain to negate `.undefined`. However, it's often - * best to assert that the target is equal to its expected value, rather than - * not equal to `undefined`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.undefined; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(42, 'nooo why fail??').to.be.undefined; - * - * @name undefined - * @namespace BDD - * @api public - */ - - Assertion.addProperty('undefined', function () { - this.assert( - undefined === flag(this, 'object') - , 'expected #{this} to be undefined' - , 'expected #{this} not to be undefined' - ); - }); - - /** - * ### .NaN - * - * Asserts that the target is exactly `NaN`. - * - * expect(NaN).to.be.NaN; - * - * Add `.not` earlier in the chain to negate `.NaN`. However, it's often best - * to assert that the target is equal to its expected value, rather than not - * equal to `NaN`. - * - * expect('foo').to.equal('foo'); // Recommended - * expect('foo').to.not.be.NaN; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(42, 'nooo why fail??').to.be.NaN; - * - * @name NaN - * @namespace BDD - * @api public - */ - - Assertion.addProperty('NaN', function () { - this.assert( - _.isNaN(flag(this, 'object')) - , 'expected #{this} to be NaN' - , 'expected #{this} not to be NaN' - ); - }); - - /** - * ### .exist - * - * Asserts that the target is not strictly (`===`) equal to either `null` or - * `undefined`. However, it's often best to assert that the target is equal to - * its expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.exist; // Not recommended - * - * expect(0).to.equal(0); // Recommended - * expect(0).to.exist; // Not recommended - * - * Add `.not` earlier in the chain to negate `.exist`. - * - * expect(null).to.be.null; // Recommended - * expect(null).to.not.exist; // Not recommended - * - * expect(undefined).to.be.undefined; // Recommended - * expect(undefined).to.not.exist; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(null, 'nooo why fail??').to.exist; - * - * The alias `.exists` can be used interchangeably with `.exist`. - * - * @name exist - * @alias exists - * @namespace BDD - * @api public - */ - - function assertExist () { - var val = flag(this, 'object'); - this.assert( - val !== null && val !== undefined - , 'expected #{this} to exist' - , 'expected #{this} to not exist' - ); - } - - Assertion.addProperty('exist', assertExist); - Assertion.addProperty('exists', assertExist); - - /** - * ### .empty - * - * When the target is a string or array, `.empty` asserts that the target's - * `length` property is strictly (`===`) equal to `0`. - * - * expect([]).to.be.empty; - * expect('').to.be.empty; - * - * When the target is a map or set, `.empty` asserts that the target's `size` - * property is strictly equal to `0`. - * - * expect(new Set()).to.be.empty; - * expect(new Map()).to.be.empty; - * - * When the target is a non-function object, `.empty` asserts that the target - * doesn't have any own enumerable properties. Properties with Symbol-based - * keys are excluded from the count. - * - * expect({}).to.be.empty; - * - * Because `.empty` does different things based on the target's type, it's - * important to check the target's type before using `.empty`. See the `.a` - * doc for info on testing a target's type. - * - * expect([]).to.be.an('array').that.is.empty; - * - * Add `.not` earlier in the chain to negate `.empty`. However, it's often - * best to assert that the target contains its expected number of values, - * rather than asserting that it's not empty. - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.not.be.empty; // Not recommended - * - * expect(new Set([1, 2, 3])).to.have.property('size', 3); // Recommended - * expect(new Set([1, 2, 3])).to.not.be.empty; // Not recommended - * - * expect(Object.keys({a: 1})).to.have.lengthOf(1); // Recommended - * expect({a: 1}).to.not.be.empty; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect([1, 2, 3], 'nooo why fail??').to.be.empty; - * - * @name empty - * @namespace BDD - * @api public - */ - - Assertion.addProperty('empty', function () { - var val = flag(this, 'object') - , ssfi = flag(this, 'ssfi') - , flagMsg = flag(this, 'message') - , itemsCount; - - flagMsg = flagMsg ? flagMsg + ': ' : ''; - - switch (_.type(val).toLowerCase()) { - case 'array': - case 'string': - itemsCount = val.length; - break; - case 'map': - case 'set': - itemsCount = val.size; - break; - case 'weakmap': - case 'weakset': - throw new AssertionError( - flagMsg + '.empty was passed a weak collection', - undefined, - ssfi - ); - case 'function': - var msg = flagMsg + '.empty was passed a function ' + _.getName(val); - throw new AssertionError(msg.trim(), undefined, ssfi); - default: - if (val !== Object(val)) { - throw new AssertionError( - flagMsg + '.empty was passed non-string primitive ' + _.inspect(val), - undefined, - ssfi - ); - } - itemsCount = Object.keys(val).length; - } - - this.assert( - 0 === itemsCount - , 'expected #{this} to be empty' - , 'expected #{this} not to be empty' - ); - }); - - /** - * ### .arguments - * - * Asserts that the target is an `arguments` object. - * - * function test () { - * expect(arguments).to.be.arguments; - * } - * - * test(); - * - * Add `.not` earlier in the chain to negate `.arguments`. However, it's often - * best to assert which type the target is expected to be, rather than - * asserting that it’s not an `arguments` object. - * - * expect('foo').to.be.a('string'); // Recommended - * expect('foo').to.not.be.arguments; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({}, 'nooo why fail??').to.be.arguments; - * - * The alias `.Arguments` can be used interchangeably with `.arguments`. - * - * @name arguments - * @alias Arguments - * @namespace BDD - * @api public - */ - - function checkArguments () { - var obj = flag(this, 'object') - , type = _.type(obj); - this.assert( - 'Arguments' === type - , 'expected #{this} to be arguments but got ' + type - , 'expected #{this} to not be arguments' - ); - } - - Assertion.addProperty('arguments', checkArguments); - Assertion.addProperty('Arguments', checkArguments); - - /** - * ### .equal(val[, msg]) - * - * Asserts that the target is strictly (`===`) equal to the given `val`. - * - * expect(1).to.equal(1); - * expect('foo').to.equal('foo'); - * - * Add `.deep` earlier in the chain to use deep equality instead. See the - * `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target object deeply (but not strictly) equals `{a: 1}` - * expect({a: 1}).to.deep.equal({a: 1}); - * expect({a: 1}).to.not.equal({a: 1}); - * - * // Target array deeply (but not strictly) equals `[1, 2]` - * expect([1, 2]).to.deep.equal([1, 2]); - * expect([1, 2]).to.not.equal([1, 2]); - * - * Add `.not` earlier in the chain to negate `.equal`. However, it's often - * best to assert that the target is equal to its expected value, rather than - * not equal to one of countless unexpected values. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.equal(2); // Not recommended - * - * `.equal` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.equal(2, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.equal(2); - * - * The aliases `.equals` and `eq` can be used interchangeably with `.equal`. - * - * @name equal - * @alias equals - * @alias eq - * @param {Mixed} val - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertEqual (val, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'deep')) { - var prevLockSsfi = flag(this, 'lockSsfi'); - flag(this, 'lockSsfi', true); - this.eql(val); - flag(this, 'lockSsfi', prevLockSsfi); - } else { - this.assert( - val === obj - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{exp}' - , val - , this._obj - , true - ); - } - } - - Assertion.addMethod('equal', assertEqual); - Assertion.addMethod('equals', assertEqual); - Assertion.addMethod('eq', assertEqual); - - /** - * ### .eql(obj[, msg]) - * - * Asserts that the target is deeply equal to the given `obj`. See the - * `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target object is deeply (but not strictly) equal to {a: 1} - * expect({a: 1}).to.eql({a: 1}).but.not.equal({a: 1}); - * - * // Target array is deeply (but not strictly) equal to [1, 2] - * expect([1, 2]).to.eql([1, 2]).but.not.equal([1, 2]); - * - * Add `.not` earlier in the chain to negate `.eql`. However, it's often best - * to assert that the target is deeply equal to its expected value, rather - * than not deeply equal to one of countless unexpected values. - * - * expect({a: 1}).to.eql({a: 1}); // Recommended - * expect({a: 1}).to.not.eql({b: 2}); // Not recommended - * - * `.eql` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect({a: 1}).to.eql({b: 2}, 'nooo why fail??'); - * expect({a: 1}, 'nooo why fail??').to.eql({b: 2}); - * - * The alias `.eqls` can be used interchangeably with `.eql`. - * - * The `.deep.equal` assertion is almost identical to `.eql` but with one - * difference: `.deep.equal` causes deep equality comparisons to also be used - * for any other assertions that follow in the chain. - * - * @name eql - * @alias eqls - * @param {Mixed} obj - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertEql(obj, msg) { - if (msg) flag(this, 'message', msg); - this.assert( - _.eql(obj, flag(this, 'object')) - , 'expected #{this} to deeply equal #{exp}' - , 'expected #{this} to not deeply equal #{exp}' - , obj - , this._obj - , true - ); - } - - Assertion.addMethod('eql', assertEql); - Assertion.addMethod('eqls', assertEql); - - /** - * ### .above(n[, msg]) - * - * Asserts that the target is a number or a date greater than the given number or date `n` respectively. - * However, it's often best to assert that the target is equal to its expected - * value. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.be.above(1); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is greater than the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.above(2); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.above(2); // Not recommended - * - * Add `.not` earlier in the chain to negate `.above`. - * - * expect(2).to.equal(2); // Recommended - * expect(1).to.not.be.above(2); // Not recommended - * - * `.above` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.be.above(2, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.above(2); - * - * The aliases `.gt` and `.greaterThan` can be used interchangeably with - * `.above`. - * - * @name above - * @alias gt - * @alias greaterThan - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertAbove (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } - - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to above must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to above must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; - } else { - shouldThrow = false; - } - - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } - - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount > n - , 'expected #{this} to have a ' + descriptor + ' above #{exp} but got #{act}' - , 'expected #{this} to not have a ' + descriptor + ' above #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj > n - , 'expected #{this} to be above #{exp}' - , 'expected #{this} to be at most #{exp}' - , n - ); - } - } - - Assertion.addMethod('above', assertAbove); - Assertion.addMethod('gt', assertAbove); - Assertion.addMethod('greaterThan', assertAbove); - - /** - * ### .least(n[, msg]) - * - * Asserts that the target is a number or a date greater than or equal to the given - * number or date `n` respectively. However, it's often best to assert that the target is equal to - * its expected value. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.be.at.least(1); // Not recommended - * expect(2).to.be.at.least(2); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is greater than or equal to the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.at.least(2); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.at.least(2); // Not recommended - * - * Add `.not` earlier in the chain to negate `.least`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.at.least(2); // Not recommended - * - * `.least` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.be.at.least(2, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.at.least(2); - * - * The aliases `.gte` and `.greaterThanOrEqual` can be used interchangeably with - * `.least`. - * - * @name least - * @alias gte - * @alias greaterThanOrEqual - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertLeast (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } - - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to least must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to least must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; - } else { - shouldThrow = false; - } - - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } - - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount >= n - , 'expected #{this} to have a ' + descriptor + ' at least #{exp} but got #{act}' - , 'expected #{this} to have a ' + descriptor + ' below #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj >= n - , 'expected #{this} to be at least #{exp}' - , 'expected #{this} to be below #{exp}' - , n - ); - } - } - - Assertion.addMethod('least', assertLeast); - Assertion.addMethod('gte', assertLeast); - Assertion.addMethod('greaterThanOrEqual', assertLeast); - - /** - * ### .below(n[, msg]) - * - * Asserts that the target is a number or a date less than the given number or date `n` respectively. - * However, it's often best to assert that the target is equal to its expected - * value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.below(2); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is less than the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.below(4); // Not recommended - * - * expect([1, 2, 3]).to.have.length(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.below(4); // Not recommended - * - * Add `.not` earlier in the chain to negate `.below`. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.not.be.below(1); // Not recommended - * - * `.below` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(2).to.be.below(1, 'nooo why fail??'); - * expect(2, 'nooo why fail??').to.be.below(1); - * - * The aliases `.lt` and `.lessThan` can be used interchangeably with - * `.below`. - * - * @name below - * @alias lt - * @alias lessThan - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertBelow (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } - - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to below must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to below must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; - } else { - shouldThrow = false; - } - - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } - - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount < n - , 'expected #{this} to have a ' + descriptor + ' below #{exp} but got #{act}' - , 'expected #{this} to not have a ' + descriptor + ' below #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj < n - , 'expected #{this} to be below #{exp}' - , 'expected #{this} to be at least #{exp}' - , n - ); - } - } - - Assertion.addMethod('below', assertBelow); - Assertion.addMethod('lt', assertBelow); - Assertion.addMethod('lessThan', assertBelow); - - /** - * ### .most(n[, msg]) - * - * Asserts that the target is a number or a date less than or equal to the given number - * or date `n` respectively. However, it's often best to assert that the target is equal to its - * expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.at.most(2); // Not recommended - * expect(1).to.be.at.most(1); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is less than or equal to the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.at.most(4); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.at.most(4); // Not recommended - * - * Add `.not` earlier in the chain to negate `.most`. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.not.be.at.most(1); // Not recommended - * - * `.most` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(2).to.be.at.most(1, 'nooo why fail??'); - * expect(2, 'nooo why fail??').to.be.at.most(1); - * - * The aliases `.lte` and `.lessThanOrEqual` can be used interchangeably with - * `.most`. - * - * @name most - * @alias lte - * @alias lessThanOrEqual - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertMost (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } - - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to most must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to most must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; - } else { - shouldThrow = false; - } - - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } - - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount <= n - , 'expected #{this} to have a ' + descriptor + ' at most #{exp} but got #{act}' - , 'expected #{this} to have a ' + descriptor + ' above #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj <= n - , 'expected #{this} to be at most #{exp}' - , 'expected #{this} to be above #{exp}' - , n - ); - } - } - - Assertion.addMethod('most', assertMost); - Assertion.addMethod('lte', assertMost); - Assertion.addMethod('lessThanOrEqual', assertMost); - - /** - * ### .within(start, finish[, msg]) - * - * Asserts that the target is a number or a date greater than or equal to the given - * number or date `start`, and less than or equal to the given number or date `finish` respectively. - * However, it's often best to assert that the target is equal to its expected - * value. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.be.within(1, 3); // Not recommended - * expect(2).to.be.within(2, 3); // Not recommended - * expect(2).to.be.within(1, 2); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is greater than or equal to the given number `start`, and less - * than or equal to the given number `finish`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.within(2, 4); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.within(2, 4); // Not recommended - * - * Add `.not` earlier in the chain to negate `.within`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.within(2, 4); // Not recommended - * - * `.within` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(4).to.be.within(1, 3, 'nooo why fail??'); - * expect(4, 'nooo why fail??').to.be.within(1, 3); - * - * @name within - * @param {Number} start lower bound inclusive - * @param {Number} finish upper bound inclusive - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - Assertion.addMethod('within', function (start, finish, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , startType = _.type(start).toLowerCase() - , finishType = _.type(finish).toLowerCase() - , errorMessage - , shouldThrow = true - , range = (startType === 'date' && finishType === 'date') - ? start.toISOString() + '..' + finish.toISOString() - : start + '..' + finish; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } - - if (!doLength && (objType === 'date' && (startType !== 'date' || finishType !== 'date'))) { - errorMessage = msgPrefix + 'the arguments to within must be dates'; - } else if ((startType !== 'number' || finishType !== 'number') && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the arguments to within must be numbers'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; - } else { - shouldThrow = false; - } - - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } - - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount >= start && itemsCount <= finish - , 'expected #{this} to have a ' + descriptor + ' within ' + range - , 'expected #{this} to not have a ' + descriptor + ' within ' + range - ); - } else { - this.assert( - obj >= start && obj <= finish - , 'expected #{this} to be within ' + range - , 'expected #{this} to not be within ' + range - ); - } - }); - - /** - * ### .instanceof(constructor[, msg]) - * - * Asserts that the target is an instance of the given `constructor`. - * - * function Cat () { } - * - * expect(new Cat()).to.be.an.instanceof(Cat); - * expect([1, 2]).to.be.an.instanceof(Array); - * - * Add `.not` earlier in the chain to negate `.instanceof`. - * - * expect({a: 1}).to.not.be.an.instanceof(Array); - * - * `.instanceof` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(1).to.be.an.instanceof(Array, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.an.instanceof(Array); - * - * Due to limitations in ES5, `.instanceof` may not always work as expected - * when using a transpiler such as Babel or TypeScript. In particular, it may - * produce unexpected results when subclassing built-in object such as - * `Array`, `Error`, and `Map`. See your transpiler's docs for details: - * - * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes)) - * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)) - * - * The alias `.instanceOf` can be used interchangeably with `.instanceof`. - * - * @name instanceof - * @param {Constructor} constructor - * @param {String} msg _optional_ - * @alias instanceOf - * @namespace BDD - * @api public - */ - - function assertInstanceOf (constructor, msg) { - if (msg) flag(this, 'message', msg); - - var target = flag(this, 'object') - var ssfi = flag(this, 'ssfi'); - var flagMsg = flag(this, 'message'); - - try { - var isInstanceOf = target instanceof constructor; - } catch (err) { - if (err instanceof TypeError) { - flagMsg = flagMsg ? flagMsg + ': ' : ''; - throw new AssertionError( - flagMsg + 'The instanceof assertion needs a constructor but ' - + _.type(constructor) + ' was given.', - undefined, - ssfi - ); - } - throw err; - } - - var name = _.getName(constructor); - if (name == null) { - name = 'an unnamed constructor'; - } - - this.assert( - isInstanceOf - , 'expected #{this} to be an instance of ' + name - , 'expected #{this} to not be an instance of ' + name - ); - }; - - Assertion.addMethod('instanceof', assertInstanceOf); - Assertion.addMethod('instanceOf', assertInstanceOf); - - /** - * ### .property(name[, val[, msg]]) - * - * Asserts that the target has a property with the given key `name`. - * - * expect({a: 1}).to.have.property('a'); - * - * When `val` is provided, `.property` also asserts that the property's value - * is equal to the given `val`. - * - * expect({a: 1}).to.have.property('a', 1); - * - * By default, strict (`===`) equality is used. Add `.deep` earlier in the - * chain to use deep equality instead. See the `deep-eql` project page for - * info on the deep equality algorithm: https://github.com/chaijs/deep-eql. - * - * // Target object deeply (but not strictly) has property `x: {a: 1}` - * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1}); - * expect({x: {a: 1}}).to.not.have.property('x', {a: 1}); - * - * The target's enumerable and non-enumerable properties are always included - * in the search. By default, both own and inherited properties are included. - * Add `.own` earlier in the chain to exclude inherited properties from the - * search. - * - * Object.prototype.b = 2; - * - * expect({a: 1}).to.have.own.property('a'); - * expect({a: 1}).to.have.own.property('a', 1); - * expect({a: 1}).to.have.property('b'); - * expect({a: 1}).to.not.have.own.property('b'); - * - * `.deep` and `.own` can be combined. - * - * expect({x: {a: 1}}).to.have.deep.own.property('x', {a: 1}); - * - * Add `.nested` earlier in the chain to enable dot- and bracket-notation when - * referencing nested properties. - * - * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]'); - * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]', 'y'); - * - * If `.` or `[]` are part of an actual property name, they can be escaped by - * adding two backslashes before them. - * - * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]'); - * - * `.deep` and `.nested` can be combined. - * - * expect({a: {b: [{c: 3}]}}) - * .to.have.deep.nested.property('a.b[0]', {c: 3}); - * - * `.own` and `.nested` cannot be combined. - * - * Add `.not` earlier in the chain to negate `.property`. - * - * expect({a: 1}).to.not.have.property('b'); - * - * However, it's dangerous to negate `.property` when providing `val`. The - * problem is that it creates uncertain expectations by asserting that the - * target either doesn't have a property with the given key `name`, or that it - * does have a property with the given key `name` but its value isn't equal to - * the given `val`. It's often best to identify the exact output that's - * expected, and then write an assertion that only accepts that exact output. - * - * When the target isn't expected to have a property with the given key - * `name`, it's often best to assert exactly that. - * - * expect({b: 2}).to.not.have.property('a'); // Recommended - * expect({b: 2}).to.not.have.property('a', 1); // Not recommended - * - * When the target is expected to have a property with the given key `name`, - * it's often best to assert that the property has its expected value, rather - * than asserting that it doesn't have one of many unexpected values. - * - * expect({a: 3}).to.have.property('a', 3); // Recommended - * expect({a: 3}).to.not.have.property('a', 1); // Not recommended - * - * `.property` changes the target of any assertions that follow in the chain - * to be the value of the property from the original target object. - * - * expect({a: 1}).to.have.property('a').that.is.a('number'); - * - * `.property` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing `val`, only use the - * second form. - * - * // Recommended - * expect({a: 1}).to.have.property('a', 2, 'nooo why fail??'); - * expect({a: 1}, 'nooo why fail??').to.have.property('a', 2); - * expect({a: 1}, 'nooo why fail??').to.have.property('b'); - * - * // Not recommended - * expect({a: 1}).to.have.property('b', undefined, 'nooo why fail??'); - * - * The above assertion isn't the same thing as not providing `val`. Instead, - * it's asserting that the target object has a `b` property that's equal to - * `undefined`. - * - * The assertions `.ownProperty` and `.haveOwnProperty` can be used - * interchangeably with `.own.property`. - * - * @name property - * @param {String} name - * @param {Mixed} val (optional) - * @param {String} msg _optional_ - * @returns value of property for chaining - * @namespace BDD - * @api public - */ - - function assertProperty (name, val, msg) { - if (msg) flag(this, 'message', msg); - - var isNested = flag(this, 'nested') - , isOwn = flag(this, 'own') - , flagMsg = flag(this, 'message') - , obj = flag(this, 'object') - , ssfi = flag(this, 'ssfi') - , nameType = typeof name; - - flagMsg = flagMsg ? flagMsg + ': ' : ''; - - if (isNested) { - if (nameType !== 'string') { - throw new AssertionError( - flagMsg + 'the argument to property must be a string when using nested syntax', - undefined, - ssfi - ); - } - } else { - if (nameType !== 'string' && nameType !== 'number' && nameType !== 'symbol') { - throw new AssertionError( - flagMsg + 'the argument to property must be a string, number, or symbol', - undefined, - ssfi - ); - } - } - - if (isNested && isOwn) { - throw new AssertionError( - flagMsg + 'The "nested" and "own" flags cannot be combined.', - undefined, - ssfi - ); - } - - if (obj === null || obj === undefined) { - throw new AssertionError( - flagMsg + 'Target cannot be null or undefined.', - undefined, - ssfi - ); - } - - var isDeep = flag(this, 'deep') - , negate = flag(this, 'negate') - , pathInfo = isNested ? _.getPathInfo(obj, name) : null - , value = isNested ? pathInfo.value : obj[name]; - - var descriptor = ''; - if (isDeep) descriptor += 'deep '; - if (isOwn) descriptor += 'own '; - if (isNested) descriptor += 'nested '; - descriptor += 'property '; - - var hasProperty; - if (isOwn) hasProperty = Object.prototype.hasOwnProperty.call(obj, name); - else if (isNested) hasProperty = pathInfo.exists; - else hasProperty = _.hasProperty(obj, name); - - // When performing a negated assertion for both name and val, merely having - // a property with the given name isn't enough to cause the assertion to - // fail. It must both have a property with the given name, and the value of - // that property must equal the given val. Therefore, skip this assertion in - // favor of the next. - if (!negate || arguments.length === 1) { - this.assert( - hasProperty - , 'expected #{this} to have ' + descriptor + _.inspect(name) - , 'expected #{this} to not have ' + descriptor + _.inspect(name)); - } - - if (arguments.length > 1) { - this.assert( - hasProperty && (isDeep ? _.eql(val, value) : val === value) - , 'expected #{this} to have ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}' - , 'expected #{this} to not have ' + descriptor + _.inspect(name) + ' of #{act}' - , val - , value - ); - } - - flag(this, 'object', value); - } - - Assertion.addMethod('property', assertProperty); - - function assertOwnProperty (name, value, msg) { - flag(this, 'own', true); - assertProperty.apply(this, arguments); - } - - Assertion.addMethod('ownProperty', assertOwnProperty); - Assertion.addMethod('haveOwnProperty', assertOwnProperty); - - /** - * ### .ownPropertyDescriptor(name[, descriptor[, msg]]) - * - * Asserts that the target has its own property descriptor with the given key - * `name`. Enumerable and non-enumerable properties are included in the - * search. - * - * expect({a: 1}).to.have.ownPropertyDescriptor('a'); - * - * When `descriptor` is provided, `.ownPropertyDescriptor` also asserts that - * the property's descriptor is deeply equal to the given `descriptor`. See - * the `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * expect({a: 1}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, - * }); - * - * Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`. - * - * expect({a: 1}).to.not.have.ownPropertyDescriptor('b'); - * - * However, it's dangerous to negate `.ownPropertyDescriptor` when providing - * a `descriptor`. The problem is that it creates uncertain expectations by - * asserting that the target either doesn't have a property descriptor with - * the given key `name`, or that it does have a property descriptor with the - * given key `name` but it’s not deeply equal to the given `descriptor`. It's - * often best to identify the exact output that's expected, and then write an - * assertion that only accepts that exact output. - * - * When the target isn't expected to have a property descriptor with the given - * key `name`, it's often best to assert exactly that. - * - * // Recommended - * expect({b: 2}).to.not.have.ownPropertyDescriptor('a'); - * - * // Not recommended - * expect({b: 2}).to.not.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, - * }); - * - * When the target is expected to have a property descriptor with the given - * key `name`, it's often best to assert that the property has its expected - * descriptor, rather than asserting that it doesn't have one of many - * unexpected descriptors. - * - * // Recommended - * expect({a: 3}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 3, - * }); - * - * // Not recommended - * expect({a: 3}).to.not.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, - * }); - * - * `.ownPropertyDescriptor` changes the target of any assertions that follow - * in the chain to be the value of the property descriptor from the original - * target object. - * - * expect({a: 1}).to.have.ownPropertyDescriptor('a') - * .that.has.property('enumerable', true); - * - * `.ownPropertyDescriptor` accepts an optional `msg` argument which is a - * custom error message to show when the assertion fails. The message can also - * be given as the second argument to `expect`. When not providing - * `descriptor`, only use the second form. - * - * // Recommended - * expect({a: 1}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 2, - * }, 'nooo why fail??'); - * - * // Recommended - * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 2, - * }); - * - * // Recommended - * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b'); - * - * // Not recommended - * expect({a: 1}) - * .to.have.ownPropertyDescriptor('b', undefined, 'nooo why fail??'); - * - * The above assertion isn't the same thing as not providing `descriptor`. - * Instead, it's asserting that the target object has a `b` property - * descriptor that's deeply equal to `undefined`. - * - * The alias `.haveOwnPropertyDescriptor` can be used interchangeably with - * `.ownPropertyDescriptor`. - * - * @name ownPropertyDescriptor - * @alias haveOwnPropertyDescriptor - * @param {String} name - * @param {Object} descriptor _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertOwnPropertyDescriptor (name, descriptor, msg) { - if (typeof descriptor === 'string') { - msg = descriptor; - descriptor = null; - } - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); - if (actualDescriptor && descriptor) { - this.assert( - _.eql(descriptor, actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor) - , descriptor - , actualDescriptor - , true - ); - } else { - this.assert( - actualDescriptor - , 'expected #{this} to have an own property descriptor for ' + _.inspect(name) - , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name) - ); - } - flag(this, 'object', actualDescriptor); - } - - Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); - Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); - - /** - * ### .lengthOf(n[, msg]) - * - * Asserts that the target's `length` or `size` is equal to the given number - * `n`. - * - * expect([1, 2, 3]).to.have.lengthOf(3); - * expect('foo').to.have.lengthOf(3); - * expect(new Set([1, 2, 3])).to.have.lengthOf(3); - * expect(new Map([['a', 1], ['b', 2], ['c', 3]])).to.have.lengthOf(3); - * - * Add `.not` earlier in the chain to negate `.lengthOf`. However, it's often - * best to assert that the target's `length` property is equal to its expected - * value, rather than not equal to one of many unexpected values. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.not.have.lengthOf(4); // Not recommended - * - * `.lengthOf` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect([1, 2, 3]).to.have.lengthOf(2, 'nooo why fail??'); - * expect([1, 2, 3], 'nooo why fail??').to.have.lengthOf(2); - * - * `.lengthOf` can also be used as a language chain, causing all `.above`, - * `.below`, `.least`, `.most`, and `.within` assertions that follow in the - * chain to use the target's `length` property as the target. However, it's - * often best to assert that the target's `length` property is equal to its - * expected length, rather than asserting that its `length` property falls - * within some range of values. - * - * // Recommended - * expect([1, 2, 3]).to.have.lengthOf(3); - * - * // Not recommended - * expect([1, 2, 3]).to.have.lengthOf.above(2); - * expect([1, 2, 3]).to.have.lengthOf.below(4); - * expect([1, 2, 3]).to.have.lengthOf.at.least(3); - * expect([1, 2, 3]).to.have.lengthOf.at.most(3); - * expect([1, 2, 3]).to.have.lengthOf.within(2,4); - * - * Due to a compatibility issue, the alias `.length` can't be chained directly - * off of an uninvoked method such as `.a`. Therefore, `.length` can't be used - * interchangeably with `.lengthOf` in every situation. It's recommended to - * always use `.lengthOf` instead of `.length`. - * - * expect([1, 2, 3]).to.have.a.length(3); // incompatible; throws error - * expect([1, 2, 3]).to.have.a.lengthOf(3); // passes as expected - * - * @name lengthOf - * @alias length - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertLengthChain () { - flag(this, 'doLength', true); - } - - function assertLength (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , objType = _.type(obj).toLowerCase() - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi') - , descriptor = 'length' - , itemsCount; - - switch (objType) { - case 'map': - case 'set': - descriptor = 'size'; - itemsCount = obj.size; - break; - default: - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - itemsCount = obj.length; - } - - this.assert( - itemsCount == n - , 'expected #{this} to have a ' + descriptor + ' of #{exp} but got #{act}' - , 'expected #{this} to not have a ' + descriptor + ' of #{act}' - , n - , itemsCount - ); - } - - Assertion.addChainableMethod('length', assertLength, assertLengthChain); - Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain); - - /** - * ### .match(re[, msg]) - * - * Asserts that the target matches the given regular expression `re`. - * - * expect('foobar').to.match(/^foo/); - * - * Add `.not` earlier in the chain to negate `.match`. - * - * expect('foobar').to.not.match(/taco/); - * - * `.match` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect('foobar').to.match(/taco/, 'nooo why fail??'); - * expect('foobar', 'nooo why fail??').to.match(/taco/); - * - * The alias `.matches` can be used interchangeably with `.match`. - * - * @name match - * @alias matches - * @param {RegExp} re - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - function assertMatch(re, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - this.assert( - re.exec(obj) - , 'expected #{this} to match ' + re - , 'expected #{this} not to match ' + re - ); - } - - Assertion.addMethod('match', assertMatch); - Assertion.addMethod('matches', assertMatch); - - /** - * ### .string(str[, msg]) - * - * Asserts that the target string contains the given substring `str`. - * - * expect('foobar').to.have.string('bar'); - * - * Add `.not` earlier in the chain to negate `.string`. - * - * expect('foobar').to.not.have.string('taco'); - * - * `.string` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect('foobar').to.have.string('taco', 'nooo why fail??'); - * expect('foobar', 'nooo why fail??').to.have.string('taco'); - * - * @name string - * @param {String} str - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - Assertion.addMethod('string', function (str, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(obj, flagMsg, ssfi, true).is.a('string'); - - this.assert( - ~obj.indexOf(str) - , 'expected #{this} to contain ' + _.inspect(str) - , 'expected #{this} to not contain ' + _.inspect(str) - ); - }); - - /** - * ### .keys(key1[, key2[, ...]]) - * - * Asserts that the target object, array, map, or set has the given keys. Only - * the target's own inherited properties are included in the search. - * - * When the target is an object or array, keys can be provided as one or more - * string arguments, a single array argument, or a single object argument. In - * the latter case, only the keys in the given object matter; the values are - * ignored. - * - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); - * expect(['x', 'y']).to.have.all.keys(0, 1); - * - * expect({a: 1, b: 2}).to.have.all.keys(['a', 'b']); - * expect(['x', 'y']).to.have.all.keys([0, 1]); - * - * expect({a: 1, b: 2}).to.have.all.keys({a: 4, b: 5}); // ignore 4 and 5 - * expect(['x', 'y']).to.have.all.keys({0: 4, 1: 5}); // ignore 4 and 5 - * - * When the target is a map or set, each key must be provided as a separate - * argument. - * - * expect(new Map([['a', 1], ['b', 2]])).to.have.all.keys('a', 'b'); - * expect(new Set(['a', 'b'])).to.have.all.keys('a', 'b'); - * - * Because `.keys` does different things based on the target's type, it's - * important to check the target's type before using `.keys`. See the `.a` doc - * for info on testing a target's type. - * - * expect({a: 1, b: 2}).to.be.an('object').that.has.all.keys('a', 'b'); - * - * By default, strict (`===`) equality is used to compare keys of maps and - * sets. Add `.deep` earlier in the chain to use deep equality instead. See - * the `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target set deeply (but not strictly) has key `{a: 1}` - * expect(new Set([{a: 1}])).to.have.all.deep.keys([{a: 1}]); - * expect(new Set([{a: 1}])).to.not.have.all.keys([{a: 1}]); - * - * By default, the target must have all of the given keys and no more. Add - * `.any` earlier in the chain to only require that the target have at least - * one of the given keys. Also, add `.not` earlier in the chain to negate - * `.keys`. It's often best to add `.any` when negating `.keys`, and to use - * `.all` when asserting `.keys` without negation. - * - * When negating `.keys`, `.any` is preferred because `.not.any.keys` asserts - * exactly what's expected of the output, whereas `.not.all.keys` creates - * uncertain expectations. - * - * // Recommended; asserts that target doesn't have any of the given keys - * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd'); - * - * // Not recommended; asserts that target doesn't have all of the given - * // keys but may or may not have some of them - * expect({a: 1, b: 2}).to.not.have.all.keys('c', 'd'); - * - * When asserting `.keys` without negation, `.all` is preferred because - * `.all.keys` asserts exactly what's expected of the output, whereas - * `.any.keys` creates uncertain expectations. - * - * // Recommended; asserts that target has all the given keys - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); - * - * // Not recommended; asserts that target has at least one of the given - * // keys but may or may not have more of them - * expect({a: 1, b: 2}).to.have.any.keys('a', 'b'); - * - * Note that `.all` is used by default when neither `.all` nor `.any` appear - * earlier in the chain. However, it's often best to add `.all` anyway because - * it improves readability. - * - * // Both assertions are identical - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); // Recommended - * expect({a: 1, b: 2}).to.have.keys('a', 'b'); // Not recommended - * - * Add `.include` earlier in the chain to require that the target's keys be a - * superset of the expected keys, rather than identical sets. - * - * // Target object's keys are a superset of ['a', 'b'] but not identical - * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b'); - * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b'); - * - * However, if `.any` and `.include` are combined, only the `.any` takes - * effect. The `.include` is ignored in this case. - * - * // Both assertions are identical - * expect({a: 1}).to.have.any.keys('a', 'b'); - * expect({a: 1}).to.include.any.keys('a', 'b'); - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({a: 1}, 'nooo why fail??').to.have.key('b'); - * - * The alias `.key` can be used interchangeably with `.keys`. - * - * @name keys - * @alias key - * @param {...String|Array|Object} keys - * @namespace BDD - * @api public - */ - - function assertKeys (keys) { - var obj = flag(this, 'object') - , objType = _.type(obj) - , keysType = _.type(keys) - , ssfi = flag(this, 'ssfi') - , isDeep = flag(this, 'deep') - , str - , deepStr = '' - , actual - , ok = true - , flagMsg = flag(this, 'message'); - - flagMsg = flagMsg ? flagMsg + ': ' : ''; - var mixedArgsMsg = flagMsg + 'when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments'; - - if (objType === 'Map' || objType === 'Set') { - deepStr = isDeep ? 'deeply ' : ''; - actual = []; - - // Map and Set '.keys' aren't supported in IE 11. Therefore, use .forEach. - obj.forEach(function (val, key) { actual.push(key) }); - - if (keysType !== 'Array') { - keys = Array.prototype.slice.call(arguments); - } - } else { - actual = _.getOwnEnumerableProperties(obj); - - switch (keysType) { - case 'Array': - if (arguments.length > 1) { - throw new AssertionError(mixedArgsMsg, undefined, ssfi); - } - break; - case 'Object': - if (arguments.length > 1) { - throw new AssertionError(mixedArgsMsg, undefined, ssfi); - } - keys = Object.keys(keys); - break; - default: - keys = Array.prototype.slice.call(arguments); - } - - // Only stringify non-Symbols because Symbols would become "Symbol()" - keys = keys.map(function (val) { - return typeof val === 'symbol' ? val : String(val); - }); - } - - if (!keys.length) { - throw new AssertionError(flagMsg + 'keys required', undefined, ssfi); - } - - var len = keys.length - , any = flag(this, 'any') - , all = flag(this, 'all') - , expected = keys; - - if (!any && !all) { - all = true; - } - - // Has any - if (any) { - ok = expected.some(function(expectedKey) { - return actual.some(function(actualKey) { - if (isDeep) { - return _.eql(expectedKey, actualKey); - } else { - return expectedKey === actualKey; - } - }); - }); - } - - // Has all - if (all) { - ok = expected.every(function(expectedKey) { - return actual.some(function(actualKey) { - if (isDeep) { - return _.eql(expectedKey, actualKey); - } else { - return expectedKey === actualKey; - } - }); - }); - - if (!flag(this, 'contains')) { - ok = ok && keys.length == actual.length; - } - } - - // Key string - if (len > 1) { - keys = keys.map(function(key) { - return _.inspect(key); - }); - var last = keys.pop(); - if (all) { - str = keys.join(', ') + ', and ' + last; - } - if (any) { - str = keys.join(', ') + ', or ' + last; - } - } else { - str = _.inspect(keys[0]); - } - - // Form - str = (len > 1 ? 'keys ' : 'key ') + str; - - // Have / include - str = (flag(this, 'contains') ? 'contain ' : 'have ') + str; - - // Assertion - this.assert( - ok - , 'expected #{this} to ' + deepStr + str - , 'expected #{this} to not ' + deepStr + str - , expected.slice(0).sort(_.compareByInspect) - , actual.sort(_.compareByInspect) - , true - ); - } - - Assertion.addMethod('keys', assertKeys); - Assertion.addMethod('key', assertKeys); - - /** - * ### .throw([errorLike], [errMsgMatcher], [msg]) - * - * When no arguments are provided, `.throw` invokes the target function and - * asserts that an error is thrown. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(); - * - * When one argument is provided, and it's an error constructor, `.throw` - * invokes the target function and asserts that an error is thrown that's an - * instance of that error constructor. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(TypeError); - * - * When one argument is provided, and it's an error instance, `.throw` invokes - * the target function and asserts that an error is thrown that's strictly - * (`===`) equal to that error instance. - * - * var err = new TypeError('Illegal salmon!'); - * var badFn = function () { throw err; }; - * - * expect(badFn).to.throw(err); - * - * When one argument is provided, and it's a string, `.throw` invokes the - * target function and asserts that an error is thrown with a message that - * contains that string. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw('salmon'); - * - * When one argument is provided, and it's a regular expression, `.throw` - * invokes the target function and asserts that an error is thrown with a - * message that matches that regular expression. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(/salmon/); - * - * When two arguments are provided, and the first is an error instance or - * constructor, and the second is a string or regular expression, `.throw` - * invokes the function and asserts that an error is thrown that fulfills both - * conditions as described above. - * - * var err = new TypeError('Illegal salmon!'); - * var badFn = function () { throw err; }; - * - * expect(badFn).to.throw(TypeError, 'salmon'); - * expect(badFn).to.throw(TypeError, /salmon/); - * expect(badFn).to.throw(err, 'salmon'); - * expect(badFn).to.throw(err, /salmon/); - * - * Add `.not` earlier in the chain to negate `.throw`. - * - * var goodFn = function () {}; - * - * expect(goodFn).to.not.throw(); - * - * However, it's dangerous to negate `.throw` when providing any arguments. - * The problem is that it creates uncertain expectations by asserting that the - * target either doesn't throw an error, or that it throws an error but of a - * different type than the given type, or that it throws an error of the given - * type but with a message that doesn't include the given string. It's often - * best to identify the exact output that's expected, and then write an - * assertion that only accepts that exact output. - * - * When the target isn't expected to throw an error, it's often best to assert - * exactly that. - * - * var goodFn = function () {}; - * - * expect(goodFn).to.not.throw(); // Recommended - * expect(goodFn).to.not.throw(ReferenceError, 'x'); // Not recommended - * - * When the target is expected to throw an error, it's often best to assert - * that the error is of its expected type, and has a message that includes an - * expected string, rather than asserting that it doesn't have one of many - * unexpected types, and doesn't have a message that includes some string. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(TypeError, 'salmon'); // Recommended - * expect(badFn).to.not.throw(ReferenceError, 'x'); // Not recommended - * - * `.throw` changes the target of any assertions that follow in the chain to - * be the error object that's thrown. - * - * var err = new TypeError('Illegal salmon!'); - * err.code = 42; - * var badFn = function () { throw err; }; - * - * expect(badFn).to.throw(TypeError).with.property('code', 42); - * - * `.throw` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. When not providing two arguments, always use - * the second form. - * - * var goodFn = function () {}; - * - * expect(goodFn).to.throw(TypeError, 'x', 'nooo why fail??'); - * expect(goodFn, 'nooo why fail??').to.throw(); - * - * Due to limitations in ES5, `.throw` may not always work as expected when - * using a transpiler such as Babel or TypeScript. In particular, it may - * produce unexpected results when subclassing the built-in `Error` object and - * then passing the subclassed constructor to `.throw`. See your transpiler's - * docs for details: - * - * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes)) - * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)) - * - * Beware of some common mistakes when using the `throw` assertion. One common - * mistake is to accidentally invoke the function yourself instead of letting - * the `throw` assertion invoke the function for you. For example, when - * testing if a function named `fn` throws, provide `fn` instead of `fn()` as - * the target for the assertion. - * - * expect(fn).to.throw(); // Good! Tests `fn` as desired - * expect(fn()).to.throw(); // Bad! Tests result of `fn()`, not `fn` - * - * If you need to assert that your function `fn` throws when passed certain - * arguments, then wrap a call to `fn` inside of another function. - * - * expect(function () { fn(42); }).to.throw(); // Function expression - * expect(() => fn(42)).to.throw(); // ES6 arrow function - * - * Another common mistake is to provide an object method (or any stand-alone - * function that relies on `this`) as the target of the assertion. Doing so is - * problematic because the `this` context will be lost when the function is - * invoked by `.throw`; there's no way for it to know what `this` is supposed - * to be. There are two ways around this problem. One solution is to wrap the - * method or function call inside of another function. Another solution is to - * use `bind`. - * - * expect(function () { cat.meow(); }).to.throw(); // Function expression - * expect(() => cat.meow()).to.throw(); // ES6 arrow function - * expect(cat.meow.bind(cat)).to.throw(); // Bind - * - * Finally, it's worth mentioning that it's a best practice in JavaScript to - * only throw `Error` and derivatives of `Error` such as `ReferenceError`, - * `TypeError`, and user-defined objects that extend `Error`. No other type of - * value will generate a stack trace when initialized. With that said, the - * `throw` assertion does technically support any type of value being thrown, - * not just `Error` and its derivatives. - * - * The aliases `.throws` and `.Throw` can be used interchangeably with - * `.throw`. - * - * @name throw - * @alias throws - * @alias Throw - * @param {Error|ErrorConstructor} errorLike - * @param {String|RegExp} errMsgMatcher error message - * @param {String} msg _optional_ - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @returns error for chaining (null if no error) - * @namespace BDD - * @api public - */ - - function assertThrows (errorLike, errMsgMatcher, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , ssfi = flag(this, 'ssfi') - , flagMsg = flag(this, 'message') - , negate = flag(this, 'negate') || false; - new Assertion(obj, flagMsg, ssfi, true).is.a('function'); - - if (errorLike instanceof RegExp || typeof errorLike === 'string') { - errMsgMatcher = errorLike; - errorLike = null; - } - - var caughtErr; - try { - obj(); - } catch (err) { - caughtErr = err; - } - - // If we have the negate flag enabled and at least one valid argument it means we do expect an error - // but we want it to match a given set of criteria - var everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined; - - // If we've got the negate flag enabled and both args, we should only fail if both aren't compatible - // See Issue #551 and PR #683@GitHub - var everyArgIsDefined = Boolean(errorLike && errMsgMatcher); - var errorLikeFail = false; - var errMsgMatcherFail = false; - - // Checking if error was thrown - if (everyArgIsUndefined || !everyArgIsUndefined && !negate) { - // We need this to display results correctly according to their types - var errorLikeString = 'an error'; - if (errorLike instanceof Error) { - errorLikeString = '#{exp}'; - } else if (errorLike) { - errorLikeString = _.checkError.getConstructorName(errorLike); - } - - this.assert( - caughtErr - , 'expected #{this} to throw ' + errorLikeString - , 'expected #{this} to not throw an error but #{act} was thrown' - , errorLike && errorLike.toString() - , (caughtErr instanceof Error ? - caughtErr.toString() : (typeof caughtErr === 'string' ? caughtErr : caughtErr && - _.checkError.getConstructorName(caughtErr))) - ); - } - - if (errorLike && caughtErr) { - // We should compare instances only if `errorLike` is an instance of `Error` - if (errorLike instanceof Error) { - var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike); - - if (isCompatibleInstance === negate) { - // These checks were created to ensure we won't fail too soon when we've got both args and a negate - // See Issue #551 and PR #683@GitHub - if (everyArgIsDefined && negate) { - errorLikeFail = true; - } else { - this.assert( - negate - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' + (caughtErr && !negate ? ' but #{act} was thrown' : '') - , errorLike.toString() - , caughtErr.toString() - ); - } - } - } - - var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike); - if (isCompatibleConstructor === negate) { - if (everyArgIsDefined && negate) { - errorLikeFail = true; - } else { - this.assert( - negate - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '') - , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike)) - , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr)) - ); - } - } - } - - if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) { - // Here we check compatible messages - var placeholder = 'including'; - if (errMsgMatcher instanceof RegExp) { - placeholder = 'matching' - } - - var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher); - if (isCompatibleMessage === negate) { - if (everyArgIsDefined && negate) { - errMsgMatcherFail = true; - } else { - this.assert( - negate - , 'expected #{this} to throw error ' + placeholder + ' #{exp} but got #{act}' - , 'expected #{this} to throw error not ' + placeholder + ' #{exp}' - , errMsgMatcher - , _.checkError.getMessage(caughtErr) - ); - } - } - } - - // If both assertions failed and both should've matched we throw an error - if (errorLikeFail && errMsgMatcherFail) { - this.assert( - negate - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '') - , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike)) - , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr)) - ); - } - - flag(this, 'object', caughtErr); - }; - - Assertion.addMethod('throw', assertThrows); - Assertion.addMethod('throws', assertThrows); - Assertion.addMethod('Throw', assertThrows); - - /** - * ### .respondTo(method[, msg]) - * - * When the target is a non-function object, `.respondTo` asserts that the - * target has a method with the given name `method`. The method can be own or - * inherited, and it can be enumerable or non-enumerable. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * - * expect(new Cat()).to.respondTo('meow'); - * - * When the target is a function, `.respondTo` asserts that the target's - * `prototype` property has a method with the given name `method`. Again, the - * method can be own or inherited, and it can be enumerable or non-enumerable. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * - * expect(Cat).to.respondTo('meow'); - * - * Add `.itself` earlier in the chain to force `.respondTo` to treat the - * target as a non-function object, even if it's a function. Thus, it asserts - * that the target has a method with the given name `method`, rather than - * asserting that the target's `prototype` property has a method with the - * given name `method`. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * Cat.hiss = function () {}; - * - * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow'); - * - * When not adding `.itself`, it's important to check the target's type before - * using `.respondTo`. See the `.a` doc for info on checking a target's type. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * - * expect(new Cat()).to.be.an('object').that.respondsTo('meow'); - * - * Add `.not` earlier in the chain to negate `.respondTo`. - * - * function Dog () {} - * Dog.prototype.bark = function () {}; - * - * expect(new Dog()).to.not.respondTo('meow'); - * - * `.respondTo` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect({}).to.respondTo('meow', 'nooo why fail??'); - * expect({}, 'nooo why fail??').to.respondTo('meow'); - * - * The alias `.respondsTo` can be used interchangeably with `.respondTo`. - * - * @name respondTo - * @alias respondsTo - * @param {String} method - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function respondTo (method, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , itself = flag(this, 'itself') - , context = ('function' === typeof obj && !itself) - ? obj.prototype[method] - : obj[method]; - - this.assert( - 'function' === typeof context - , 'expected #{this} to respond to ' + _.inspect(method) - , 'expected #{this} to not respond to ' + _.inspect(method) - ); - } - - Assertion.addMethod('respondTo', respondTo); - Assertion.addMethod('respondsTo', respondTo); - - /** - * ### .itself - * - * Forces all `.respondTo` assertions that follow in the chain to behave as if - * the target is a non-function object, even if it's a function. Thus, it - * causes `.respondTo` to assert that the target has a method with the given - * name, rather than asserting that the target's `prototype` property has a - * method with the given name. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * Cat.hiss = function () {}; - * - * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow'); - * - * @name itself - * @namespace BDD - * @api public - */ - - Assertion.addProperty('itself', function () { - flag(this, 'itself', true); - }); - - /** - * ### .satisfy(matcher[, msg]) - * - * Invokes the given `matcher` function with the target being passed as the - * first argument, and asserts that the value returned is truthy. - * - * expect(1).to.satisfy(function(num) { - * return num > 0; - * }); - * - * Add `.not` earlier in the chain to negate `.satisfy`. - * - * expect(1).to.not.satisfy(function(num) { - * return num > 2; - * }); - * - * `.satisfy` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(1).to.satisfy(function(num) { - * return num > 2; - * }, 'nooo why fail??'); - * - * expect(1, 'nooo why fail??').to.satisfy(function(num) { - * return num > 2; - * }); - * - * The alias `.satisfies` can be used interchangeably with `.satisfy`. - * - * @name satisfy - * @alias satisfies - * @param {Function} matcher - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function satisfy (matcher, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var result = matcher(obj); - this.assert( - result - , 'expected #{this} to satisfy ' + _.objDisplay(matcher) - , 'expected #{this} to not satisfy' + _.objDisplay(matcher) - , flag(this, 'negate') ? false : true - , result - ); - } - - Assertion.addMethod('satisfy', satisfy); - Assertion.addMethod('satisfies', satisfy); - - /** - * ### .closeTo(expected, delta[, msg]) - * - * Asserts that the target is a number that's within a given +/- `delta` range - * of the given number `expected`. However, it's often best to assert that the - * target is equal to its expected value. - * - * // Recommended - * expect(1.5).to.equal(1.5); - * - * // Not recommended - * expect(1.5).to.be.closeTo(1, 0.5); - * expect(1.5).to.be.closeTo(2, 0.5); - * expect(1.5).to.be.closeTo(1, 1); - * - * Add `.not` earlier in the chain to negate `.closeTo`. - * - * expect(1.5).to.equal(1.5); // Recommended - * expect(1.5).to.not.be.closeTo(3, 1); // Not recommended - * - * `.closeTo` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(1.5).to.be.closeTo(3, 1, 'nooo why fail??'); - * expect(1.5, 'nooo why fail??').to.be.closeTo(3, 1); - * - * The alias `.approximately` can be used interchangeably with `.closeTo`. - * - * @name closeTo - * @alias approximately - * @param {Number} expected - * @param {Number} delta - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function closeTo(expected, delta, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - - new Assertion(obj, flagMsg, ssfi, true).is.a('number'); - if (typeof expected !== 'number' || typeof delta !== 'number') { - flagMsg = flagMsg ? flagMsg + ': ' : ''; - var deltaMessage = delta === undefined ? ", and a delta is required" : ""; - throw new AssertionError( - flagMsg + 'the arguments to closeTo or approximately must be numbers' + deltaMessage, - undefined, - ssfi - ); - } - - this.assert( - Math.abs(obj - expected) <= delta - , 'expected #{this} to be close to ' + expected + ' +/- ' + delta - , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta - ); - } - - Assertion.addMethod('closeTo', closeTo); - Assertion.addMethod('approximately', closeTo); - - // Note: Duplicates are ignored if testing for inclusion instead of sameness. - function isSubsetOf(subset, superset, cmp, contains, ordered) { - if (!contains) { - if (subset.length !== superset.length) return false; - superset = superset.slice(); - } - - return subset.every(function(elem, idx) { - if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx]; - - if (!cmp) { - var matchIdx = superset.indexOf(elem); - if (matchIdx === -1) return false; - - // Remove match from superset so not counted twice if duplicate in subset. - if (!contains) superset.splice(matchIdx, 1); - return true; - } - - return superset.some(function(elem2, matchIdx) { - if (!cmp(elem, elem2)) return false; - - // Remove match from superset so not counted twice if duplicate in subset. - if (!contains) superset.splice(matchIdx, 1); - return true; - }); - }); - } - - /** - * ### .members(set[, msg]) - * - * Asserts that the target array has the same members as the given array - * `set`. - * - * expect([1, 2, 3]).to.have.members([2, 1, 3]); - * expect([1, 2, 2]).to.have.members([2, 1, 2]); - * - * By default, members are compared using strict (`===`) equality. Add `.deep` - * earlier in the chain to use deep equality instead. See the `deep-eql` - * project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target array deeply (but not strictly) has member `{a: 1}` - * expect([{a: 1}]).to.have.deep.members([{a: 1}]); - * expect([{a: 1}]).to.not.have.members([{a: 1}]); - * - * By default, order doesn't matter. Add `.ordered` earlier in the chain to - * require that members appear in the same order. - * - * expect([1, 2, 3]).to.have.ordered.members([1, 2, 3]); - * expect([1, 2, 3]).to.have.members([2, 1, 3]) - * .but.not.ordered.members([2, 1, 3]); - * - * By default, both arrays must be the same size. Add `.include` earlier in - * the chain to require that the target's members be a superset of the - * expected members. Note that duplicates are ignored in the subset when - * `.include` is added. - * - * // Target array is a superset of [1, 2] but not identical - * expect([1, 2, 3]).to.include.members([1, 2]); - * expect([1, 2, 3]).to.not.have.members([1, 2]); - * - * // Duplicates in the subset are ignored - * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]); - * - * `.deep`, `.ordered`, and `.include` can all be combined. However, if - * `.include` and `.ordered` are combined, the ordering begins at the start of - * both arrays. - * - * expect([{a: 1}, {b: 2}, {c: 3}]) - * .to.include.deep.ordered.members([{a: 1}, {b: 2}]) - * .but.not.include.deep.ordered.members([{b: 2}, {c: 3}]); - * - * Add `.not` earlier in the chain to negate `.members`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the target array doesn't have all of the same members as - * the given array `set` but may or may not have some of them. It's often best - * to identify the exact output that's expected, and then write an assertion - * that only accepts that exact output. - * - * expect([1, 2]).to.not.include(3).and.not.include(4); // Recommended - * expect([1, 2]).to.not.have.members([3, 4]); // Not recommended - * - * `.members` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect([1, 2]).to.have.members([1, 2, 3], 'nooo why fail??'); - * expect([1, 2], 'nooo why fail??').to.have.members([1, 2, 3]); - * - * @name members - * @param {Array} set - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - Assertion.addMethod('members', function (subset, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - - new Assertion(obj, flagMsg, ssfi, true).to.be.an('array'); - new Assertion(subset, flagMsg, ssfi, true).to.be.an('array'); - - var contains = flag(this, 'contains'); - var ordered = flag(this, 'ordered'); - - var subject, failMsg, failNegateMsg; - - if (contains) { - subject = ordered ? 'an ordered superset' : 'a superset'; - failMsg = 'expected #{this} to be ' + subject + ' of #{exp}'; - failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}'; - } else { - subject = ordered ? 'ordered members' : 'members'; - failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}'; - failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}'; - } - - var cmp = flag(this, 'deep') ? _.eql : undefined; - - this.assert( - isSubsetOf(subset, obj, cmp, contains, ordered) - , failMsg - , failNegateMsg - , subset - , obj - , true - ); - }); - - /** - * ### .oneOf(list[, msg]) - * - * Asserts that the target is a member of the given array `list`. However, - * it's often best to assert that the target is equal to its expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.oneOf([1, 2, 3]); // Not recommended - * - * Comparisons are performed using strict (`===`) equality. - * - * Add `.not` earlier in the chain to negate `.oneOf`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.oneOf([2, 3, 4]); // Not recommended - * - * It can also be chained with `.contain` or `.include`, which will work with - * both arrays and strings: - * - * expect('Today is sunny').to.contain.oneOf(['sunny', 'cloudy']) - * expect('Today is rainy').to.not.contain.oneOf(['sunny', 'cloudy']) - * expect([1,2,3]).to.contain.oneOf([3,4,5]) - * expect([1,2,3]).to.not.contain.oneOf([4,5,6]) - * - * `.oneOf` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.be.oneOf([2, 3, 4], 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.oneOf([2, 3, 4]); - * - * @name oneOf - * @param {Array<*>} list - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function oneOf (list, msg) { - if (msg) flag(this, 'message', msg); - var expected = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi') - , contains = flag(this, 'contains') - , isDeep = flag(this, 'deep'); - new Assertion(list, flagMsg, ssfi, true).to.be.an('array'); - - if (contains) { - this.assert( - list.some(function(possibility) { return expected.indexOf(possibility) > -1 }) - , 'expected #{this} to contain one of #{exp}' - , 'expected #{this} to not contain one of #{exp}' - , list - , expected - ); - } else { - if (isDeep) { - this.assert( - list.some(possibility => _.eql(expected, possibility)) - , 'expected #{this} to deeply equal one of #{exp}' - , 'expected #{this} to deeply equal one of #{exp}' - , list - , expected - ); - } else { - this.assert( - list.indexOf(expected) > -1 - , 'expected #{this} to be one of #{exp}' - , 'expected #{this} to not be one of #{exp}' - , list - , expected - ); - } - } - } - - Assertion.addMethod('oneOf', oneOf); - - /** - * ### .change(subject[, prop[, msg]]) - * - * When one argument is provided, `.change` asserts that the given function - * `subject` returns a different value when it's invoked before the target - * function compared to when it's invoked afterward. However, it's often best - * to assert that `subject` is equal to its expected value. - * - * var dots = '' - * , addDot = function () { dots += '.'; } - * , getDots = function () { return dots; }; - * - * // Recommended - * expect(getDots()).to.equal(''); - * addDot(); - * expect(getDots()).to.equal('.'); - * - * // Not recommended - * expect(addDot).to.change(getDots); - * - * When two arguments are provided, `.change` asserts that the value of the - * given object `subject`'s `prop` property is different before invoking the - * target function compared to afterward. - * - * var myObj = {dots: ''} - * , addDot = function () { myObj.dots += '.'; }; - * - * // Recommended - * expect(myObj).to.have.property('dots', ''); - * addDot(); - * expect(myObj).to.have.property('dots', '.'); - * - * // Not recommended - * expect(addDot).to.change(myObj, 'dots'); - * - * Strict (`===`) equality is used to compare before and after values. - * - * Add `.not` earlier in the chain to negate `.change`. - * - * var dots = '' - * , noop = function () {} - * , getDots = function () { return dots; }; - * - * expect(noop).to.not.change(getDots); - * - * var myObj = {dots: ''} - * , noop = function () {}; - * - * expect(noop).to.not.change(myObj, 'dots'); - * - * `.change` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing two arguments, always - * use the second form. - * - * var myObj = {dots: ''} - * , addDot = function () { myObj.dots += '.'; }; - * - * expect(addDot).to.not.change(myObj, 'dots', 'nooo why fail??'); - * - * var dots = '' - * , addDot = function () { dots += '.'; } - * , getDots = function () { return dots; }; - * - * expect(addDot, 'nooo why fail??').to.not.change(getDots); - * - * `.change` also causes all `.by` assertions that follow in the chain to - * assert how much a numeric subject was increased or decreased by. However, - * it's dangerous to use `.change.by`. The problem is that it creates - * uncertain expectations by asserting that the subject either increases by - * the given delta, or that it decreases by the given delta. It's often best - * to identify the exact output that's expected, and then write an assertion - * that only accepts that exact output. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; } - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * The alias `.changes` can be used interchangeably with `.change`. - * - * @name change - * @alias changes - * @param {String} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertChanges (subject, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(fn, flagMsg, ssfi, true).is.a('function'); - - var initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a('function'); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - - fn(); - - var final = prop === undefined || prop === null ? subject() : subject[prop]; - var msgObj = prop === undefined || prop === null ? initial : '.' + prop; - - // This gets flagged because of the .by(delta) assertion - flag(this, 'deltaMsgObj', msgObj); - flag(this, 'initialDeltaValue', initial); - flag(this, 'finalDeltaValue', final); - flag(this, 'deltaBehavior', 'change'); - flag(this, 'realDelta', final !== initial); - - this.assert( - initial !== final - , 'expected ' + msgObj + ' to change' - , 'expected ' + msgObj + ' to not change' - ); - } - - Assertion.addMethod('change', assertChanges); - Assertion.addMethod('changes', assertChanges); - - /** - * ### .increase(subject[, prop[, msg]]) - * - * When one argument is provided, `.increase` asserts that the given function - * `subject` returns a greater number when it's invoked after invoking the - * target function compared to when it's invoked beforehand. `.increase` also - * causes all `.by` assertions that follow in the chain to assert how much - * greater of a number is returned. It's often best to assert that the return - * value increased by the expected amount, rather than asserting it increased - * by any amount. - * - * var val = 1 - * , addTwo = function () { val += 2; } - * , getVal = function () { return val; }; - * - * expect(addTwo).to.increase(getVal).by(2); // Recommended - * expect(addTwo).to.increase(getVal); // Not recommended - * - * When two arguments are provided, `.increase` asserts that the value of the - * given object `subject`'s `prop` property is greater after invoking the - * target function compared to beforehand. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.increase(myObj, 'val'); // Not recommended - * - * Add `.not` earlier in the chain to negate `.increase`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the subject either decreases, or that it stays the same. - * It's often best to identify the exact output that's expected, and then - * write an assertion that only accepts that exact output. - * - * When the subject is expected to decrease, it's often best to assert that it - * decreased by the expected amount. - * - * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended - * - * When the subject is expected to stay the same, it's often best to assert - * exactly that. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.not.change(myObj, 'val'); // Recommended - * expect(noop).to.not.increase(myObj, 'val'); // Not recommended - * - * `.increase` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing two arguments, always - * use the second form. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.increase(myObj, 'val', 'nooo why fail??'); - * - * var val = 1 - * , noop = function () {} - * , getVal = function () { return val; }; - * - * expect(noop, 'nooo why fail??').to.increase(getVal); - * - * The alias `.increases` can be used interchangeably with `.increase`. - * - * @name increase - * @alias increases - * @param {String|Function} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertIncreases (subject, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(fn, flagMsg, ssfi, true).is.a('function'); - - var initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a('function'); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - - // Make sure that the target is a number - new Assertion(initial, flagMsg, ssfi, true).is.a('number'); - - fn(); - - var final = prop === undefined || prop === null ? subject() : subject[prop]; - var msgObj = prop === undefined || prop === null ? initial : '.' + prop; - - flag(this, 'deltaMsgObj', msgObj); - flag(this, 'initialDeltaValue', initial); - flag(this, 'finalDeltaValue', final); - flag(this, 'deltaBehavior', 'increase'); - flag(this, 'realDelta', final - initial); - - this.assert( - final - initial > 0 - , 'expected ' + msgObj + ' to increase' - , 'expected ' + msgObj + ' to not increase' - ); - } - - Assertion.addMethod('increase', assertIncreases); - Assertion.addMethod('increases', assertIncreases); - - /** - * ### .decrease(subject[, prop[, msg]]) - * - * When one argument is provided, `.decrease` asserts that the given function - * `subject` returns a lesser number when it's invoked after invoking the - * target function compared to when it's invoked beforehand. `.decrease` also - * causes all `.by` assertions that follow in the chain to assert how much - * lesser of a number is returned. It's often best to assert that the return - * value decreased by the expected amount, rather than asserting it decreased - * by any amount. - * - * var val = 1 - * , subtractTwo = function () { val -= 2; } - * , getVal = function () { return val; }; - * - * expect(subtractTwo).to.decrease(getVal).by(2); // Recommended - * expect(subtractTwo).to.decrease(getVal); // Not recommended - * - * When two arguments are provided, `.decrease` asserts that the value of the - * given object `subject`'s `prop` property is lesser after invoking the - * target function compared to beforehand. - * - * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.decrease(myObj, 'val'); // Not recommended - * - * Add `.not` earlier in the chain to negate `.decrease`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the subject either increases, or that it stays the same. - * It's often best to identify the exact output that's expected, and then - * write an assertion that only accepts that exact output. - * - * When the subject is expected to increase, it's often best to assert that it - * increased by the expected amount. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.not.decrease(myObj, 'val'); // Not recommended - * - * When the subject is expected to stay the same, it's often best to assert - * exactly that. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.not.change(myObj, 'val'); // Recommended - * expect(noop).to.not.decrease(myObj, 'val'); // Not recommended - * - * `.decrease` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing two arguments, always - * use the second form. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.decrease(myObj, 'val', 'nooo why fail??'); - * - * var val = 1 - * , noop = function () {} - * , getVal = function () { return val; }; - * - * expect(noop, 'nooo why fail??').to.decrease(getVal); - * - * The alias `.decreases` can be used interchangeably with `.decrease`. - * - * @name decrease - * @alias decreases - * @param {String|Function} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertDecreases (subject, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(fn, flagMsg, ssfi, true).is.a('function'); - - var initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a('function'); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - - // Make sure that the target is a number - new Assertion(initial, flagMsg, ssfi, true).is.a('number'); - - fn(); - - var final = prop === undefined || prop === null ? subject() : subject[prop]; - var msgObj = prop === undefined || prop === null ? initial : '.' + prop; - - flag(this, 'deltaMsgObj', msgObj); - flag(this, 'initialDeltaValue', initial); - flag(this, 'finalDeltaValue', final); - flag(this, 'deltaBehavior', 'decrease'); - flag(this, 'realDelta', initial - final); - - this.assert( - final - initial < 0 - , 'expected ' + msgObj + ' to decrease' - , 'expected ' + msgObj + ' to not decrease' - ); - } - - Assertion.addMethod('decrease', assertDecreases); - Assertion.addMethod('decreases', assertDecreases); - - /** - * ### .by(delta[, msg]) - * - * When following an `.increase` assertion in the chain, `.by` asserts that - * the subject of the `.increase` assertion increased by the given `delta`. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); - * - * When following a `.decrease` assertion in the chain, `.by` asserts that the - * subject of the `.decrease` assertion decreased by the given `delta`. - * - * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); - * - * When following a `.change` assertion in the chain, `.by` asserts that the - * subject of the `.change` assertion either increased or decreased by the - * given `delta`. However, it's dangerous to use `.change.by`. The problem is - * that it creates uncertain expectations. It's often best to identify the - * exact output that's expected, and then write an assertion that only accepts - * that exact output. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; } - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * Add `.not` earlier in the chain to negate `.by`. However, it's often best - * to assert that the subject changed by its expected delta, rather than - * asserting that it didn't change by one of countless unexpected deltas. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * // Recommended - * expect(addTwo).to.increase(myObj, 'val').by(2); - * - * // Not recommended - * expect(addTwo).to.increase(myObj, 'val').but.not.by(3); - * - * `.by` accepts an optional `msg` argument which is a custom error message to - * show when the assertion fails. The message can also be given as the second - * argument to `expect`. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(3, 'nooo why fail??'); - * expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3); - * - * @name by - * @param {Number} delta - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertDelta(delta, msg) { - if (msg) flag(this, 'message', msg); - - var msgObj = flag(this, 'deltaMsgObj'); - var initial = flag(this, 'initialDeltaValue'); - var final = flag(this, 'finalDeltaValue'); - var behavior = flag(this, 'deltaBehavior'); - var realDelta = flag(this, 'realDelta'); - - var expression; - if (behavior === 'change') { - expression = Math.abs(final - initial) === Math.abs(delta); - } else { - expression = realDelta === Math.abs(delta); - } - - this.assert( - expression - , 'expected ' + msgObj + ' to ' + behavior + ' by ' + delta - , 'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta - ); - } - - Assertion.addMethod('by', assertDelta); - - /** - * ### .extensible - * - * Asserts that the target is extensible, which means that new properties can - * be added to it. Primitives are never extensible. - * - * expect({a: 1}).to.be.extensible; - * - * Add `.not` earlier in the chain to negate `.extensible`. - * - * var nonExtensibleObject = Object.preventExtensions({}) - * , sealedObject = Object.seal({}) - * , frozenObject = Object.freeze({}); - * - * expect(nonExtensibleObject).to.not.be.extensible; - * expect(sealedObject).to.not.be.extensible; - * expect(frozenObject).to.not.be.extensible; - * expect(1).to.not.be.extensible; - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(1, 'nooo why fail??').to.be.extensible; - * - * @name extensible - * @namespace BDD - * @api public - */ - - Assertion.addProperty('extensible', function() { - var obj = flag(this, 'object'); - - // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. - // In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible - // The following provides ES6 behavior for ES5 environments. - - var isExtensible = obj === Object(obj) && Object.isExtensible(obj); - - this.assert( - isExtensible - , 'expected #{this} to be extensible' - , 'expected #{this} to not be extensible' - ); - }); - - /** - * ### .sealed - * - * Asserts that the target is sealed, which means that new properties can't be - * added to it, and its existing properties can't be reconfigured or deleted. - * However, it's possible that its existing properties can still be reassigned - * to different values. Primitives are always sealed. - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * expect(sealedObject).to.be.sealed; - * expect(frozenObject).to.be.sealed; - * expect(1).to.be.sealed; - * - * Add `.not` earlier in the chain to negate `.sealed`. - * - * expect({a: 1}).to.not.be.sealed; - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({a: 1}, 'nooo why fail??').to.be.sealed; - * - * @name sealed - * @namespace BDD - * @api public - */ - - Assertion.addProperty('sealed', function() { - var obj = flag(this, 'object'); - - // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. - // In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true. - // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed - // The following provides ES6 behavior for ES5 environments. - - var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true; - - this.assert( - isSealed - , 'expected #{this} to be sealed' - , 'expected #{this} to not be sealed' - ); - }); - - /** - * ### .frozen - * - * Asserts that the target is frozen, which means that new properties can't be - * added to it, and its existing properties can't be reassigned to different - * values, reconfigured, or deleted. Primitives are always frozen. - * - * var frozenObject = Object.freeze({}); - * - * expect(frozenObject).to.be.frozen; - * expect(1).to.be.frozen; - * - * Add `.not` earlier in the chain to negate `.frozen`. - * - * expect({a: 1}).to.not.be.frozen; - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({a: 1}, 'nooo why fail??').to.be.frozen; - * - * @name frozen - * @namespace BDD - * @api public - */ - - Assertion.addProperty('frozen', function() { - var obj = flag(this, 'object'); - - // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. - // In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true. - // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen - // The following provides ES6 behavior for ES5 environments. - - var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true; - - this.assert( - isFrozen - , 'expected #{this} to be frozen' - , 'expected #{this} to not be frozen' - ); - }); - - /** - * ### .finite - * - * Asserts that the target is a number, and isn't `NaN` or positive/negative - * `Infinity`. - * - * expect(1).to.be.finite; - * - * Add `.not` earlier in the chain to negate `.finite`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the subject either isn't a number, or that it's `NaN`, or - * that it's positive `Infinity`, or that it's negative `Infinity`. It's often - * best to identify the exact output that's expected, and then write an - * assertion that only accepts that exact output. - * - * When the target isn't expected to be a number, it's often best to assert - * that it's the expected type, rather than asserting that it isn't one of - * many unexpected types. - * - * expect('foo').to.be.a('string'); // Recommended - * expect('foo').to.not.be.finite; // Not recommended - * - * When the target is expected to be `NaN`, it's often best to assert exactly - * that. - * - * expect(NaN).to.be.NaN; // Recommended - * expect(NaN).to.not.be.finite; // Not recommended - * - * When the target is expected to be positive infinity, it's often best to - * assert exactly that. - * - * expect(Infinity).to.equal(Infinity); // Recommended - * expect(Infinity).to.not.be.finite; // Not recommended - * - * When the target is expected to be negative infinity, it's often best to - * assert exactly that. - * - * expect(-Infinity).to.equal(-Infinity); // Recommended - * expect(-Infinity).to.not.be.finite; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect('foo', 'nooo why fail??').to.be.finite; - * - * @name finite - * @namespace BDD - * @api public - */ - - Assertion.addProperty('finite', function(msg) { - var obj = flag(this, 'object'); - - this.assert( - typeof obj === 'number' && isFinite(obj) - , 'expected #{this} to be a finite number' - , 'expected #{this} to not be a finite number' - ); - }); -}; - -},{}],6:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - /*! - * Chai dependencies. - */ - - var Assertion = chai.Assertion - , flag = util.flag; - - /*! - * Module export. - */ - - /** - * ### assert(expression, message) - * - * Write your own test expressions. - * - * assert('foo' !== 'bar', 'foo is not bar'); - * assert(Array.isArray([]), 'empty arrays are arrays'); - * - * @param {Mixed} expression to test for truthiness - * @param {String} message to display on error - * @name assert - * @namespace Assert - * @api public - */ - - var assert = chai.assert = function (express, errmsg) { - var test = new Assertion(null, null, chai.assert, true); - test.assert( - express - , errmsg - , '[ negation message unavailable ]' - ); - }; - - /** - * ### .fail([message]) - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. Node.js `assert` module-compatible. - * - * assert.fail(); - * assert.fail("custom error message"); - * assert.fail(1, 2); - * assert.fail(1, 2, "custom error message"); - * assert.fail(1, 2, "custom error message", ">"); - * assert.fail(1, 2, undefined, ">"); - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @namespace Assert - * @api public - */ - - assert.fail = function (actual, expected, message, operator) { - if (arguments.length < 2) { - // Comply with Node's fail([message]) interface - - message = actual; - actual = undefined; - } - - message = message || 'assert.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, assert.fail); - }; - - /** - * ### .isOk(object, [message]) - * - * Asserts that `object` is truthy. - * - * assert.isOk('everything', 'everything is ok'); - * assert.isOk(false, 'this will fail'); - * - * @name isOk - * @alias ok - * @param {Mixed} object to test - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isOk = function (val, msg) { - new Assertion(val, msg, assert.isOk, true).is.ok; - }; - - /** - * ### .isNotOk(object, [message]) - * - * Asserts that `object` is falsy. - * - * assert.isNotOk('everything', 'this will fail'); - * assert.isNotOk(false, 'this will pass'); - * - * @name isNotOk - * @alias notOk - * @param {Mixed} object to test - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotOk = function (val, msg) { - new Assertion(val, msg, assert.isNotOk, true).is.not.ok; - }; - - /** - * ### .equal(actual, expected, [message]) - * - * Asserts non-strict equality (`==`) of `actual` and `expected`. - * - * assert.equal(3, '3', '== coerces values to strings'); - * - * @name equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.equal = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.equal, true); - - test.assert( - exp == flag(test, 'object') - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{act}' - , exp - , act - , true - ); - }; - - /** - * ### .notEqual(actual, expected, [message]) - * - * Asserts non-strict inequality (`!=`) of `actual` and `expected`. - * - * assert.notEqual(3, 4, 'these numbers are not equal'); - * - * @name notEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notEqual = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.notEqual, true); - - test.assert( - exp != flag(test, 'object') - , 'expected #{this} to not equal #{exp}' - , 'expected #{this} to equal #{act}' - , exp - , act - , true - ); - }; - - /** - * ### .strictEqual(actual, expected, [message]) - * - * Asserts strict equality (`===`) of `actual` and `expected`. - * - * assert.strictEqual(true, true, 'these booleans are strictly equal'); - * - * @name strictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.strictEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.strictEqual, true).to.equal(exp); - }; - - /** - * ### .notStrictEqual(actual, expected, [message]) - * - * Asserts strict inequality (`!==`) of `actual` and `expected`. - * - * assert.notStrictEqual(3, '3', 'no coercion for strict equality'); - * - * @name notStrictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notStrictEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp); - }; - - /** - * ### .deepEqual(actual, expected, [message]) - * - * Asserts that `actual` is deeply equal to `expected`. - * - * assert.deepEqual({ tea: 'green' }, { tea: 'green' }); - * - * @name deepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @alias deepStrictEqual - * @namespace Assert - * @api public - */ - - assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.deepEqual, true).to.eql(exp); - }; - - /** - * ### .notDeepEqual(actual, expected, [message]) - * - * Assert that `actual` is not deeply equal to `expected`. - * - * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' }); - * - * @name notDeepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp); - }; - - /** - * ### .isAbove(valueToCheck, valueToBeAbove, [message]) - * - * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`. - * - * assert.isAbove(5, 2, '5 is strictly greater than 2'); - * - * @name isAbove - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAbove - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isAbove = function (val, abv, msg) { - new Assertion(val, msg, assert.isAbove, true).to.be.above(abv); - }; - - /** - * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message]) - * - * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`. - * - * assert.isAtLeast(5, 2, '5 is greater or equal to 2'); - * assert.isAtLeast(3, 3, '3 is greater or equal to 3'); - * - * @name isAtLeast - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAtLeast - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isAtLeast = function (val, atlst, msg) { - new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst); - }; - - /** - * ### .isBelow(valueToCheck, valueToBeBelow, [message]) - * - * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`. - * - * assert.isBelow(3, 6, '3 is strictly less than 6'); - * - * @name isBelow - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeBelow - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isBelow = function (val, blw, msg) { - new Assertion(val, msg, assert.isBelow, true).to.be.below(blw); - }; - - /** - * ### .isAtMost(valueToCheck, valueToBeAtMost, [message]) - * - * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`. - * - * assert.isAtMost(3, 6, '3 is less than or equal to 6'); - * assert.isAtMost(4, 4, '4 is less than or equal to 4'); - * - * @name isAtMost - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAtMost - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isAtMost = function (val, atmst, msg) { - new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst); - }; - - /** - * ### .isTrue(value, [message]) - * - * Asserts that `value` is true. - * - * var teaServed = true; - * assert.isTrue(teaServed, 'the tea has been served'); - * - * @name isTrue - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isTrue = function (val, msg) { - new Assertion(val, msg, assert.isTrue, true).is['true']; - }; - - /** - * ### .isNotTrue(value, [message]) - * - * Asserts that `value` is not true. - * - * var tea = 'tasty chai'; - * assert.isNotTrue(tea, 'great, time for tea!'); - * - * @name isNotTrue - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotTrue = function (val, msg) { - new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true); - }; - - /** - * ### .isFalse(value, [message]) - * - * Asserts that `value` is false. - * - * var teaServed = false; - * assert.isFalse(teaServed, 'no tea yet? hmm...'); - * - * @name isFalse - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isFalse = function (val, msg) { - new Assertion(val, msg, assert.isFalse, true).is['false']; - }; - - /** - * ### .isNotFalse(value, [message]) - * - * Asserts that `value` is not false. - * - * var tea = 'tasty chai'; - * assert.isNotFalse(tea, 'great, time for tea!'); - * - * @name isNotFalse - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotFalse = function (val, msg) { - new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false); - }; - - /** - * ### .isNull(value, [message]) - * - * Asserts that `value` is null. - * - * assert.isNull(err, 'there was no error'); - * - * @name isNull - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNull = function (val, msg) { - new Assertion(val, msg, assert.isNull, true).to.equal(null); - }; - - /** - * ### .isNotNull(value, [message]) - * - * Asserts that `value` is not null. - * - * var tea = 'tasty chai'; - * assert.isNotNull(tea, 'great, time for tea!'); - * - * @name isNotNull - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotNull = function (val, msg) { - new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null); - }; - - /** - * ### .isNaN - * - * Asserts that value is NaN. - * - * assert.isNaN(NaN, 'NaN is NaN'); - * - * @name isNaN - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNaN = function (val, msg) { - new Assertion(val, msg, assert.isNaN, true).to.be.NaN; - }; - - /** - * ### .isNotNaN - * - * Asserts that value is not NaN. - * - * assert.isNotNaN(4, '4 is not NaN'); - * - * @name isNotNaN - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - assert.isNotNaN = function (val, msg) { - new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN; - }; - - /** - * ### .exists - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var foo = 'hi'; - * - * assert.exists(foo, 'foo is neither `null` nor `undefined`'); - * - * @name exists - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.exists = function (val, msg) { - new Assertion(val, msg, assert.exists, true).to.exist; - }; - - /** - * ### .notExists - * - * Asserts that the target is either `null` or `undefined`. - * - * var bar = null - * , baz; - * - * assert.notExists(bar); - * assert.notExists(baz, 'baz is either null or undefined'); - * - * @name notExists - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notExists = function (val, msg) { - new Assertion(val, msg, assert.notExists, true).to.not.exist; - }; - - /** - * ### .isUndefined(value, [message]) - * - * Asserts that `value` is `undefined`. - * - * var tea; - * assert.isUndefined(tea, 'no tea defined'); - * - * @name isUndefined - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isUndefined = function (val, msg) { - new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined); - }; - - /** - * ### .isDefined(value, [message]) - * - * Asserts that `value` is not `undefined`. - * - * var tea = 'cup of chai'; - * assert.isDefined(tea, 'tea has been defined'); - * - * @name isDefined - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isDefined = function (val, msg) { - new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined); - }; - - /** - * ### .isFunction(value, [message]) - * - * Asserts that `value` is a function. - * - * function serveTea() { return 'cup of tea'; }; - * assert.isFunction(serveTea, 'great, we can have tea now'); - * - * @name isFunction - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isFunction = function (val, msg) { - new Assertion(val, msg, assert.isFunction, true).to.be.a('function'); - }; - - /** - * ### .isNotFunction(value, [message]) - * - * Asserts that `value` is _not_ a function. - * - * var serveTea = [ 'heat', 'pour', 'sip' ]; - * assert.isNotFunction(serveTea, 'great, we have listed the steps'); - * - * @name isNotFunction - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotFunction = function (val, msg) { - new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a('function'); - }; - - /** - * ### .isObject(value, [message]) - * - * Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`). - * _The assertion does not match subclassed objects._ - * - * var selection = { name: 'Chai', serve: 'with spices' }; - * assert.isObject(selection, 'tea selection is an object'); - * - * @name isObject - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isObject = function (val, msg) { - new Assertion(val, msg, assert.isObject, true).to.be.a('object'); - }; - - /** - * ### .isNotObject(value, [message]) - * - * Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`). - * - * var selection = 'chai' - * assert.isNotObject(selection, 'tea selection is not an object'); - * assert.isNotObject(null, 'null is not an object'); - * - * @name isNotObject - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotObject = function (val, msg) { - new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object'); - }; - - /** - * ### .isArray(value, [message]) - * - * Asserts that `value` is an array. - * - * var menu = [ 'green', 'chai', 'oolong' ]; - * assert.isArray(menu, 'what kind of tea do we want?'); - * - * @name isArray - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isArray = function (val, msg) { - new Assertion(val, msg, assert.isArray, true).to.be.an('array'); - }; - - /** - * ### .isNotArray(value, [message]) - * - * Asserts that `value` is _not_ an array. - * - * var menu = 'green|chai|oolong'; - * assert.isNotArray(menu, 'what kind of tea do we want?'); - * - * @name isNotArray - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotArray = function (val, msg) { - new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array'); - }; - - /** - * ### .isString(value, [message]) - * - * Asserts that `value` is a string. - * - * var teaOrder = 'chai'; - * assert.isString(teaOrder, 'order placed'); - * - * @name isString - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isString = function (val, msg) { - new Assertion(val, msg, assert.isString, true).to.be.a('string'); - }; - - /** - * ### .isNotString(value, [message]) - * - * Asserts that `value` is _not_ a string. - * - * var teaOrder = 4; - * assert.isNotString(teaOrder, 'order placed'); - * - * @name isNotString - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotString = function (val, msg) { - new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string'); - }; - - /** - * ### .isNumber(value, [message]) - * - * Asserts that `value` is a number. - * - * var cups = 2; - * assert.isNumber(cups, 'how many cups'); - * - * @name isNumber - * @param {Number} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNumber = function (val, msg) { - new Assertion(val, msg, assert.isNumber, true).to.be.a('number'); - }; - - /** - * ### .isNotNumber(value, [message]) - * - * Asserts that `value` is _not_ a number. - * - * var cups = '2 cups please'; - * assert.isNotNumber(cups, 'how many cups'); - * - * @name isNotNumber - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotNumber = function (val, msg) { - new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number'); - }; - - /** - * ### .isFinite(value, [message]) - * - * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. - * - * var cups = 2; - * assert.isFinite(cups, 'how many cups'); - * - * assert.isFinite(NaN); // throws - * - * @name isFinite - * @param {Number} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isFinite = function (val, msg) { - new Assertion(val, msg, assert.isFinite, true).to.be.finite; - }; - - /** - * ### .isBoolean(value, [message]) - * - * Asserts that `value` is a boolean. - * - * var teaReady = true - * , teaServed = false; - * - * assert.isBoolean(teaReady, 'is the tea ready'); - * assert.isBoolean(teaServed, 'has tea been served'); - * - * @name isBoolean - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isBoolean = function (val, msg) { - new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean'); - }; - - /** - * ### .isNotBoolean(value, [message]) - * - * Asserts that `value` is _not_ a boolean. - * - * var teaReady = 'yep' - * , teaServed = 'nope'; - * - * assert.isNotBoolean(teaReady, 'is the tea ready'); - * assert.isNotBoolean(teaServed, 'has tea been served'); - * - * @name isNotBoolean - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotBoolean = function (val, msg) { - new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean'); - }; - - /** - * ### .typeOf(value, name, [message]) - * - * Asserts that `value`'s type is `name`, as determined by - * `Object.prototype.toString`. - * - * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object'); - * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array'); - * assert.typeOf('tea', 'string', 'we have a string'); - * assert.typeOf(/tea/, 'regexp', 'we have a regular expression'); - * assert.typeOf(null, 'null', 'we have a null'); - * assert.typeOf(undefined, 'undefined', 'we have an undefined'); - * - * @name typeOf - * @param {Mixed} value - * @param {String} name - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.typeOf = function (val, type, msg) { - new Assertion(val, msg, assert.typeOf, true).to.be.a(type); - }; - - /** - * ### .notTypeOf(value, name, [message]) - * - * Asserts that `value`'s type is _not_ `name`, as determined by - * `Object.prototype.toString`. - * - * assert.notTypeOf('tea', 'number', 'strings are not numbers'); - * - * @name notTypeOf - * @param {Mixed} value - * @param {String} typeof name - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notTypeOf = function (val, type, msg) { - new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type); - }; - - /** - * ### .instanceOf(object, constructor, [message]) - * - * Asserts that `value` is an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new Tea('chai'); - * - * assert.instanceOf(chai, Tea, 'chai is an instance of tea'); - * - * @name instanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.instanceOf = function (val, type, msg) { - new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type); - }; - - /** - * ### .notInstanceOf(object, constructor, [message]) - * - * Asserts `value` is not an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new String('chai'); - * - * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea'); - * - * @name notInstanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notInstanceOf = function (val, type, msg) { - new Assertion(val, msg, assert.notInstanceOf, true) - .to.not.be.instanceOf(type); - }; - - /** - * ### .include(haystack, needle, [message]) - * - * Asserts that `haystack` includes `needle`. Can be used to assert the - * inclusion of a value in an array, a substring in a string, or a subset of - * properties in an object. - * - * assert.include([1,2,3], 2, 'array contains value'); - * assert.include('foobar', 'foo', 'string contains substring'); - * assert.include({ foo: 'bar', hello: 'universe' }, { foo: 'bar' }, 'object contains property'); - * - * Strict equality (===) is used. When asserting the inclusion of a value in - * an array, the array is searched for an element that's strictly equal to the - * given value. When asserting a subset of properties in an object, the object - * is searched for the given property keys, checking that each one is present - * and strictly equal to the given property value. For instance: - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.include([obj1, obj2], obj1); - * assert.include({foo: obj1, bar: obj2}, {foo: obj1}); - * assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2}); - * - * @name include - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.include = function (exp, inc, msg) { - new Assertion(exp, msg, assert.include, true).include(inc); - }; - - /** - * ### .notInclude(haystack, needle, [message]) - * - * Asserts that `haystack` does not include `needle`. Can be used to assert - * the absence of a value in an array, a substring in a string, or a subset of - * properties in an object. - * - * assert.notInclude([1,2,3], 4, "array doesn't contain value"); - * assert.notInclude('foobar', 'baz', "string doesn't contain substring"); - * assert.notInclude({ foo: 'bar', hello: 'universe' }, { foo: 'baz' }, 'object doesn't contain property'); - * - * Strict equality (===) is used. When asserting the absence of a value in an - * array, the array is searched to confirm the absence of an element that's - * strictly equal to the given value. When asserting a subset of properties in - * an object, the object is searched to confirm that at least one of the given - * property keys is either not present or not strictly equal to the given - * property value. For instance: - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.notInclude([obj1, obj2], {a: 1}); - * assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); - * assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}}); - * - * @name notInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notInclude, true).not.include(inc); - }; - - /** - * ### .deepInclude(haystack, needle, [message]) - * - * Asserts that `haystack` includes `needle`. Can be used to assert the - * inclusion of a value in an array or a subset of properties in an object. - * Deep equality is used. - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.deepInclude([obj1, obj2], {a: 1}); - * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); - * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}}); - * - * @name deepInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc); - }; - - /** - * ### .notDeepInclude(haystack, needle, [message]) - * - * Asserts that `haystack` does not include `needle`. Can be used to assert - * the absence of a value in an array or a subset of properties in an object. - * Deep equality is used. - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.notDeepInclude([obj1, obj2], {a: 9}); - * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}}); - * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}}); - * - * @name notDeepInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc); - }; - - /** - * ### .nestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'}); - * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); - * - * @name nestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.nestedInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc); - }; - - /** - * ### .notNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' does not include 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'}); - * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); - * - * @name notNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notNestedInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notNestedInclude, true) - .not.nested.include(inc); - }; - - /** - * ### .deepNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object while checking for deep equality. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}}); - * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); - * - * @name deepNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepNestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepNestedInclude, true) - .deep.nested.include(inc); - }; - - /** - * ### .notDeepNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' does not include 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object while checking for deep equality. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}}) - * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); - * - * @name notDeepNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepNestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepNestedInclude, true) - .not.deep.nested.include(inc); - }; - - /** - * ### .ownInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object while ignoring inherited properties. - * - * assert.ownInclude({ a: 1 }, { a: 1 }); - * - * @name ownInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.ownInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.ownInclude, true).own.include(inc); - }; - - /** - * ### .notOwnInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object while ignoring inherited properties. - * - * Object.prototype.b = 2; - * - * assert.notOwnInclude({ a: 1 }, { b: 2 }); - * - * @name notOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc); - }; - - /** - * ### .deepOwnInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object while ignoring inherited properties and checking for deep equality. - * - * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); - * - * @name deepOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepOwnInclude, true) - .deep.own.include(inc); - }; - - /** - * ### .notDeepOwnInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object while ignoring inherited properties and checking for deep equality. - * - * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); - * - * @name notDeepOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepOwnInclude, true) - .not.deep.own.include(inc); - }; - - /** - * ### .match(value, regexp, [message]) - * - * Asserts that `value` matches the regular expression `regexp`. - * - * assert.match('foobar', /^foo/, 'regexp matches'); - * - * @name match - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.match = function (exp, re, msg) { - new Assertion(exp, msg, assert.match, true).to.match(re); - }; - - /** - * ### .notMatch(value, regexp, [message]) - * - * Asserts that `value` does not match the regular expression `regexp`. - * - * assert.notMatch('foobar', /^foo/, 'regexp does not match'); - * - * @name notMatch - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notMatch = function (exp, re, msg) { - new Assertion(exp, msg, assert.notMatch, true).to.not.match(re); - }; - - /** - * ### .property(object, property, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property`. - * - * assert.property({ tea: { green: 'matcha' }}, 'tea'); - * assert.property({ tea: { green: 'matcha' }}, 'toString'); - * - * @name property - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.property = function (obj, prop, msg) { - new Assertion(obj, msg, assert.property, true).to.have.property(prop); - }; - - /** - * ### .notProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a direct or inherited property named - * by `property`. - * - * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee'); - * - * @name notProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.notProperty, true) - .to.not.have.property(prop); - }; - - /** - * ### .propertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property` with a value given by `value`. Uses a strict equality check - * (===). - * - * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good'); - * - * @name propertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.propertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.propertyVal, true) - .to.have.property(prop, val); - }; - - /** - * ### .notPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct or inherited property named - * by `property` with value given by `value`. Uses a strict equality check - * (===). - * - * assert.notPropertyVal({ tea: 'is good' }, 'tea', 'is bad'); - * assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good'); - * - * @name notPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notPropertyVal, true) - .to.not.have.property(prop, val); - }; - - /** - * ### .deepPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property` with a value given by `value`. Uses a deep equality check. - * - * assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); - * - * @name deepPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.deepPropertyVal, true) - .to.have.deep.property(prop, val); - }; - - /** - * ### .notDeepPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct or inherited property named - * by `property` with value given by `value`. Uses a deep equality check. - * - * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' }); - * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' }); - * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); - * - * @name notDeepPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notDeepPropertyVal, true) - .to.not.have.deep.property(prop, val); - }; - - /** - * ### .ownProperty(object, property, [message]) - * - * Asserts that `object` has a direct property named by `property`. Inherited - * properties aren't checked. - * - * assert.ownProperty({ tea: { green: 'matcha' }}, 'tea'); - * - * @name ownProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.ownProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.ownProperty, true) - .to.have.own.property(prop); - }; - - /** - * ### .notOwnProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a direct property named by - * `property`. Inherited properties aren't checked. - * - * assert.notOwnProperty({ tea: { green: 'matcha' }}, 'coffee'); - * assert.notOwnProperty({}, 'toString'); - * - * @name notOwnProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.notOwnProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.notOwnProperty, true) - .to.not.have.own.property(prop); - }; - - /** - * ### .ownPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct property named by `property` and a value - * equal to the provided `value`. Uses a strict equality check (===). - * Inherited properties aren't checked. - * - * assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good'); - * - * @name ownPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.ownPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.ownPropertyVal, true) - .to.have.own.property(prop, value); - }; - - /** - * ### .notOwnPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct property named by `property` - * with a value equal to the provided `value`. Uses a strict equality check - * (===). Inherited properties aren't checked. - * - * assert.notOwnPropertyVal({ tea: 'is better'}, 'tea', 'is worse'); - * assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString); - * - * @name notOwnPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.notOwnPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.notOwnPropertyVal, true) - .to.not.have.own.property(prop, value); - }; - - /** - * ### .deepOwnPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct property named by `property` and a value - * equal to the provided `value`. Uses a deep equality check. Inherited - * properties aren't checked. - * - * assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); - * - * @name deepOwnPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.deepOwnPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.deepOwnPropertyVal, true) - .to.have.deep.own.property(prop, value); - }; - - /** - * ### .notDeepOwnPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct property named by `property` - * with a value equal to the provided `value`. Uses a deep equality check. - * Inherited properties aren't checked. - * - * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' }); - * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' }); - * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); - * assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString); - * - * @name notDeepOwnPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true) - .to.not.have.deep.own.property(prop, value); - }; - - /** - * ### .nestedProperty(object, property, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property`, which can be a string using dot- and bracket-notation for - * nested reference. - * - * assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green'); - * - * @name nestedProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.nestedProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.nestedProperty, true) - .to.have.nested.property(prop); - }; - - /** - * ### .notNestedProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a property named by `property`, which - * can be a string using dot- and bracket-notation for nested reference. The - * property cannot exist on the object nor anywhere in its prototype chain. - * - * assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong'); - * - * @name notNestedProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notNestedProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.notNestedProperty, true) - .to.not.have.nested.property(prop); - }; - - /** - * ### .nestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with value given - * by `value`. `property` can use dot- and bracket-notation for nested - * reference. Uses a strict equality check (===). - * - * assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha'); - * - * @name nestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.nestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.nestedPropertyVal, true) - .to.have.nested.property(prop, val); - }; - - /** - * ### .notNestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a property named by `property` with - * value given by `value`. `property` can use dot- and bracket-notation for - * nested reference. Uses a strict equality check (===). - * - * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha'); - * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha'); - * - * @name notNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notNestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notNestedPropertyVal, true) - .to.not.have.nested.property(prop, val); - }; - - /** - * ### .deepNestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with a value given - * by `value`. `property` can use dot- and bracket-notation for nested - * reference. Uses a deep equality check. - * - * assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' }); - * - * @name deepNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepNestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.deepNestedPropertyVal, true) - .to.have.deep.nested.property(prop, val); - }; - - /** - * ### .notDeepNestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a property named by `property` with - * value given by `value`. `property` can use dot- and bracket-notation for - * nested reference. Uses a deep equality check. - * - * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { oolong: 'yum' }); - * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yuck' }); - * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' }); - * - * @name notDeepNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true) - .to.not.have.deep.nested.property(prop, val); - } - - /** - * ### .lengthOf(object, length, [message]) - * - * Asserts that `object` has a `length` or `size` with the expected value. - * - * assert.lengthOf([1,2,3], 3, 'array has length of 3'); - * assert.lengthOf('foobar', 6, 'string has length of 6'); - * assert.lengthOf(new Set([1,2,3]), 3, 'set has size of 3'); - * assert.lengthOf(new Map([['a',1],['b',2],['c',3]]), 3, 'map has size of 3'); - * - * @name lengthOf - * @param {Mixed} object - * @param {Number} length - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.lengthOf = function (exp, len, msg) { - new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len); - }; - - /** - * ### .hasAnyKeys(object, [keys], [message]) - * - * Asserts that `object` has at least one of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'iDontExist', 'baz']); - * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, iDontExist: 99, baz: 1337}); - * assert.hasAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); - * assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']); - * - * @name hasAnyKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAnyKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys); - } - - /** - * ### .hasAllKeys(object, [keys], [message]) - * - * Asserts that `object` has all and only all of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']); - * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337]); - * assert.hasAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); - * assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']); - * - * @name hasAllKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAllKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys); - } - - /** - * ### .containsAllKeys(object, [keys], [message]) - * - * Asserts that `object` has all of the `keys` provided but may have more keys not listed. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'baz']); - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']); - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337}); - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337}); - * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]); - * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); - * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}]); - * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']); - * - * @name containsAllKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.containsAllKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.containsAllKeys, true) - .to.contain.all.keys(keys); - } - - /** - * ### .doesNotHaveAnyKeys(object, [keys], [message]) - * - * Asserts that `object` has none of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']); - * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'}); - * assert.doesNotHaveAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']); - * assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']); - * - * @name doesNotHaveAnyKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAnyKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true) - .to.not.have.any.keys(keys); - } - - /** - * ### .doesNotHaveAllKeys(object, [keys], [message]) - * - * Asserts that `object` does not have at least one of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']); - * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'}); - * assert.doesNotHaveAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']); - * assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']); - * - * @name doesNotHaveAllKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAllKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAllKeys, true) - .to.not.have.all.keys(keys); - } - - /** - * ### .hasAnyDeepKeys(object, [keys], [message]) - * - * Asserts that `object` has at least one of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'}); - * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]); - * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); - * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'}); - * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]); - * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); - * - * @name hasAnyDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAnyDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAnyDeepKeys, true) - .to.have.any.deep.keys(keys); - } - - /** - * ### .hasAllDeepKeys(object, [keys], [message]) - * - * Asserts that `object` has all and only all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'}); - * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); - * assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'}); - * assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); - * - * @name hasAllDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAllDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAllDeepKeys, true) - .to.have.all.deep.keys(keys); - } - - /** - * ### .containsAllDeepKeys(object, [keys], [message]) - * - * Asserts that `object` contains all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'}); - * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); - * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'}); - * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); - * - * @name containsAllDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.containsAllDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.containsAllDeepKeys, true) - .to.contain.all.deep.keys(keys); - } - - /** - * ### .doesNotHaveAnyDeepKeys(object, [keys], [message]) - * - * Asserts that `object` has none of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'}); - * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); - * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'}); - * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); - * - * @name doesNotHaveAnyDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true) - .to.not.have.any.deep.keys(keys); - } - - /** - * ### .doesNotHaveAllDeepKeys(object, [keys], [message]) - * - * Asserts that `object` does not have at least one of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'}); - * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]); - * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'}); - * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]); - * - * @name doesNotHaveAllDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true) - .to.not.have.all.deep.keys(keys); - } - - /** - * ### .throws(fn, [errorLike/string/regexp], [string/regexp], [message]) - * - * If `errorLike` is an `Error` constructor, asserts that `fn` will throw an error that is an - * instance of `errorLike`. - * If `errorLike` is an `Error` instance, asserts that the error thrown is the same - * instance as `errorLike`. - * If `errMsgMatcher` is provided, it also asserts that the error thrown will have a - * message matching `errMsgMatcher`. - * - * assert.throws(fn, 'Error thrown must have this msg'); - * assert.throws(fn, /Error thrown must have a msg that matches this/); - * assert.throws(fn, ReferenceError); - * assert.throws(fn, errorInstance); - * assert.throws(fn, ReferenceError, 'Error thrown must be a ReferenceError and have this msg'); - * assert.throws(fn, errorInstance, 'Error thrown must be the same errorInstance and have this msg'); - * assert.throws(fn, ReferenceError, /Error thrown must be a ReferenceError and match this/); - * assert.throws(fn, errorInstance, /Error thrown must be the same errorInstance and match this/); - * - * @name throws - * @alias throw - * @alias Throw - * @param {Function} fn - * @param {ErrorConstructor|Error} errorLike - * @param {RegExp|String} errMsgMatcher - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Assert - * @api public - */ - - assert.throws = function (fn, errorLike, errMsgMatcher, msg) { - if ('string' === typeof errorLike || errorLike instanceof RegExp) { - errMsgMatcher = errorLike; - errorLike = null; - } - - var assertErr = new Assertion(fn, msg, assert.throws, true) - .to.throw(errorLike, errMsgMatcher); - return flag(assertErr, 'object'); - }; - - /** - * ### .doesNotThrow(fn, [errorLike/string/regexp], [string/regexp], [message]) - * - * If `errorLike` is an `Error` constructor, asserts that `fn` will _not_ throw an error that is an - * instance of `errorLike`. - * If `errorLike` is an `Error` instance, asserts that the error thrown is _not_ the same - * instance as `errorLike`. - * If `errMsgMatcher` is provided, it also asserts that the error thrown will _not_ have a - * message matching `errMsgMatcher`. - * - * assert.doesNotThrow(fn, 'Any Error thrown must not have this message'); - * assert.doesNotThrow(fn, /Any Error thrown must not match this/); - * assert.doesNotThrow(fn, Error); - * assert.doesNotThrow(fn, errorInstance); - * assert.doesNotThrow(fn, Error, 'Error must not have this message'); - * assert.doesNotThrow(fn, errorInstance, 'Error must not have this message'); - * assert.doesNotThrow(fn, Error, /Error must not match this/); - * assert.doesNotThrow(fn, errorInstance, /Error must not match this/); - * - * @name doesNotThrow - * @param {Function} fn - * @param {ErrorConstructor} errorLike - * @param {RegExp|String} errMsgMatcher - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Assert - * @api public - */ - - assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) { - if ('string' === typeof errorLike || errorLike instanceof RegExp) { - errMsgMatcher = errorLike; - errorLike = null; - } - - new Assertion(fn, msg, assert.doesNotThrow, true) - .to.not.throw(errorLike, errMsgMatcher); - }; - - /** - * ### .operator(val1, operator, val2, [message]) - * - * Compares two values using `operator`. - * - * assert.operator(1, '<', 2, 'everything is ok'); - * assert.operator(1, '>', 2, 'this will fail'); - * - * @name operator - * @param {Mixed} val1 - * @param {String} operator - * @param {Mixed} val2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.operator = function (val, operator, val2, msg) { - var ok; - switch(operator) { - case '==': - ok = val == val2; - break; - case '===': - ok = val === val2; - break; - case '>': - ok = val > val2; - break; - case '>=': - ok = val >= val2; - break; - case '<': - ok = val < val2; - break; - case '<=': - ok = val <= val2; - break; - case '!=': - ok = val != val2; - break; - case '!==': - ok = val !== val2; - break; - default: - msg = msg ? msg + ': ' : msg; - throw new chai.AssertionError( - msg + 'Invalid operator "' + operator + '"', - undefined, - assert.operator - ); - } - var test = new Assertion(ok, msg, assert.operator, true); - test.assert( - true === flag(test, 'object') - , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2) - , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) ); - }; - - /** - * ### .closeTo(actual, expected, delta, [message]) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * assert.closeTo(1.5, 1, 0.5, 'numbers are close'); - * - * @name closeTo - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.closeTo = function (act, exp, delta, msg) { - new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta); - }; - - /** - * ### .approximately(actual, expected, delta, [message]) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * assert.approximately(1.5, 1, 0.5, 'numbers are close'); - * - * @name approximately - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.approximately = function (act, exp, delta, msg) { - new Assertion(act, msg, assert.approximately, true) - .to.be.approximately(exp, delta); - }; - - /** - * ### .sameMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in any order. Uses a - * strict equality check (===). - * - * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); - * - * @name sameMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameMembers, true) - .to.have.same.members(set2); - } - - /** - * ### .notSameMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in any order. - * Uses a strict equality check (===). - * - * assert.notSameMembers([ 1, 2, 3 ], [ 5, 1, 3 ], 'not same members'); - * - * @name notSameMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameMembers, true) - .to.not.have.same.members(set2); - } - - /** - * ### .sameDeepMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in any order. Uses a - * deep equality check. - * - * assert.sameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { c: 3 }], 'same deep members'); - * - * @name sameDeepMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameDeepMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameDeepMembers, true) - .to.have.same.deep.members(set2); - } - - /** - * ### .notSameDeepMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in any order. - * Uses a deep equality check. - * - * assert.notSameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { f: 5 }], 'not same deep members'); - * - * @name notSameDeepMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameDeepMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameDeepMembers, true) - .to.not.have.same.deep.members(set2); - } - - /** - * ### .sameOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in the same order. - * Uses a strict equality check (===). - * - * assert.sameOrderedMembers([ 1, 2, 3 ], [ 1, 2, 3 ], 'same ordered members'); - * - * @name sameOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameOrderedMembers, true) - .to.have.same.ordered.members(set2); - } - - /** - * ### .notSameOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in the same - * order. Uses a strict equality check (===). - * - * assert.notSameOrderedMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'not same ordered members'); - * - * @name notSameOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameOrderedMembers, true) - .to.not.have.same.ordered.members(set2); - } - - /** - * ### .sameDeepOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in the same order. - * Uses a deep equality check. - * - * assert.sameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { c: 3 } ], 'same deep ordered members'); - * - * @name sameDeepOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameDeepOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameDeepOrderedMembers, true) - .to.have.same.deep.ordered.members(set2); - } - - /** - * ### .notSameDeepOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in the same - * order. Uses a deep equality check. - * - * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { z: 5 } ], 'not same deep ordered members'); - * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { c: 3 } ], 'not same deep ordered members'); - * - * @name notSameDeepOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameDeepOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true) - .to.not.have.same.deep.ordered.members(set2); - } - - /** - * ### .includeMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in any order. Uses a - * strict equality check (===). Duplicates are ignored. - * - * assert.includeMembers([ 1, 2, 3 ], [ 2, 1, 2 ], 'include members'); - * - * @name includeMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeMembers, true) - .to.include.members(subset); - } - - /** - * ### .notIncludeMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in any order. Uses a - * strict equality check (===). Duplicates are ignored. - * - * assert.notIncludeMembers([ 1, 2, 3 ], [ 5, 1 ], 'not include members'); - * - * @name notIncludeMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeMembers, true) - .to.not.include.members(subset); - } - - /** - * ### .includeDeepMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in any order. Uses a deep - * equality check. Duplicates are ignored. - * - * assert.includeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { b: 2 } ], 'include deep members'); - * - * @name includeDeepMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeDeepMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeDeepMembers, true) - .to.include.deep.members(subset); - } - - /** - * ### .notIncludeDeepMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in any order. Uses a - * deep equality check. Duplicates are ignored. - * - * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members'); - * - * @name notIncludeDeepMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeDeepMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeDeepMembers, true) - .to.not.include.deep.members(subset); - } - - /** - * ### .includeOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in the same order - * beginning with the first element in `superset`. Uses a strict equality - * check (===). - * - * assert.includeOrderedMembers([ 1, 2, 3 ], [ 1, 2 ], 'include ordered members'); - * - * @name includeOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeOrderedMembers, true) - .to.include.ordered.members(subset); - } - - /** - * ### .notIncludeOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in the same order - * beginning with the first element in `superset`. Uses a strict equality - * check (===). - * - * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 1 ], 'not include ordered members'); - * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 3 ], 'not include ordered members'); - * - * @name notIncludeOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeOrderedMembers, true) - .to.not.include.ordered.members(subset); - } - - /** - * ### .includeDeepOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in the same order - * beginning with the first element in `superset`. Uses a deep equality - * check. - * - * assert.includeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 } ], 'include deep ordered members'); - * - * @name includeDeepOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeDeepOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeDeepOrderedMembers, true) - .to.include.deep.ordered.members(subset); - } - - /** - * ### .notIncludeDeepOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in the same order - * beginning with the first element in `superset`. Uses a deep equality - * check. - * - * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { f: 5 } ], 'not include deep ordered members'); - * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 } ], 'not include deep ordered members'); - * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { c: 3 } ], 'not include deep ordered members'); - * - * @name notIncludeDeepOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true) - .to.not.include.deep.ordered.members(subset); - } - - /** - * ### .oneOf(inList, list, [message]) - * - * Asserts that non-object, non-array value `inList` appears in the flat array `list`. - * - * assert.oneOf(1, [ 2, 1 ], 'Not found in list'); - * - * @name oneOf - * @param {*} inList - * @param {Array<*>} list - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.oneOf = function (inList, list, msg) { - new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list); - } - - /** - * ### .changes(function, object, property, [message]) - * - * Asserts that a function changes the value of a property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 22 }; - * assert.changes(fn, obj, 'val'); - * - * @name changes - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.changes = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - new Assertion(fn, msg, assert.changes, true).to.change(obj, prop); - } - - /** - * ### .changesBy(function, object, property, delta, [message]) - * - * Asserts that a function changes the value of a property by an amount (delta). - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 2 }; - * assert.changesBy(fn, obj, 'val', 2); - * - * @name changesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.changesBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.changesBy, true) - .to.change(obj, prop).by(delta); - } - - /** - * ### .doesNotChange(function, object, property, [message]) - * - * Asserts that a function does not change the value of a property. - * - * var obj = { val: 10 }; - * var fn = function() { console.log('foo'); }; - * assert.doesNotChange(fn, obj, 'val'); - * - * @name doesNotChange - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotChange = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotChange, true) - .to.not.change(obj, prop); - } - - /** - * ### .changesButNotBy(function, object, property, delta, [message]) - * - * Asserts that a function does not change the value of a property or of a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 10 }; - * assert.changesButNotBy(fn, obj, 'val', 5); - * - * @name changesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.changesButNotBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.changesButNotBy, true) - .to.change(obj, prop).but.not.by(delta); - } - - /** - * ### .increases(function, object, property, [message]) - * - * Asserts that a function increases a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 13 }; - * assert.increases(fn, obj, 'val'); - * - * @name increases - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.increases = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.increases, true) - .to.increase(obj, prop); - } - - /** - * ### .increasesBy(function, object, property, delta, [message]) - * - * Asserts that a function increases a numeric object property or a function's return value by an amount (delta). - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 10 }; - * assert.increasesBy(fn, obj, 'val', 10); - * - * @name increasesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.increasesBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.increasesBy, true) - .to.increase(obj, prop).by(delta); - } - - /** - * ### .doesNotIncrease(function, object, property, [message]) - * - * Asserts that a function does not increase a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 8 }; - * assert.doesNotIncrease(fn, obj, 'val'); - * - * @name doesNotIncrease - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotIncrease = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotIncrease, true) - .to.not.increase(obj, prop); - } - - /** - * ### .increasesButNotBy(function, object, property, delta, [message]) - * - * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta). - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * assert.increasesButNotBy(fn, obj, 'val', 10); - * - * @name increasesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.increasesButNotBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.increasesButNotBy, true) - .to.increase(obj, prop).but.not.by(delta); - } - - /** - * ### .decreases(function, object, property, [message]) - * - * Asserts that a function decreases a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.decreases(fn, obj, 'val'); - * - * @name decreases - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.decreases = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.decreases, true) - .to.decrease(obj, prop); - } - - /** - * ### .decreasesBy(function, object, property, delta, [message]) - * - * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val -= 5 }; - * assert.decreasesBy(fn, obj, 'val', 5); - * - * @name decreasesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.decreasesBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.decreasesBy, true) - .to.decrease(obj, prop).by(delta); - } - - /** - * ### .doesNotDecrease(function, object, property, [message]) - * - * Asserts that a function does not decreases a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * assert.doesNotDecrease(fn, obj, 'val'); - * - * @name doesNotDecrease - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotDecrease = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotDecrease, true) - .to.not.decrease(obj, prop); - } - - /** - * ### .doesNotDecreaseBy(function, object, property, delta, [message]) - * - * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.doesNotDecreaseBy(fn, obj, 'val', 1); - * - * @name doesNotDecreaseBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotDecreaseBy, true) - .to.not.decrease(obj, prop).by(delta); - } - - /** - * ### .decreasesButNotBy(function, object, property, delta, [message]) - * - * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.decreasesButNotBy(fn, obj, 'val', 1); - * - * @name decreasesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.decreasesButNotBy, true) - .to.decrease(obj, prop).but.not.by(delta); - } - - /*! - * ### .ifError(object) - * - * Asserts if value is not a false value, and throws if it is a true value. - * This is added to allow for chai to be a drop-in replacement for Node's - * assert class. - * - * var err = new Error('I am a custom error'); - * assert.ifError(err); // Rethrows err! - * - * @name ifError - * @param {Object} object - * @namespace Assert - * @api public - */ - - assert.ifError = function (val) { - if (val) { - throw(val); - } - }; - - /** - * ### .isExtensible(object) - * - * Asserts that `object` is extensible (can have new properties added to it). - * - * assert.isExtensible({}); - * - * @name isExtensible - * @alias extensible - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isExtensible = function (obj, msg) { - new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible; - }; - - /** - * ### .isNotExtensible(object) - * - * Asserts that `object` is _not_ extensible. - * - * var nonExtensibleObject = Object.preventExtensions({}); - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * assert.isNotExtensible(nonExtensibleObject); - * assert.isNotExtensible(sealedObject); - * assert.isNotExtensible(frozenObject); - * - * @name isNotExtensible - * @alias notExtensible - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotExtensible = function (obj, msg) { - new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible; - }; - - /** - * ### .isSealed(object) - * - * Asserts that `object` is sealed (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.seal({}); - * - * assert.isSealed(sealedObject); - * assert.isSealed(frozenObject); - * - * @name isSealed - * @alias sealed - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isSealed = function (obj, msg) { - new Assertion(obj, msg, assert.isSealed, true).to.be.sealed; - }; - - /** - * ### .isNotSealed(object) - * - * Asserts that `object` is _not_ sealed. - * - * assert.isNotSealed({}); - * - * @name isNotSealed - * @alias notSealed - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotSealed = function (obj, msg) { - new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed; - }; - - /** - * ### .isFrozen(object) - * - * Asserts that `object` is frozen (cannot have new properties added to it - * and its existing properties cannot be modified). - * - * var frozenObject = Object.freeze({}); - * assert.frozen(frozenObject); - * - * @name isFrozen - * @alias frozen - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isFrozen = function (obj, msg) { - new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen; - }; - - /** - * ### .isNotFrozen(object) - * - * Asserts that `object` is _not_ frozen. - * - * assert.isNotFrozen({}); - * - * @name isNotFrozen - * @alias notFrozen - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotFrozen = function (obj, msg) { - new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen; - }; - - /** - * ### .isEmpty(target) - * - * Asserts that the target does not contain any values. - * For arrays and strings, it checks the `length` property. - * For `Map` and `Set` instances, it checks the `size` property. - * For non-function objects, it gets the count of own - * enumerable string keys. - * - * assert.isEmpty([]); - * assert.isEmpty(''); - * assert.isEmpty(new Map); - * assert.isEmpty({}); - * - * @name isEmpty - * @alias empty - * @param {Object|Array|String|Map|Set} target - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isEmpty = function(val, msg) { - new Assertion(val, msg, assert.isEmpty, true).to.be.empty; - }; - - /** - * ### .isNotEmpty(target) - * - * Asserts that the target contains values. - * For arrays and strings, it checks the `length` property. - * For `Map` and `Set` instances, it checks the `size` property. - * For non-function objects, it gets the count of own - * enumerable string keys. - * - * assert.isNotEmpty([1, 2]); - * assert.isNotEmpty('34'); - * assert.isNotEmpty(new Set([5, 6])); - * assert.isNotEmpty({ key: 7 }); - * - * @name isNotEmpty - * @alias notEmpty - * @param {Object|Array|String|Map|Set} target - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotEmpty = function(val, msg) { - new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty; - }; - - /*! - * Aliases. - */ - - (function alias(name, as){ - assert[as] = assert[name]; - return alias; - }) - ('isOk', 'ok') - ('isNotOk', 'notOk') - ('throws', 'throw') - ('throws', 'Throw') - ('isExtensible', 'extensible') - ('isNotExtensible', 'notExtensible') - ('isSealed', 'sealed') - ('isNotSealed', 'notSealed') - ('isFrozen', 'frozen') - ('isNotFrozen', 'notFrozen') - ('isEmpty', 'empty') - ('isNotEmpty', 'notEmpty'); -}; - -},{}],7:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - chai.expect = function (val, message) { - return new chai.Assertion(val, message); - }; - - /** - * ### .fail([message]) - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * expect.fail(); - * expect.fail("custom error message"); - * expect.fail(1, 2); - * expect.fail(1, 2, "custom error message"); - * expect.fail(1, 2, "custom error message", ">"); - * expect.fail(1, 2, undefined, ">"); - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @namespace BDD - * @api public - */ - - chai.expect.fail = function (actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = undefined; - } - - message = message || 'expect.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, chai.expect.fail); - }; -}; - -},{}],8:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011-2014 Jake Luer - * MIT Licensed - */ - -module.exports = function (chai, util) { - var Assertion = chai.Assertion; - - function loadShould () { - // explicitly define this method as function as to have it's name to include as `ssfi` - function shouldGetter() { - if (this instanceof String - || this instanceof Number - || this instanceof Boolean - || typeof Symbol === 'function' && this instanceof Symbol - || typeof BigInt === 'function' && this instanceof BigInt) { - return new Assertion(this.valueOf(), null, shouldGetter); - } - return new Assertion(this, null, shouldGetter); - } - function shouldSetter(value) { - // See https://github.com/chaijs/chai/issues/86: this makes - // `whatever.should = someValue` actually set `someValue`, which is - // especially useful for `global.should = require('chai').should()`. - // - // Note that we have to use [[DefineProperty]] instead of [[Put]] - // since otherwise we would trigger this very setter! - Object.defineProperty(this, 'should', { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } - // modify Object.prototype to have `should` - Object.defineProperty(Object.prototype, 'should', { - set: shouldSetter - , get: shouldGetter - , configurable: true - }); - - var should = {}; - - /** - * ### .fail([message]) - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * should.fail(); - * should.fail("custom error message"); - * should.fail(1, 2); - * should.fail(1, 2, "custom error message"); - * should.fail(1, 2, "custom error message", ">"); - * should.fail(1, 2, undefined, ">"); - * - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @namespace BDD - * @api public - */ - - should.fail = function (actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = undefined; - } - - message = message || 'should.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, should.fail); - }; - - /** - * ### .equal(actual, expected, [message]) - * - * Asserts non-strict equality (`==`) of `actual` and `expected`. - * - * should.equal(3, '3', '== coerces values to strings'); - * - * @name equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Should - * @api public - */ - - should.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.equal(val2); - }; - - /** - * ### .throw(function, [constructor/string/regexp], [string/regexp], [message]) - * - * Asserts that `function` will throw an error that is an instance of - * `constructor`, or alternately that it will throw an error with message - * matching `regexp`. - * - * should.throw(fn, 'function throws a reference error'); - * should.throw(fn, /function throws a reference error/); - * should.throw(fn, ReferenceError); - * should.throw(fn, ReferenceError, 'function throws a reference error'); - * should.throw(fn, ReferenceError, /function throws a reference error/); - * - * @name throw - * @alias Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Should - * @api public - */ - - should.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.Throw(errt, errs); - }; - - /** - * ### .exist - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var foo = 'hi'; - * - * should.exist(foo, 'foo exists'); - * - * @name exist - * @namespace Should - * @api public - */ - - should.exist = function (val, msg) { - new Assertion(val, msg).to.exist; - } - - // negation - should.not = {} - - /** - * ### .not.equal(actual, expected, [message]) - * - * Asserts non-strict inequality (`!=`) of `actual` and `expected`. - * - * should.not.equal(3, 4, 'these numbers are not equal'); - * - * @name not.equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Should - * @api public - */ - - should.not.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.not.equal(val2); - }; - - /** - * ### .throw(function, [constructor/regexp], [message]) - * - * Asserts that `function` will _not_ throw an error that is an instance of - * `constructor`, or alternately that it will not throw an error with message - * matching `regexp`. - * - * should.not.throw(fn, Error, 'function does not throw'); - * - * @name not.throw - * @alias not.Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Should - * @api public - */ - - should.not.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.not.Throw(errt, errs); - }; - - /** - * ### .not.exist - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var bar = null; - * - * should.not.exist(bar, 'bar does not exist'); - * - * @name not.exist - * @namespace Should - * @api public - */ - - should.not.exist = function (val, msg) { - new Assertion(val, msg).to.not.exist; - } - - should['throw'] = should['Throw']; - should.not['throw'] = should.not['Throw']; - - return should; - }; - - chai.should = loadShould; - chai.Should = loadShould; -}; - -},{}],9:[function(require,module,exports){ -/*! - * Chai - addChainingMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var addLengthGuard = require('./addLengthGuard'); -var chai = require('../../chai'); -var flag = require('./flag'); -var proxify = require('./proxify'); -var transferFlags = require('./transferFlags'); - -/*! - * Module variables - */ - -// Check whether `Object.setPrototypeOf` is supported -var canSetPrototype = typeof Object.setPrototypeOf === 'function'; - -// Without `Object.setPrototypeOf` support, this module will need to add properties to a function. -// However, some of functions' own props are not configurable and should be skipped. -var testFn = function() {}; -var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) { - var propDesc = Object.getOwnPropertyDescriptor(testFn, name); - - // Note: PhantomJS 1.x includes `callee` as one of `testFn`'s own properties, - // but then returns `undefined` as the property descriptor for `callee`. As a - // workaround, we perform an otherwise unnecessary type-check for `propDesc`, - // and then filter it out if it's not an object as it should be. - if (typeof propDesc !== 'object') - return true; - - return !propDesc.configurable; -}); - -// Cache `Function` properties -var call = Function.prototype.call, - apply = Function.prototype.apply; - -/** - * ### .addChainableMethod(ctx, name, method, chainingBehavior) - * - * Adds a method to an object, such that the method can also be chained. - * - * utils.addChainableMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addChainableMethod('foo', fn, chainingBehavior); - * - * The result can then be used as both a method assertion, executing both `method` and - * `chainingBehavior`, or as a language chain, which only executes `chainingBehavior`. - * - * expect(fooStr).to.be.foo('bar'); - * expect(fooStr).to.be.foo.equal('foo'); - * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add - * @param {Function} method function to be used for `name`, when called - * @param {Function} chainingBehavior function to be called every time the property is accessed - * @namespace Utils - * @name addChainableMethod - * @api public - */ - -module.exports = function addChainableMethod(ctx, name, method, chainingBehavior) { - if (typeof chainingBehavior !== 'function') { - chainingBehavior = function () { }; - } - - var chainableBehavior = { - method: method - , chainingBehavior: chainingBehavior - }; - - // save the methods so we can overwrite them later, if we need to. - if (!ctx.__methods) { - ctx.__methods = {}; - } - ctx.__methods[name] = chainableBehavior; - - Object.defineProperty(ctx, name, - { get: function chainableMethodGetter() { - chainableBehavior.chainingBehavior.call(this); - - var chainableMethodWrapper = function () { - // Setting the `ssfi` flag to `chainableMethodWrapper` causes this - // function to be the starting point for removing implementation - // frames from the stack trace of a failed assertion. - // - // However, we only want to use this function as the starting point if - // the `lockSsfi` flag isn't set. - // - // If the `lockSsfi` flag is set, then this assertion is being - // invoked from inside of another assertion. In this case, the `ssfi` - // flag has already been set by the outer assertion. - // - // Note that overwriting a chainable method merely replaces the saved - // methods in `ctx.__methods` instead of completely replacing the - // overwritten assertion. Therefore, an overwriting assertion won't - // set the `ssfi` or `lockSsfi` flags. - if (!flag(this, 'lockSsfi')) { - flag(this, 'ssfi', chainableMethodWrapper); - } - - var result = chainableBehavior.method.apply(this, arguments); - if (result !== undefined) { - return result; - } - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }; - - addLengthGuard(chainableMethodWrapper, name, true); - - // Use `Object.setPrototypeOf` if available - if (canSetPrototype) { - // Inherit all properties from the object by replacing the `Function` prototype - var prototype = Object.create(this); - // Restore the `call` and `apply` methods from `Function` - prototype.call = call; - prototype.apply = apply; - Object.setPrototypeOf(chainableMethodWrapper, prototype); - } - // Otherwise, redefine all properties (slow!) - else { - var asserterNames = Object.getOwnPropertyNames(ctx); - asserterNames.forEach(function (asserterName) { - if (excludeNames.indexOf(asserterName) !== -1) { - return; - } - - var pd = Object.getOwnPropertyDescriptor(ctx, asserterName); - Object.defineProperty(chainableMethodWrapper, asserterName, pd); - }); - } - - transferFlags(this, chainableMethodWrapper); - return proxify(chainableMethodWrapper); - } - , configurable: true - }); -}; - -},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":30,"./transferFlags":32}],10:[function(require,module,exports){ -var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length'); - -/*! - * Chai - addLengthGuard utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .addLengthGuard(fn, assertionName, isChainable) - * - * Define `length` as a getter on the given uninvoked method assertion. The - * getter acts as a guard against chaining `length` directly off of an uninvoked - * method assertion, which is a problem because it references `function`'s - * built-in `length` property instead of Chai's `length` assertion. When the - * getter catches the user making this mistake, it throws an error with a - * helpful message. - * - * There are two ways in which this mistake can be made. The first way is by - * chaining the `length` assertion directly off of an uninvoked chainable - * method. In this case, Chai suggests that the user use `lengthOf` instead. The - * second way is by chaining the `length` assertion directly off of an uninvoked - * non-chainable method. Non-chainable methods must be invoked prior to - * chaining. In this case, Chai suggests that the user consult the docs for the - * given assertion. - * - * If the `length` property of functions is unconfigurable, then return `fn` - * without modification. - * - * Note that in ES6, the function's `length` property is configurable, so once - * support for legacy environments is dropped, Chai's `length` property can - * replace the built-in function's `length` property, and this length guard will - * no longer be necessary. In the mean time, maintaining consistency across all - * environments is the priority. - * - * @param {Function} fn - * @param {String} assertionName - * @param {Boolean} isChainable - * @namespace Utils - * @name addLengthGuard - */ - -module.exports = function addLengthGuard (fn, assertionName, isChainable) { - if (!fnLengthDesc.configurable) return fn; - - Object.defineProperty(fn, 'length', { - get: function () { - if (isChainable) { - throw Error('Invalid Chai property: ' + assertionName + '.length. Due' + - ' to a compatibility issue, "length" cannot directly follow "' + - assertionName + '". Use "' + assertionName + '.lengthOf" instead.'); - } - - throw Error('Invalid Chai property: ' + assertionName + '.length. See' + - ' docs for proper usage of "' + assertionName + '".'); - } - }); - - return fn; -}; - -},{}],11:[function(require,module,exports){ -/*! - * Chai - addMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var addLengthGuard = require('./addLengthGuard'); -var chai = require('../../chai'); -var flag = require('./flag'); -var proxify = require('./proxify'); -var transferFlags = require('./transferFlags'); - -/** - * ### .addMethod(ctx, name, method) - * - * Adds a method to the prototype of an object. - * - * utils.addMethod(chai.Assertion.prototype, 'foo', function (str) { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.equal(str); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addMethod('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(fooStr).to.be.foo('bar'); - * - * @param {Object} ctx object to which the method is added - * @param {String} name of method to add - * @param {Function} method function to be used for name - * @namespace Utils - * @name addMethod - * @api public - */ - -module.exports = function addMethod(ctx, name, method) { - var methodWrapper = function () { - // Setting the `ssfi` flag to `methodWrapper` causes this function to be the - // starting point for removing implementation frames from the stack trace of - // a failed assertion. - // - // However, we only want to use this function as the starting point if the - // `lockSsfi` flag isn't set. - // - // If the `lockSsfi` flag is set, then either this assertion has been - // overwritten by another assertion, or this assertion is being invoked from - // inside of another assertion. In the first case, the `ssfi` flag has - // already been set by the overwriting assertion. In the second case, the - // `ssfi` flag has already been set by the outer assertion. - if (!flag(this, 'lockSsfi')) { - flag(this, 'ssfi', methodWrapper); - } - - var result = method.apply(this, arguments); - if (result !== undefined) - return result; - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }; - - addLengthGuard(methodWrapper, name, false); - ctx[name] = proxify(methodWrapper, name); -}; - -},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":30,"./transferFlags":32}],12:[function(require,module,exports){ -/*! - * Chai - addProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var chai = require('../../chai'); -var flag = require('./flag'); -var isProxyEnabled = require('./isProxyEnabled'); -var transferFlags = require('./transferFlags'); - -/** - * ### .addProperty(ctx, name, getter) - * - * Adds a property to the prototype of an object. - * - * utils.addProperty(chai.Assertion.prototype, 'foo', function () { - * var obj = utils.flag(this, 'object'); - * new chai.Assertion(obj).to.be.instanceof(Foo); - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.addProperty('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.be.foo; - * - * @param {Object} ctx object to which the property is added - * @param {String} name of property to add - * @param {Function} getter function to be used for name - * @namespace Utils - * @name addProperty - * @api public - */ - -module.exports = function addProperty(ctx, name, getter) { - getter = getter === undefined ? function () {} : getter; - - Object.defineProperty(ctx, name, - { get: function propertyGetter() { - // Setting the `ssfi` flag to `propertyGetter` causes this function to - // be the starting point for removing implementation frames from the - // stack trace of a failed assertion. - // - // However, we only want to use this function as the starting point if - // the `lockSsfi` flag isn't set and proxy protection is disabled. - // - // If the `lockSsfi` flag is set, then either this assertion has been - // overwritten by another assertion, or this assertion is being invoked - // from inside of another assertion. In the first case, the `ssfi` flag - // has already been set by the overwriting assertion. In the second - // case, the `ssfi` flag has already been set by the outer assertion. - // - // If proxy protection is enabled, then the `ssfi` flag has already been - // set by the proxy getter. - if (!isProxyEnabled() && !flag(this, 'lockSsfi')) { - flag(this, 'ssfi', propertyGetter); - } - - var result = getter.call(this); - if (result !== undefined) - return result; - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - } - , configurable: true - }); -}; - -},{"../../chai":2,"./flag":15,"./isProxyEnabled":25,"./transferFlags":32}],13:[function(require,module,exports){ -/*! - * Chai - compareByInspect utility - * Copyright(c) 2011-2016 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var inspect = require('./inspect'); - -/** - * ### .compareByInspect(mixed, mixed) - * - * To be used as a compareFunction with Array.prototype.sort. Compares elements - * using inspect instead of default behavior of using toString so that Symbols - * and objects with irregular/missing toString can still be sorted without a - * TypeError. - * - * @param {Mixed} first element to compare - * @param {Mixed} second element to compare - * @returns {Number} -1 if 'a' should come before 'b'; otherwise 1 - * @name compareByInspect - * @namespace Utils - * @api public - */ - -module.exports = function compareByInspect(a, b) { - return inspect(a) < inspect(b) ? -1 : 1; -}; - -},{"./inspect":23}],14:[function(require,module,exports){ -/*! - * Chai - expectTypes utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .expectTypes(obj, types) - * - * Ensures that the object being tested against is of a valid type. - * - * utils.expectTypes(this, ['array', 'object', 'string']); - * - * @param {Mixed} obj constructed Assertion - * @param {Array} type A list of allowed types for this assertion - * @namespace Utils - * @name expectTypes - * @api public - */ - -var AssertionError = require('assertion-error'); -var flag = require('./flag'); -var type = require('type-detect'); - -module.exports = function expectTypes(obj, types) { - var flagMsg = flag(obj, 'message'); - var ssfi = flag(obj, 'ssfi'); - - flagMsg = flagMsg ? flagMsg + ': ' : ''; - - obj = flag(obj, 'object'); - types = types.map(function (t) { return t.toLowerCase(); }); - types.sort(); - - // Transforms ['lorem', 'ipsum'] into 'a lorem, or an ipsum' - var str = types.map(function (t, index) { - var art = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(t.charAt(0)) ? 'an' : 'a'; - var or = types.length > 1 && index === types.length - 1 ? 'or ' : ''; - return or + art + ' ' + t; - }).join(', '); - - var objType = type(obj).toLowerCase(); - - if (!types.some(function (expected) { return objType === expected; })) { - throw new AssertionError( - flagMsg + 'object tested must be ' + str + ', but ' + objType + ' given', - undefined, - ssfi - ); - } -}; - -},{"./flag":15,"assertion-error":33,"type-detect":38}],15:[function(require,module,exports){ -/*! - * Chai - flag utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .flag(object, key, [value]) - * - * Get or set a flag value on an object. If a - * value is provided it will be set, else it will - * return the currently set value or `undefined` if - * the value is not set. - * - * utils.flag(this, 'foo', 'bar'); // setter - * utils.flag(this, 'foo'); // getter, returns `bar` - * - * @param {Object} object constructed Assertion - * @param {String} key - * @param {Mixed} value (optional) - * @namespace Utils - * @name flag - * @api private - */ - -module.exports = function flag(obj, key, value) { - var flags = obj.__flags || (obj.__flags = Object.create(null)); - if (arguments.length === 3) { - flags[key] = value; - } else { - return flags[key]; - } -}; - -},{}],16:[function(require,module,exports){ -/*! - * Chai - getActual utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .getActual(object, [actual]) - * - * Returns the `actual` value for an Assertion. - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - * @namespace Utils - * @name getActual - */ - -module.exports = function getActual(obj, args) { - return args.length > 4 ? args[4] : obj._obj; -}; - -},{}],17:[function(require,module,exports){ -/*! - * Chai - message composition utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var flag = require('./flag') - , getActual = require('./getActual') - , objDisplay = require('./objDisplay'); - -/** - * ### .getMessage(object, message, negateMessage) - * - * Construct the error message based on flags - * and template tags. Template tags will return - * a stringified inspection of the object referenced. - * - * Message template tags: - * - `#{this}` current asserted object - * - `#{act}` actual value - * - `#{exp}` expected value - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - * @namespace Utils - * @name getMessage - * @api public - */ - -module.exports = function getMessage(obj, args) { - var negate = flag(obj, 'negate') - , val = flag(obj, 'object') - , expected = args[3] - , actual = getActual(obj, args) - , msg = negate ? args[2] : args[1] - , flagMsg = flag(obj, 'message'); - - if(typeof msg === "function") msg = msg(); - msg = msg || ''; - msg = msg - .replace(/#\{this\}/g, function () { return objDisplay(val); }) - .replace(/#\{act\}/g, function () { return objDisplay(actual); }) - .replace(/#\{exp\}/g, function () { return objDisplay(expected); }); - - return flagMsg ? flagMsg + ': ' + msg : msg; -}; - -},{"./flag":15,"./getActual":16,"./objDisplay":26}],18:[function(require,module,exports){ -var type = require('type-detect'); - -var flag = require('./flag'); - -function isObjectType(obj) { - var objectType = type(obj); - var objectTypes = ['Array', 'Object', 'function']; - - return objectTypes.indexOf(objectType) !== -1; -} - -/** - * ### .getOperator(message) - * - * Extract the operator from error message. - * Operator defined is based on below link - * https://nodejs.org/api/assert.html#assert_assert. - * - * Returns the `operator` or `undefined` value for an Assertion. - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - * @namespace Utils - * @name getOperator - * @api public - */ - -module.exports = function getOperator(obj, args) { - var operator = flag(obj, 'operator'); - var negate = flag(obj, 'negate'); - var expected = args[3]; - var msg = negate ? args[2] : args[1]; - - if (operator) { - return operator; - } - - if (typeof msg === 'function') msg = msg(); - - msg = msg || ''; - if (!msg) { - return undefined; - } - - if (/\shave\s/.test(msg)) { - return undefined; - } - - var isObject = isObjectType(expected); - if (/\snot\s/.test(msg)) { - return isObject ? 'notDeepStrictEqual' : 'notStrictEqual'; - } - - return isObject ? 'deepStrictEqual' : 'strictEqual'; -}; - -},{"./flag":15,"type-detect":38}],19:[function(require,module,exports){ -/*! - * Chai - getOwnEnumerableProperties utility - * Copyright(c) 2011-2016 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols'); - -/** - * ### .getOwnEnumerableProperties(object) - * - * This allows the retrieval of directly-owned enumerable property names and - * symbols of an object. This function is necessary because Object.keys only - * returns enumerable property names, not enumerable property symbols. - * - * @param {Object} object - * @returns {Array} - * @namespace Utils - * @name getOwnEnumerableProperties - * @api public - */ - -module.exports = function getOwnEnumerableProperties(obj) { - return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj)); -}; - -},{"./getOwnEnumerablePropertySymbols":20}],20:[function(require,module,exports){ -/*! - * Chai - getOwnEnumerablePropertySymbols utility - * Copyright(c) 2011-2016 Jake Luer - * MIT Licensed - */ - -/** - * ### .getOwnEnumerablePropertySymbols(object) - * - * This allows the retrieval of directly-owned enumerable property symbols of an - * object. This function is necessary because Object.getOwnPropertySymbols - * returns both enumerable and non-enumerable property symbols. - * - * @param {Object} object - * @returns {Array} - * @namespace Utils - * @name getOwnEnumerablePropertySymbols - * @api public - */ - -module.exports = function getOwnEnumerablePropertySymbols(obj) { - if (typeof Object.getOwnPropertySymbols !== 'function') return []; - - return Object.getOwnPropertySymbols(obj).filter(function (sym) { - return Object.getOwnPropertyDescriptor(obj, sym).enumerable; - }); -}; - -},{}],21:[function(require,module,exports){ -/*! - * Chai - getProperties utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .getProperties(object) - * - * This allows the retrieval of property names of an object, enumerable or not, - * inherited or not. - * - * @param {Object} object - * @returns {Array} - * @namespace Utils - * @name getProperties - * @api public - */ - -module.exports = function getProperties(object) { - var result = Object.getOwnPropertyNames(object); - - function addProperty(property) { - if (result.indexOf(property) === -1) { - result.push(property); - } - } - - var proto = Object.getPrototypeOf(object); - while (proto !== null) { - Object.getOwnPropertyNames(proto).forEach(addProperty); - proto = Object.getPrototypeOf(proto); - } - - return result; -}; - -},{}],22:[function(require,module,exports){ -/*! - * chai - * Copyright(c) 2011 Jake Luer - * MIT Licensed - */ - -/*! - * Dependencies that are used for multiple exports are required here only once - */ - -var pathval = require('pathval'); - -/*! - * test utility - */ - -exports.test = require('./test'); - -/*! - * type utility - */ - -exports.type = require('type-detect'); - -/*! - * expectTypes utility - */ -exports.expectTypes = require('./expectTypes'); - -/*! - * message utility - */ - -exports.getMessage = require('./getMessage'); - -/*! - * actual utility - */ - -exports.getActual = require('./getActual'); - -/*! - * Inspect util - */ - -exports.inspect = require('./inspect'); - -/*! - * Object Display util - */ - -exports.objDisplay = require('./objDisplay'); - -/*! - * Flag utility - */ - -exports.flag = require('./flag'); - -/*! - * Flag transferring utility - */ - -exports.transferFlags = require('./transferFlags'); - -/*! - * Deep equal utility - */ - -exports.eql = require('deep-eql'); - -/*! - * Deep path info - */ - -exports.getPathInfo = pathval.getPathInfo; - -/*! - * Check if a property exists - */ - -exports.hasProperty = pathval.hasProperty; - -/*! - * Function name - */ - -exports.getName = function(fn) { - return fn.name -} - -/*! - * add Property - */ - -exports.addProperty = require('./addProperty'); - -/*! - * add Method - */ - -exports.addMethod = require('./addMethod'); - -/*! - * overwrite Property - */ - -exports.overwriteProperty = require('./overwriteProperty'); - -/*! - * overwrite Method - */ - -exports.overwriteMethod = require('./overwriteMethod'); - -/*! - * Add a chainable method - */ - -exports.addChainableMethod = require('./addChainableMethod'); - -/*! - * Overwrite chainable method - */ - -exports.overwriteChainableMethod = require('./overwriteChainableMethod'); - -/*! - * Compare by inspect method - */ - -exports.compareByInspect = require('./compareByInspect'); - -/*! - * Get own enumerable property symbols method - */ - -exports.getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols'); - -/*! - * Get own enumerable properties method - */ - -exports.getOwnEnumerableProperties = require('./getOwnEnumerableProperties'); - -/*! - * Checks error against a given set of criteria - */ - -exports.checkError = require('check-error'); - -/*! - * Proxify util - */ - -exports.proxify = require('./proxify'); - -/*! - * addLengthGuard util - */ - -exports.addLengthGuard = require('./addLengthGuard'); - -/*! - * isProxyEnabled helper - */ - -exports.isProxyEnabled = require('./isProxyEnabled'); - -/*! - * isNaN method - */ - -exports.isNaN = require('./isNaN'); - -/*! - * getOperator method - */ - -exports.getOperator = require('./getOperator'); - -},{"./addChainableMethod":9,"./addLengthGuard":10,"./addMethod":11,"./addProperty":12,"./compareByInspect":13,"./expectTypes":14,"./flag":15,"./getActual":16,"./getMessage":17,"./getOperator":18,"./getOwnEnumerableProperties":19,"./getOwnEnumerablePropertySymbols":20,"./inspect":23,"./isNaN":24,"./isProxyEnabled":25,"./objDisplay":26,"./overwriteChainableMethod":27,"./overwriteMethod":28,"./overwriteProperty":29,"./proxify":30,"./test":31,"./transferFlags":32,"check-error":34,"deep-eql":35,"pathval":37,"type-detect":38}],23:[function(require,module,exports){ -// This is (almost) directly from Node.js utils -// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js - -var loupe = require('loupe'); -var config = require('../config'); - -module.exports = inspect; - -/** - * ### .inspect(obj, [showHidden], [depth], [colors]) - * - * Echoes the value of a value. Tries to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Boolean} showHidden Flag that shows hidden (not enumerable) - * properties of objects. Default is false. - * @param {Number} depth Depth in which to descend in object. Default is 2. - * @param {Boolean} colors Flag to turn on ANSI escape codes to color the - * output. Default is false (no coloring). - * @namespace Utils - * @name inspect - */ -function inspect(obj, showHidden, depth, colors) { - var options = { - colors: colors, - depth: (typeof depth === 'undefined' ? 2 : depth), - showHidden: showHidden, - truncate: config.truncateThreshold ? config.truncateThreshold : Infinity, - }; - return loupe.inspect(obj, options); -} - -},{"../config":4,"loupe":36}],24:[function(require,module,exports){ -/*! - * Chai - isNaN utility - * Copyright(c) 2012-2015 Sakthipriyan Vairamani - * MIT Licensed - */ - -/** - * ### .isNaN(value) - * - * Checks if the given value is NaN or not. - * - * utils.isNaN(NaN); // true - * - * @param {Value} The value which has to be checked if it is NaN - * @name isNaN - * @api private - */ - -function isNaN(value) { - // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number - // section's NOTE. - return value !== value; -} - -// If ECMAScript 6's Number.isNaN is present, prefer that. -module.exports = Number.isNaN || isNaN; - -},{}],25:[function(require,module,exports){ -var config = require('../config'); - -/*! - * Chai - isProxyEnabled helper - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .isProxyEnabled() - * - * Helper function to check if Chai's proxy protection feature is enabled. If - * proxies are unsupported or disabled via the user's Chai config, then return - * false. Otherwise, return true. - * - * @namespace Utils - * @name isProxyEnabled - */ - -module.exports = function isProxyEnabled() { - return config.useProxy && - typeof Proxy !== 'undefined' && - typeof Reflect !== 'undefined'; -}; - -},{"../config":4}],26:[function(require,module,exports){ -/*! - * Chai - flag utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var inspect = require('./inspect'); -var config = require('../config'); - -/** - * ### .objDisplay(object) - * - * Determines if an object or an array matches - * criteria to be inspected in-line for error - * messages or should be truncated. - * - * @param {Mixed} javascript object to inspect - * @name objDisplay - * @namespace Utils - * @api public - */ - -module.exports = function objDisplay(obj) { - var str = inspect(obj) - , type = Object.prototype.toString.call(obj); - - if (config.truncateThreshold && str.length >= config.truncateThreshold) { - if (type === '[object Function]') { - return !obj.name || obj.name === '' - ? '[Function]' - : '[Function: ' + obj.name + ']'; - } else if (type === '[object Array]') { - return '[ Array(' + obj.length + ') ]'; - } else if (type === '[object Object]') { - var keys = Object.keys(obj) - , kstr = keys.length > 2 - ? keys.splice(0, 2).join(', ') + ', ...' - : keys.join(', '); - return '{ Object (' + kstr + ') }'; - } else { - return str; - } - } else { - return str; - } -}; - -},{"../config":4,"./inspect":23}],27:[function(require,module,exports){ -/*! - * Chai - overwriteChainableMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var chai = require('../../chai'); -var transferFlags = require('./transferFlags'); - -/** - * ### .overwriteChainableMethod(ctx, name, method, chainingBehavior) - * - * Overwrites an already existing chainable method - * and provides access to the previous function or - * property. Must return functions to be used for - * name. - * - * utils.overwriteChainableMethod(chai.Assertion.prototype, 'lengthOf', - * function (_super) { - * } - * , function (_super) { - * } - * ); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteChainableMethod('foo', fn, fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.have.lengthOf(3); - * expect(myFoo).to.have.lengthOf.above(3); - * - * @param {Object} ctx object whose method / property is to be overwritten - * @param {String} name of method / property to overwrite - * @param {Function} method function that returns a function to be used for name - * @param {Function} chainingBehavior function that returns a function to be used for property - * @namespace Utils - * @name overwriteChainableMethod - * @api public - */ - -module.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) { - var chainableBehavior = ctx.__methods[name]; - - var _chainingBehavior = chainableBehavior.chainingBehavior; - chainableBehavior.chainingBehavior = function overwritingChainableMethodGetter() { - var result = chainingBehavior(_chainingBehavior).call(this); - if (result !== undefined) { - return result; - } - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }; - - var _method = chainableBehavior.method; - chainableBehavior.method = function overwritingChainableMethodWrapper() { - var result = method(_method).apply(this, arguments); - if (result !== undefined) { - return result; - } - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }; -}; - -},{"../../chai":2,"./transferFlags":32}],28:[function(require,module,exports){ -/*! - * Chai - overwriteMethod utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var addLengthGuard = require('./addLengthGuard'); -var chai = require('../../chai'); -var flag = require('./flag'); -var proxify = require('./proxify'); -var transferFlags = require('./transferFlags'); - -/** - * ### .overwriteMethod(ctx, name, fn) - * - * Overwrites an already existing method and provides - * access to previous function. Must return function - * to be used for name. - * - * utils.overwriteMethod(chai.Assertion.prototype, 'equal', function (_super) { - * return function (str) { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.value).to.equal(str); - * } else { - * _super.apply(this, arguments); - * } - * } - * }); - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteMethod('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.equal('bar'); - * - * @param {Object} ctx object whose method is to be overwritten - * @param {String} name of method to overwrite - * @param {Function} method function that returns a function to be used for name - * @namespace Utils - * @name overwriteMethod - * @api public - */ - -module.exports = function overwriteMethod(ctx, name, method) { - var _method = ctx[name] - , _super = function () { - throw new Error(name + ' is not a function'); - }; - - if (_method && 'function' === typeof _method) - _super = _method; - - var overwritingMethodWrapper = function () { - // Setting the `ssfi` flag to `overwritingMethodWrapper` causes this - // function to be the starting point for removing implementation frames from - // the stack trace of a failed assertion. - // - // However, we only want to use this function as the starting point if the - // `lockSsfi` flag isn't set. - // - // If the `lockSsfi` flag is set, then either this assertion has been - // overwritten by another assertion, or this assertion is being invoked from - // inside of another assertion. In the first case, the `ssfi` flag has - // already been set by the overwriting assertion. In the second case, the - // `ssfi` flag has already been set by the outer assertion. - if (!flag(this, 'lockSsfi')) { - flag(this, 'ssfi', overwritingMethodWrapper); - } - - // Setting the `lockSsfi` flag to `true` prevents the overwritten assertion - // from changing the `ssfi` flag. By this point, the `ssfi` flag is already - // set to the correct starting point for this assertion. - var origLockSsfi = flag(this, 'lockSsfi'); - flag(this, 'lockSsfi', true); - var result = method(_super).apply(this, arguments); - flag(this, 'lockSsfi', origLockSsfi); - - if (result !== undefined) { - return result; - } - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - } - - addLengthGuard(overwritingMethodWrapper, name, false); - ctx[name] = proxify(overwritingMethodWrapper, name); -}; - -},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":30,"./transferFlags":32}],29:[function(require,module,exports){ -/*! - * Chai - overwriteProperty utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -var chai = require('../../chai'); -var flag = require('./flag'); -var isProxyEnabled = require('./isProxyEnabled'); -var transferFlags = require('./transferFlags'); - -/** - * ### .overwriteProperty(ctx, name, fn) - * - * Overwrites an already existing property getter and provides - * access to previous value. Must return function to use as getter. - * - * utils.overwriteProperty(chai.Assertion.prototype, 'ok', function (_super) { - * return function () { - * var obj = utils.flag(this, 'object'); - * if (obj instanceof Foo) { - * new chai.Assertion(obj.name).to.equal('bar'); - * } else { - * _super.call(this); - * } - * } - * }); - * - * - * Can also be accessed directly from `chai.Assertion`. - * - * chai.Assertion.overwriteProperty('foo', fn); - * - * Then can be used as any other assertion. - * - * expect(myFoo).to.be.ok; - * - * @param {Object} ctx object whose property is to be overwritten - * @param {String} name of property to overwrite - * @param {Function} getter function that returns a getter function to be used for name - * @namespace Utils - * @name overwriteProperty - * @api public - */ - -module.exports = function overwriteProperty(ctx, name, getter) { - var _get = Object.getOwnPropertyDescriptor(ctx, name) - , _super = function () {}; - - if (_get && 'function' === typeof _get.get) - _super = _get.get - - Object.defineProperty(ctx, name, - { get: function overwritingPropertyGetter() { - // Setting the `ssfi` flag to `overwritingPropertyGetter` causes this - // function to be the starting point for removing implementation frames - // from the stack trace of a failed assertion. - // - // However, we only want to use this function as the starting point if - // the `lockSsfi` flag isn't set and proxy protection is disabled. - // - // If the `lockSsfi` flag is set, then either this assertion has been - // overwritten by another assertion, or this assertion is being invoked - // from inside of another assertion. In the first case, the `ssfi` flag - // has already been set by the overwriting assertion. In the second - // case, the `ssfi` flag has already been set by the outer assertion. - // - // If proxy protection is enabled, then the `ssfi` flag has already been - // set by the proxy getter. - if (!isProxyEnabled() && !flag(this, 'lockSsfi')) { - flag(this, 'ssfi', overwritingPropertyGetter); - } - - // Setting the `lockSsfi` flag to `true` prevents the overwritten - // assertion from changing the `ssfi` flag. By this point, the `ssfi` - // flag is already set to the correct starting point for this assertion. - var origLockSsfi = flag(this, 'lockSsfi'); - flag(this, 'lockSsfi', true); - var result = getter(_super).call(this); - flag(this, 'lockSsfi', origLockSsfi); - - if (result !== undefined) { - return result; - } - - var newAssertion = new chai.Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - } - , configurable: true - }); -}; - -},{"../../chai":2,"./flag":15,"./isProxyEnabled":25,"./transferFlags":32}],30:[function(require,module,exports){ -var config = require('../config'); -var flag = require('./flag'); -var getProperties = require('./getProperties'); -var isProxyEnabled = require('./isProxyEnabled'); - -/*! - * Chai - proxify utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .proxify(object) - * - * Return a proxy of given object that throws an error when a non-existent - * property is read. By default, the root cause is assumed to be a misspelled - * property, and thus an attempt is made to offer a reasonable suggestion from - * the list of existing properties. However, if a nonChainableMethodName is - * provided, then the root cause is instead a failure to invoke a non-chainable - * method prior to reading the non-existent property. - * - * If proxies are unsupported or disabled via the user's Chai config, then - * return object without modification. - * - * @param {Object} obj - * @param {String} nonChainableMethodName - * @namespace Utils - * @name proxify - */ - -var builtins = ['__flags', '__methods', '_obj', 'assert']; - -module.exports = function proxify(obj, nonChainableMethodName) { - if (!isProxyEnabled()) return obj; - - return new Proxy(obj, { - get: function proxyGetter(target, property) { - // This check is here because we should not throw errors on Symbol properties - // such as `Symbol.toStringTag`. - // The values for which an error should be thrown can be configured using - // the `config.proxyExcludedKeys` setting. - if (typeof property === 'string' && - config.proxyExcludedKeys.indexOf(property) === -1 && - !Reflect.has(target, property)) { - // Special message for invalid property access of non-chainable methods. - if (nonChainableMethodName) { - throw Error('Invalid Chai property: ' + nonChainableMethodName + '.' + - property + '. See docs for proper usage of "' + - nonChainableMethodName + '".'); - } - - // If the property is reasonably close to an existing Chai property, - // suggest that property to the user. Only suggest properties with a - // distance less than 4. - var suggestion = null; - var suggestionDistance = 4; - getProperties(target).forEach(function(prop) { - if ( - !Object.prototype.hasOwnProperty(prop) && - builtins.indexOf(prop) === -1 - ) { - var dist = stringDistanceCapped( - property, - prop, - suggestionDistance - ); - if (dist < suggestionDistance) { - suggestion = prop; - suggestionDistance = dist; - } - } - }); - - if (suggestion !== null) { - throw Error('Invalid Chai property: ' + property + - '. Did you mean "' + suggestion + '"?'); - } else { - throw Error('Invalid Chai property: ' + property); - } - } - - // Use this proxy getter as the starting point for removing implementation - // frames from the stack trace of a failed assertion. For property - // assertions, this prevents the proxy getter from showing up in the stack - // trace since it's invoked before the property getter. For method and - // chainable method assertions, this flag will end up getting changed to - // the method wrapper, which is good since this frame will no longer be in - // the stack once the method is invoked. Note that Chai builtin assertion - // properties such as `__flags` are skipped since this is only meant to - // capture the starting point of an assertion. This step is also skipped - // if the `lockSsfi` flag is set, thus indicating that this assertion is - // being called from within another assertion. In that case, the `ssfi` - // flag is already set to the outer assertion's starting point. - if (builtins.indexOf(property) === -1 && !flag(target, 'lockSsfi')) { - flag(target, 'ssfi', proxyGetter); - } - - return Reflect.get(target, property); - } - }); -}; - -/** - * # stringDistanceCapped(strA, strB, cap) - * Return the Levenshtein distance between two strings, but no more than cap. - * @param {string} strA - * @param {string} strB - * @param {number} number - * @return {number} min(string distance between strA and strB, cap) - * @api private - */ - -function stringDistanceCapped(strA, strB, cap) { - if (Math.abs(strA.length - strB.length) >= cap) { - return cap; - } - - var memo = []; - // `memo` is a two-dimensional array containing distances. - // memo[i][j] is the distance between strA.slice(0, i) and - // strB.slice(0, j). - for (var i = 0; i <= strA.length; i++) { - memo[i] = Array(strB.length + 1).fill(0); - memo[i][0] = i; - } - for (var j = 0; j < strB.length; j++) { - memo[0][j] = j; - } - - for (var i = 1; i <= strA.length; i++) { - var ch = strA.charCodeAt(i - 1); - for (var j = 1; j <= strB.length; j++) { - if (Math.abs(i - j) >= cap) { - memo[i][j] = cap; - continue; - } - memo[i][j] = Math.min( - memo[i - 1][j] + 1, - memo[i][j - 1] + 1, - memo[i - 1][j - 1] + - (ch === strB.charCodeAt(j - 1) ? 0 : 1) - ); - } - } - - return memo[strA.length][strB.length]; -} - -},{"../config":4,"./flag":15,"./getProperties":21,"./isProxyEnabled":25}],31:[function(require,module,exports){ -/*! - * Chai - test utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/*! - * Module dependencies - */ - -var flag = require('./flag'); - -/** - * ### .test(object, expression) - * - * Test and object for expression. - * - * @param {Object} object (constructed Assertion) - * @param {Arguments} chai.Assertion.prototype.assert arguments - * @namespace Utils - * @name test - */ - -module.exports = function test(obj, args) { - var negate = flag(obj, 'negate') - , expr = args[0]; - return negate ? !expr : expr; -}; - -},{"./flag":15}],32:[function(require,module,exports){ -/*! - * Chai - transferFlags utility - * Copyright(c) 2012-2014 Jake Luer - * MIT Licensed - */ - -/** - * ### .transferFlags(assertion, object, includeAll = true) - * - * Transfer all the flags for `assertion` to `object`. If - * `includeAll` is set to `false`, then the base Chai - * assertion flags (namely `object`, `ssfi`, `lockSsfi`, - * and `message`) will not be transferred. - * - * - * var newAssertion = new Assertion(); - * utils.transferFlags(assertion, newAssertion); - * - * var anotherAssertion = new Assertion(myObj); - * utils.transferFlags(assertion, anotherAssertion, false); - * - * @param {Assertion} assertion the assertion to transfer the flags from - * @param {Object} object the object to transfer the flags to; usually a new assertion - * @param {Boolean} includeAll - * @namespace Utils - * @name transferFlags - * @api private - */ - -module.exports = function transferFlags(assertion, object, includeAll) { - var flags = assertion.__flags || (assertion.__flags = Object.create(null)); - - if (!object.__flags) { - object.__flags = Object.create(null); - } - - includeAll = arguments.length === 3 ? includeAll : true; - - for (var flag in flags) { - if (includeAll || - (flag !== 'object' && flag !== 'ssfi' && flag !== 'lockSsfi' && flag != 'message')) { - object.__flags[flag] = flags[flag]; - } - } -}; - -},{}],33:[function(require,module,exports){ -/*! - * assertion-error - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - -/*! - * Return a function that will copy properties from - * one object to another excluding any originally - * listed. Returned function will create a new `{}`. - * - * @param {String} excluded properties ... - * @return {Function} - */ - -function exclude () { - var excludes = [].slice.call(arguments); - - function excludeProps (res, obj) { - Object.keys(obj).forEach(function (key) { - if (!~excludes.indexOf(key)) res[key] = obj[key]; - }); - } - - return function extendExclude () { - var args = [].slice.call(arguments) - , i = 0 - , res = {}; - - for (; i < args.length; i++) { - excludeProps(res, args[i]); - } - - return res; - }; -}; - -/*! - * Primary Exports - */ - -module.exports = AssertionError; - -/** - * ### AssertionError - * - * An extension of the JavaScript `Error` constructor for - * assertion and validation scenarios. - * - * @param {String} message - * @param {Object} properties to include (optional) - * @param {callee} start stack function (optional) - */ - -function AssertionError (message, _props, ssf) { - var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON') - , props = extend(_props || {}); - - // default values - this.message = message || 'Unspecified AssertionError'; - this.showDiff = false; - - // copy from properties - for (var key in props) { - this[key] = props[key]; - } - - // capture stack trace - ssf = ssf || AssertionError; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, ssf); - } else { - try { - throw new Error(); - } catch(e) { - this.stack = e.stack; - } - } -} - -/*! - * Inherit from Error.prototype - */ - -AssertionError.prototype = Object.create(Error.prototype); - -/*! - * Statically set name - */ - -AssertionError.prototype.name = 'AssertionError'; - -/*! - * Ensure correct constructor - */ - -AssertionError.prototype.constructor = AssertionError; - -/** - * Allow errors to be converted to JSON for static transfer. - * - * @param {Boolean} include stack (default: `true`) - * @return {Object} object that can be `JSON.stringify` - */ - -AssertionError.prototype.toJSON = function (stack) { - var extend = exclude('constructor', 'toJSON', 'stack') - , props = extend({ name: this.name }, this); - - // include stack if exists and not turned off - if (false !== stack && this.stack) { - props.stack = this.stack; - } - - return props; -}; - -},{}],34:[function(require,module,exports){ -'use strict'; - -/* ! - * Chai - checkError utility - * Copyright(c) 2012-2016 Jake Luer - * MIT Licensed - */ - -/** - * ### .checkError - * - * Checks that an error conforms to a given set of criteria and/or retrieves information about it. - * - * @api public - */ - -/** - * ### .compatibleInstance(thrown, errorLike) - * - * Checks if two instances are compatible (strict equal). - * Returns false if errorLike is not an instance of Error, because instances - * can only be compatible if they're both error instances. - * - * @name compatibleInstance - * @param {Error} thrown error - * @param {Error|ErrorConstructor} errorLike object to compare against - * @namespace Utils - * @api public - */ - -function compatibleInstance(thrown, errorLike) { - return errorLike instanceof Error && thrown === errorLike; -} - -/** - * ### .compatibleConstructor(thrown, errorLike) - * - * Checks if two constructors are compatible. - * This function can receive either an error constructor or - * an error instance as the `errorLike` argument. - * Constructors are compatible if they're the same or if one is - * an instance of another. - * - * @name compatibleConstructor - * @param {Error} thrown error - * @param {Error|ErrorConstructor} errorLike object to compare against - * @namespace Utils - * @api public - */ - -function compatibleConstructor(thrown, errorLike) { - if (errorLike instanceof Error) { - // If `errorLike` is an instance of any error we compare their constructors - return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor; - } else if (errorLike.prototype instanceof Error || errorLike === Error) { - // If `errorLike` is a constructor that inherits from Error, we compare `thrown` to `errorLike` directly - return thrown.constructor === errorLike || thrown instanceof errorLike; - } - - return false; -} - -/** - * ### .compatibleMessage(thrown, errMatcher) - * - * Checks if an error's message is compatible with a matcher (String or RegExp). - * If the message contains the String or passes the RegExp test, - * it is considered compatible. - * - * @name compatibleMessage - * @param {Error} thrown error - * @param {String|RegExp} errMatcher to look for into the message - * @namespace Utils - * @api public - */ - -function compatibleMessage(thrown, errMatcher) { - var comparisonString = typeof thrown === 'string' ? thrown : thrown.message; - if (errMatcher instanceof RegExp) { - return errMatcher.test(comparisonString); - } else if (typeof errMatcher === 'string') { - return comparisonString.indexOf(errMatcher) !== -1; // eslint-disable-line no-magic-numbers - } - - return false; -} - -/** - * ### .getFunctionName(constructorFn) - * - * Returns the name of a function. - * This also includes a polyfill function if `constructorFn.name` is not defined. - * - * @name getFunctionName - * @param {Function} constructorFn - * @namespace Utils - * @api private - */ - -var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\(\/]+)/; -function getFunctionName(constructorFn) { - var name = ''; - if (typeof constructorFn.name === 'undefined') { - // Here we run a polyfill if constructorFn.name is not defined - var match = String(constructorFn).match(functionNameMatch); - if (match) { - name = match[1]; - } - } else { - name = constructorFn.name; - } - - return name; -} - -/** - * ### .getConstructorName(errorLike) - * - * Gets the constructor name for an Error instance or constructor itself. - * - * @name getConstructorName - * @param {Error|ErrorConstructor} errorLike - * @namespace Utils - * @api public - */ - -function getConstructorName(errorLike) { - var constructorName = errorLike; - if (errorLike instanceof Error) { - constructorName = getFunctionName(errorLike.constructor); - } else if (typeof errorLike === 'function') { - // If `err` is not an instance of Error it is an error constructor itself or another function. - // If we've got a common function we get its name, otherwise we may need to create a new instance - // of the error just in case it's a poorly-constructed error. Please see chaijs/chai/issues/45 to know more. - constructorName = getFunctionName(errorLike).trim() || - getFunctionName(new errorLike()); // eslint-disable-line new-cap - } - - return constructorName; -} - -/** - * ### .getMessage(errorLike) - * - * Gets the error message from an error. - * If `err` is a String itself, we return it. - * If the error has no message, we return an empty string. - * - * @name getMessage - * @param {Error|String} errorLike - * @namespace Utils - * @api public - */ - -function getMessage(errorLike) { - var msg = ''; - if (errorLike && errorLike.message) { - msg = errorLike.message; - } else if (typeof errorLike === 'string') { - msg = errorLike; - } - - return msg; -} - -module.exports = { - compatibleInstance: compatibleInstance, - compatibleConstructor: compatibleConstructor, - compatibleMessage: compatibleMessage, - getMessage: getMessage, - getConstructorName: getConstructorName, -}; - -},{}],35:[function(require,module,exports){ -'use strict'; -/* globals Symbol: false, Uint8Array: false, WeakMap: false */ -/*! - * deep-eql - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - -var type = require('type-detect'); -function FakeMap() { - this._key = 'chai/deep-eql__' + Math.random() + Date.now(); -} - -FakeMap.prototype = { - get: function getMap(key) { - return key[this._key]; - }, - set: function setMap(key, value) { - if (Object.isExtensible(key)) { - Object.defineProperty(key, this._key, { - value: value, - configurable: true, - }); - } - }, -}; - -var MemoizeMap = typeof WeakMap === 'function' ? WeakMap : FakeMap; -/*! - * Check to see if the MemoizeMap has recorded a result of the two operands - * - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @param {MemoizeMap} memoizeMap - * @returns {Boolean|null} result -*/ -function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) { - // Technically, WeakMap keys can *only* be objects, not primitives. - if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { - return null; - } - var leftHandMap = memoizeMap.get(leftHandOperand); - if (leftHandMap) { - var result = leftHandMap.get(rightHandOperand); - if (typeof result === 'boolean') { - return result; - } - } - return null; -} - -/*! - * Set the result of the equality into the MemoizeMap - * - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @param {MemoizeMap} memoizeMap - * @param {Boolean} result -*/ -function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) { - // Technically, WeakMap keys can *only* be objects, not primitives. - if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { - return; - } - var leftHandMap = memoizeMap.get(leftHandOperand); - if (leftHandMap) { - leftHandMap.set(rightHandOperand, result); - } else { - leftHandMap = new MemoizeMap(); - leftHandMap.set(rightHandOperand, result); - memoizeMap.set(leftHandOperand, leftHandMap); - } -} - -/*! - * Primary Export - */ - -module.exports = deepEqual; -module.exports.MemoizeMap = MemoizeMap; - -/** - * Assert deeply nested sameValue equality between two objects of any type. - * - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @param {Object} [options] (optional) Additional options - * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality. - * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of - complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular - references to blow the stack. - * @return {Boolean} equal match - */ -function deepEqual(leftHandOperand, rightHandOperand, options) { - // If we have a comparator, we can't assume anything; so bail to its check first. - if (options && options.comparator) { - return extensiveDeepEqual(leftHandOperand, rightHandOperand, options); - } - - var simpleResult = simpleEqual(leftHandOperand, rightHandOperand); - if (simpleResult !== null) { - return simpleResult; - } - - // Deeper comparisons are pushed through to a larger function - return extensiveDeepEqual(leftHandOperand, rightHandOperand, options); -} - -/** - * Many comparisons can be canceled out early via simple equality or primitive checks. - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @return {Boolean|null} equal match - */ -function simpleEqual(leftHandOperand, rightHandOperand) { - // Equal references (except for Numbers) can be returned early - if (leftHandOperand === rightHandOperand) { - // Handle +-0 cases - return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand; - } - - // handle NaN cases - if ( - leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare - rightHandOperand !== rightHandOperand // eslint-disable-line no-self-compare - ) { - return true; - } - - // Anything that is not an 'object', i.e. symbols, functions, booleans, numbers, - // strings, and undefined, can be compared by reference. - if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { - // Easy out b/c it would have passed the first equality check - return false; - } - return null; -} - -/*! - * The main logic of the `deepEqual` function. - * - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @param {Object} [options] (optional) Additional options - * @param {Array} [options.comparator] (optional) Override default algorithm, determining custom equality. - * @param {Array} [options.memoize] (optional) Provide a custom memoization object which will cache the results of - complex objects for a speed boost. By passing `false` you can disable memoization, but this will cause circular - references to blow the stack. - * @return {Boolean} equal match -*/ -function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) { - options = options || {}; - options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap(); - var comparator = options && options.comparator; - - // Check if a memoized result exists. - var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize); - if (memoizeResultLeft !== null) { - return memoizeResultLeft; - } - var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize); - if (memoizeResultRight !== null) { - return memoizeResultRight; - } - - // If a comparator is present, use it. - if (comparator) { - var comparatorResult = comparator(leftHandOperand, rightHandOperand); - // Comparators may return null, in which case we want to go back to default behavior. - if (comparatorResult === false || comparatorResult === true) { - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult); - return comparatorResult; - } - // To allow comparators to override *any* behavior, we ran them first. Since it didn't decide - // what to do, we need to make sure to return the basic tests first before we move on. - var simpleResult = simpleEqual(leftHandOperand, rightHandOperand); - if (simpleResult !== null) { - // Don't memoize this, it takes longer to set/retrieve than to just compare. - return simpleResult; - } - } - - var leftHandType = type(leftHandOperand); - if (leftHandType !== type(rightHandOperand)) { - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false); - return false; - } - - // Temporarily set the operands in the memoize object to prevent blowing the stack - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true); - - var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options); - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result); - return result; -} - -function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) { - switch (leftHandType) { - case 'String': - case 'Number': - case 'Boolean': - case 'Date': - // If these types are their instance types (e.g. `new Number`) then re-deepEqual against their values - return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf()); - case 'Promise': - case 'Symbol': - case 'function': - case 'WeakMap': - case 'WeakSet': - return leftHandOperand === rightHandOperand; - case 'Error': - return keysEqual(leftHandOperand, rightHandOperand, [ 'name', 'message', 'code' ], options); - case 'Arguments': - case 'Int8Array': - case 'Uint8Array': - case 'Uint8ClampedArray': - case 'Int16Array': - case 'Uint16Array': - case 'Int32Array': - case 'Uint32Array': - case 'Float32Array': - case 'Float64Array': - case 'Array': - return iterableEqual(leftHandOperand, rightHandOperand, options); - case 'RegExp': - return regexpEqual(leftHandOperand, rightHandOperand); - case 'Generator': - return generatorEqual(leftHandOperand, rightHandOperand, options); - case 'DataView': - return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options); - case 'ArrayBuffer': - return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options); - case 'Set': - return entriesEqual(leftHandOperand, rightHandOperand, options); - case 'Map': - return entriesEqual(leftHandOperand, rightHandOperand, options); - default: - return objectEqual(leftHandOperand, rightHandOperand, options); - } -} - -/*! - * Compare two Regular Expressions for equality. - * - * @param {RegExp} leftHandOperand - * @param {RegExp} rightHandOperand - * @return {Boolean} result - */ - -function regexpEqual(leftHandOperand, rightHandOperand) { - return leftHandOperand.toString() === rightHandOperand.toString(); -} - -/*! - * Compare two Sets/Maps for equality. Faster than other equality functions. - * - * @param {Set} leftHandOperand - * @param {Set} rightHandOperand - * @param {Object} [options] (Optional) - * @return {Boolean} result - */ - -function entriesEqual(leftHandOperand, rightHandOperand, options) { - // IE11 doesn't support Set#entries or Set#@@iterator, so we need manually populate using Set#forEach - if (leftHandOperand.size !== rightHandOperand.size) { - return false; - } - if (leftHandOperand.size === 0) { - return true; - } - var leftHandItems = []; - var rightHandItems = []; - leftHandOperand.forEach(function gatherEntries(key, value) { - leftHandItems.push([ key, value ]); - }); - rightHandOperand.forEach(function gatherEntries(key, value) { - rightHandItems.push([ key, value ]); - }); - return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options); -} - -/*! - * Simple equality for flat iterable objects such as Arrays, TypedArrays or Node.js buffers. - * - * @param {Iterable} leftHandOperand - * @param {Iterable} rightHandOperand - * @param {Object} [options] (Optional) - * @return {Boolean} result - */ - -function iterableEqual(leftHandOperand, rightHandOperand, options) { - var length = leftHandOperand.length; - if (length !== rightHandOperand.length) { - return false; - } - if (length === 0) { - return true; - } - var index = -1; - while (++index < length) { - if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) { - return false; - } - } - return true; -} - -/*! - * Simple equality for generator objects such as those returned by generator functions. - * - * @param {Iterable} leftHandOperand - * @param {Iterable} rightHandOperand - * @param {Object} [options] (Optional) - * @return {Boolean} result - */ - -function generatorEqual(leftHandOperand, rightHandOperand, options) { - return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options); -} - -/*! - * Determine if the given object has an @@iterator function. - * - * @param {Object} target - * @return {Boolean} `true` if the object has an @@iterator function. - */ -function hasIteratorFunction(target) { - return typeof Symbol !== 'undefined' && - typeof target === 'object' && - typeof Symbol.iterator !== 'undefined' && - typeof target[Symbol.iterator] === 'function'; -} - -/*! - * Gets all iterator entries from the given Object. If the Object has no @@iterator function, returns an empty array. - * This will consume the iterator - which could have side effects depending on the @@iterator implementation. - * - * @param {Object} target - * @returns {Array} an array of entries from the @@iterator function - */ -function getIteratorEntries(target) { - if (hasIteratorFunction(target)) { - try { - return getGeneratorEntries(target[Symbol.iterator]()); - } catch (iteratorError) { - return []; - } - } - return []; -} - -/*! - * Gets all entries from a Generator. This will consume the generator - which could have side effects. - * - * @param {Generator} target - * @returns {Array} an array of entries from the Generator. - */ -function getGeneratorEntries(generator) { - var generatorResult = generator.next(); - var accumulator = [ generatorResult.value ]; - while (generatorResult.done === false) { - generatorResult = generator.next(); - accumulator.push(generatorResult.value); - } - return accumulator; -} - -/*! - * Gets all own and inherited enumerable keys from a target. - * - * @param {Object} target - * @returns {Array} an array of own and inherited enumerable keys from the target. - */ -function getEnumerableKeys(target) { - var keys = []; - for (var key in target) { - keys.push(key); - } - return keys; -} - -/*! - * Determines if two objects have matching values, given a set of keys. Defers to deepEqual for the equality check of - * each key. If any value of the given key is not equal, the function will return false (early). - * - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @param {Array} keys An array of keys to compare the values of leftHandOperand and rightHandOperand against - * @param {Object} [options] (Optional) - * @return {Boolean} result - */ -function keysEqual(leftHandOperand, rightHandOperand, keys, options) { - var length = keys.length; - if (length === 0) { - return true; - } - for (var i = 0; i < length; i += 1) { - if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) { - return false; - } - } - return true; -} - -/*! - * Recursively check the equality of two Objects. Once basic sameness has been established it will defer to `deepEqual` - * for each enumerable key in the object. - * - * @param {Mixed} leftHandOperand - * @param {Mixed} rightHandOperand - * @param {Object} [options] (Optional) - * @return {Boolean} result - */ -function objectEqual(leftHandOperand, rightHandOperand, options) { - var leftHandKeys = getEnumerableKeys(leftHandOperand); - var rightHandKeys = getEnumerableKeys(rightHandOperand); - if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) { - leftHandKeys.sort(); - rightHandKeys.sort(); - if (iterableEqual(leftHandKeys, rightHandKeys) === false) { - return false; - } - return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options); - } - - var leftHandEntries = getIteratorEntries(leftHandOperand); - var rightHandEntries = getIteratorEntries(rightHandOperand); - if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) { - leftHandEntries.sort(); - rightHandEntries.sort(); - return iterableEqual(leftHandEntries, rightHandEntries, options); - } - - if (leftHandKeys.length === 0 && - leftHandEntries.length === 0 && - rightHandKeys.length === 0 && - rightHandEntries.length === 0) { - return true; - } - - return false; -} - -/*! - * Returns true if the argument is a primitive. - * - * This intentionally returns true for all objects that can be compared by reference, - * including functions and symbols. - * - * @param {Mixed} value - * @return {Boolean} result - */ -function isPrimitive(value) { - return value === null || typeof value !== 'object'; -} - -},{"type-detect":38}],36:[function(require,module,exports){ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.loupe = {})); -}(this, (function (exports) { 'use strict'; - - var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {}; - - function createCommonjsModule(fn) { - var module = { exports: {} }; - return fn(module, module.exports), module.exports; - } - - var typeDetect = createCommonjsModule(function (module, exports) { - (function (global, factory) { - module.exports = factory() ; - }(commonjsGlobal, (function () { - /* ! - * type-detect - * Copyright(c) 2013 jake luer - * MIT Licensed - */ - var promiseExists = typeof Promise === 'function'; - - /* eslint-disable no-undef */ - var globalObject = typeof self === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist - - var symbolExists = typeof Symbol !== 'undefined'; - var mapExists = typeof Map !== 'undefined'; - var setExists = typeof Set !== 'undefined'; - var weakMapExists = typeof WeakMap !== 'undefined'; - var weakSetExists = typeof WeakSet !== 'undefined'; - var dataViewExists = typeof DataView !== 'undefined'; - var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined'; - var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined'; - var setEntriesExists = setExists && typeof Set.prototype.entries === 'function'; - var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function'; - var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries()); - var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries()); - var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function'; - var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]()); - var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function'; - var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]()); - var toStringLeftSliceLength = 8; - var toStringRightSliceLength = -1; - /** - * ### typeOf (obj) - * - * Uses `Object.prototype.toString` to determine the type of an object, - * normalising behaviour across engine versions & well optimised. - * - * @param {Mixed} object - * @return {String} object type - * @api public - */ - function typeDetect(obj) { - /* ! Speed optimisation - * Pre: - * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled) - * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled) - * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled) - * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled) - * function x 2,556,769 ops/sec ±1.73% (77 runs sampled) - * Post: - * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled) - * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled) - * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled) - * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled) - * function x 31,296,870 ops/sec ±0.96% (83 runs sampled) - */ - var typeofObj = typeof obj; - if (typeofObj !== 'object') { - return typeofObj; - } - - /* ! Speed optimisation - * Pre: - * null x 28,645,765 ops/sec ±1.17% (82 runs sampled) - * Post: - * null x 36,428,962 ops/sec ±1.37% (84 runs sampled) - */ - if (obj === null) { - return 'null'; - } - - /* ! Spec Conformance - * Test: `Object.prototype.toString.call(window)`` - * - Node === "[object global]" - * - Chrome === "[object global]" - * - Firefox === "[object Window]" - * - PhantomJS === "[object Window]" - * - Safari === "[object Window]" - * - IE 11 === "[object Window]" - * - IE Edge === "[object Window]" - * Test: `Object.prototype.toString.call(this)`` - * - Chrome Worker === "[object global]" - * - Firefox Worker === "[object DedicatedWorkerGlobalScope]" - * - Safari Worker === "[object DedicatedWorkerGlobalScope]" - * - IE 11 Worker === "[object WorkerGlobalScope]" - * - IE Edge Worker === "[object WorkerGlobalScope]" - */ - if (obj === globalObject) { - return 'global'; - } - - /* ! Speed optimisation - * Pre: - * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled) - * Post: - * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled) - */ - if ( - Array.isArray(obj) && - (symbolToStringTagExists === false || !(Symbol.toStringTag in obj)) - ) { - return 'Array'; - } - - // Not caching existence of `window` and related properties due to potential - // for `window` to be unset before tests in quasi-browser environments. - if (typeof window === 'object' && window !== null) { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/browsers.html#location) - * WhatWG HTML$7.7.3 - The `Location` interface - * Test: `Object.prototype.toString.call(window.location)`` - * - IE <=11 === "[object Object]" - * - IE Edge <=13 === "[object Object]" - */ - if (typeof window.location === 'object' && obj === window.location) { - return 'Location'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#document) - * WhatWG HTML$3.1.1 - The `Document` object - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * WhatWG HTML states: - * > For historical reasons, Window objects must also have a - * > writable, configurable, non-enumerable property named - * > HTMLDocument whose value is the Document interface object. - * Test: `Object.prototype.toString.call(document)`` - * - Chrome === "[object HTMLDocument]" - * - Firefox === "[object HTMLDocument]" - * - Safari === "[object HTMLDocument]" - * - IE <=10 === "[object Document]" - * - IE 11 === "[object HTMLDocument]" - * - IE Edge <=13 === "[object HTMLDocument]" - */ - if (typeof window.document === 'object' && obj === window.document) { - return 'Document'; - } - - if (typeof window.navigator === 'object') { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) - * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray - * Test: `Object.prototype.toString.call(navigator.mimeTypes)`` - * - IE <=10 === "[object MSMimeTypesCollection]" - */ - if (typeof window.navigator.mimeTypes === 'object' && - obj === window.navigator.mimeTypes) { - return 'MimeTypeArray'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) - * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray - * Test: `Object.prototype.toString.call(navigator.plugins)`` - * - IE <=10 === "[object MSPluginsCollection]" - */ - if (typeof window.navigator.plugins === 'object' && - obj === window.navigator.plugins) { - return 'PluginArray'; - } - } - - if ((typeof window.HTMLElement === 'function' || - typeof window.HTMLElement === 'object') && - obj instanceof window.HTMLElement) { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) - * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` - * Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` - * - IE <=10 === "[object HTMLBlockElement]" - */ - if (obj.tagName === 'BLOCKQUOTE') { - return 'HTMLQuoteElement'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#htmltabledatacellelement) - * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * Test: Object.prototype.toString.call(document.createElement('td')) - * - Chrome === "[object HTMLTableCellElement]" - * - Firefox === "[object HTMLTableCellElement]" - * - Safari === "[object HTMLTableCellElement]" - */ - if (obj.tagName === 'TD') { - return 'HTMLTableDataCellElement'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#htmltableheadercellelement) - * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * Test: Object.prototype.toString.call(document.createElement('th')) - * - Chrome === "[object HTMLTableCellElement]" - * - Firefox === "[object HTMLTableCellElement]" - * - Safari === "[object HTMLTableCellElement]" - */ - if (obj.tagName === 'TH') { - return 'HTMLTableHeaderCellElement'; - } - } - } - - /* ! Speed optimisation - * Pre: - * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled) - * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled) - * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled) - * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled) - * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled) - * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled) - * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled) - * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled) - * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled) - * Post: - * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled) - * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled) - * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled) - * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled) - * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled) - * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled) - * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled) - * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled) - * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled) - */ - var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]); - if (typeof stringTag === 'string') { - return stringTag; - } - - var objPrototype = Object.getPrototypeOf(obj); - /* ! Speed optimisation - * Pre: - * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled) - * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled) - * Post: - * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled) - * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled) - */ - if (objPrototype === RegExp.prototype) { - return 'RegExp'; - } - - /* ! Speed optimisation - * Pre: - * date x 2,130,074 ops/sec ±4.42% (68 runs sampled) - * Post: - * date x 3,953,779 ops/sec ±1.35% (77 runs sampled) - */ - if (objPrototype === Date.prototype) { - return 'Date'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag) - * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise": - * Test: `Object.prototype.toString.call(Promise.resolve())`` - * - Chrome <=47 === "[object Object]" - * - Edge <=20 === "[object Object]" - * - Firefox 29-Latest === "[object Promise]" - * - Safari 7.1-Latest === "[object Promise]" - */ - if (promiseExists && objPrototype === Promise.prototype) { - return 'Promise'; - } - - /* ! Speed optimisation - * Pre: - * set x 2,222,186 ops/sec ±1.31% (82 runs sampled) - * Post: - * set x 4,545,879 ops/sec ±1.13% (83 runs sampled) - */ - if (setExists && objPrototype === Set.prototype) { - return 'Set'; - } - - /* ! Speed optimisation - * Pre: - * map x 2,396,842 ops/sec ±1.59% (81 runs sampled) - * Post: - * map x 4,183,945 ops/sec ±6.59% (82 runs sampled) - */ - if (mapExists && objPrototype === Map.prototype) { - return 'Map'; - } - - /* ! Speed optimisation - * Pre: - * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled) - * Post: - * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled) - */ - if (weakSetExists && objPrototype === WeakSet.prototype) { - return 'WeakSet'; - } - - /* ! Speed optimisation - * Pre: - * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled) - * Post: - * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled) - */ - if (weakMapExists && objPrototype === WeakMap.prototype) { - return 'WeakMap'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag) - * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView": - * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))`` - * - Edge <=13 === "[object Object]" - */ - if (dataViewExists && objPrototype === DataView.prototype) { - return 'DataView'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag) - * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator": - * Test: `Object.prototype.toString.call(new Map().entries())`` - * - Edge <=13 === "[object Object]" - */ - if (mapExists && objPrototype === mapIteratorPrototype) { - return 'Map Iterator'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag) - * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator": - * Test: `Object.prototype.toString.call(new Set().entries())`` - * - Edge <=13 === "[object Object]" - */ - if (setExists && objPrototype === setIteratorPrototype) { - return 'Set Iterator'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag) - * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator": - * Test: `Object.prototype.toString.call([][Symbol.iterator]())`` - * - Edge <=13 === "[object Object]" - */ - if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) { - return 'Array Iterator'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag) - * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator": - * Test: `Object.prototype.toString.call(''[Symbol.iterator]())`` - * - Edge <=13 === "[object Object]" - */ - if (stringIteratorExists && objPrototype === stringIteratorPrototype) { - return 'String Iterator'; - } - - /* ! Speed optimisation - * Pre: - * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled) - * Post: - * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled) - */ - if (objPrototype === null) { - return 'Object'; - } - - return Object - .prototype - .toString - .call(obj) - .slice(toStringLeftSliceLength, toStringRightSliceLength); - } - - return typeDetect; - - }))); - }); - - function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); - } - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - - function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); - } - - function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - - return arr2; - } - - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var ansiColors = { - bold: ['1', '22'], - dim: ['2', '22'], - italic: ['3', '23'], - underline: ['4', '24'], - // 5 & 6 are blinking - inverse: ['7', '27'], - hidden: ['8', '28'], - strike: ['9', '29'], - // 10-20 are fonts - // 21-29 are resets for 1-9 - black: ['30', '39'], - red: ['31', '39'], - green: ['32', '39'], - yellow: ['33', '39'], - blue: ['34', '39'], - magenta: ['35', '39'], - cyan: ['36', '39'], - white: ['37', '39'], - brightblack: ['30;1', '39'], - brightred: ['31;1', '39'], - brightgreen: ['32;1', '39'], - brightyellow: ['33;1', '39'], - brightblue: ['34;1', '39'], - brightmagenta: ['35;1', '39'], - brightcyan: ['36;1', '39'], - brightwhite: ['37;1', '39'], - grey: ['90', '39'] - }; - var styles = { - special: 'cyan', - number: 'yellow', - bigint: 'yellow', - boolean: 'yellow', - undefined: 'grey', - null: 'bold', - string: 'green', - symbol: 'green', - date: 'magenta', - regexp: 'red' - }; - var truncator = '…'; - - function colorise(value, styleType) { - var color = ansiColors[styles[styleType]] || ansiColors[styleType]; - - if (!color) { - return String(value); - } - - return "\x1B[".concat(color[0], "m").concat(String(value), "\x1B[").concat(color[1], "m"); - } - - function normaliseOptions() { - var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, - _ref$showHidden = _ref.showHidden, - showHidden = _ref$showHidden === void 0 ? false : _ref$showHidden, - _ref$depth = _ref.depth, - depth = _ref$depth === void 0 ? 2 : _ref$depth, - _ref$colors = _ref.colors, - colors = _ref$colors === void 0 ? false : _ref$colors, - _ref$customInspect = _ref.customInspect, - customInspect = _ref$customInspect === void 0 ? true : _ref$customInspect, - _ref$showProxy = _ref.showProxy, - showProxy = _ref$showProxy === void 0 ? false : _ref$showProxy, - _ref$maxArrayLength = _ref.maxArrayLength, - maxArrayLength = _ref$maxArrayLength === void 0 ? Infinity : _ref$maxArrayLength, - _ref$breakLength = _ref.breakLength, - breakLength = _ref$breakLength === void 0 ? Infinity : _ref$breakLength, - _ref$seen = _ref.seen, - seen = _ref$seen === void 0 ? [] : _ref$seen, - _ref$truncate = _ref.truncate, - truncate = _ref$truncate === void 0 ? Infinity : _ref$truncate, - _ref$stylize = _ref.stylize, - stylize = _ref$stylize === void 0 ? String : _ref$stylize; - - var options = { - showHidden: Boolean(showHidden), - depth: Number(depth), - colors: Boolean(colors), - customInspect: Boolean(customInspect), - showProxy: Boolean(showProxy), - maxArrayLength: Number(maxArrayLength), - breakLength: Number(breakLength), - truncate: Number(truncate), - seen: seen, - stylize: stylize - }; - - if (options.colors) { - options.stylize = colorise; - } - - return options; - } - function truncate(string, length) { - var tail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : truncator; - string = String(string); - var tailLength = tail.length; - var stringLength = string.length; - - if (tailLength > length && stringLength > tailLength) { - return tail; - } - - if (stringLength > length && stringLength > tailLength) { - return "".concat(string.slice(0, length - tailLength)).concat(tail); - } - - return string; - } // eslint-disable-next-line complexity - - function inspectList(list, options, inspectItem) { - var separator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', '; - inspectItem = inspectItem || options.inspect; - var size = list.length; - if (size === 0) return ''; - var originalLength = options.truncate; - var output = ''; - var peek = ''; - var truncated = ''; - - for (var i = 0; i < size; i += 1) { - var last = i + 1 === list.length; - var secondToLast = i + 2 === list.length; - truncated = "".concat(truncator, "(").concat(list.length - i, ")"); - var value = list[i]; // If there is more than one remaining we need to account for a separator of `, ` - - options.truncate = originalLength - output.length - (last ? 0 : separator.length); - var string = peek || inspectItem(value, options) + (last ? '' : separator); - var nextLength = output.length + string.length; - var truncatedLength = nextLength + truncated.length; // If this is the last element, and adding it would - // take us over length, but adding the truncator wouldn't - then break now - - if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) { - break; - } // If this isn't the last or second to last element to scan, - // but the string is already over length then break here - - - if (!last && !secondToLast && truncatedLength > originalLength) { - break; - } // Peek at the next string to determine if we should - // break early before adding this item to the output - - - peek = last ? '' : inspectItem(list[i + 1], options) + (secondToLast ? '' : separator); // If we have one element left, but this element and - // the next takes over length, the break early - - if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) { - break; - } - - output += string; // If the next element takes us to length - - // but there are more after that, then we should truncate now - - if (!last && !secondToLast && nextLength + peek.length >= originalLength) { - truncated = "".concat(truncator, "(").concat(list.length - i - 1, ")"); - break; - } - - truncated = ''; - } - - return "".concat(output).concat(truncated); - } - - function quoteComplexKey(key) { - if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) { - return key; - } - - return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); - } - - function inspectProperty(_ref2, options) { - var _ref3 = _slicedToArray(_ref2, 2), - key = _ref3[0], - value = _ref3[1]; - - options.truncate -= 2; - - if (typeof key === 'string') { - key = quoteComplexKey(key); - } else if (typeof key !== 'number') { - key = "[".concat(options.inspect(key, options), "]"); - } - - options.truncate -= key.length; - value = options.inspect(value, options); - return "".concat(key, ": ").concat(value); - } - - function inspectArray(array, options) { - // Object.keys will always output the Array indices first, so we can slice by - // `array.length` to get non-index properties - var nonIndexProperties = Object.keys(array).slice(array.length); - if (!array.length && !nonIndexProperties.length) return '[]'; - options.truncate -= 4; - var listContents = inspectList(array, options); - options.truncate -= listContents.length; - var propertyContents = ''; - - if (nonIndexProperties.length) { - propertyContents = inspectList(nonIndexProperties.map(function (key) { - return [key, array[key]]; - }), options, inspectProperty); - } - - return "[ ".concat(listContents).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]"); - } - - /* ! - * Chai - getFuncName utility - * Copyright(c) 2012-2016 Jake Luer - * MIT Licensed - */ - - /** - * ### .getFuncName(constructorFn) - * - * Returns the name of a function. - * When a non-function instance is passed, returns `null`. - * This also includes a polyfill function if `aFunc.name` is not defined. - * - * @name getFuncName - * @param {Function} funct - * @namespace Utils - * @api public - */ - - var toString = Function.prototype.toString; - var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/; - function getFuncName(aFunc) { - if (typeof aFunc !== 'function') { - return null; - } - - var name = ''; - if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') { - // Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined - var match = toString.call(aFunc).match(functionNameMatch); - if (match) { - name = match[1]; - } - } else { - // If we've got a `name` property we just use it - name = aFunc.name; - } - - return name; - } - - var getFuncName_1 = getFuncName; - - var getArrayName = function getArrayName(array) { - // We need to special case Node.js' Buffers, which report to be Uint8Array - if (typeof Buffer === 'function' && array instanceof Buffer) { - return 'Buffer'; - } - - if (array[Symbol.toStringTag]) { - return array[Symbol.toStringTag]; - } - - return getFuncName_1(array.constructor); - }; - - function inspectTypedArray(array, options) { - var name = getArrayName(array); - options.truncate -= name.length + 4; // Object.keys will always output the Array indices first, so we can slice by - // `array.length` to get non-index properties - - var nonIndexProperties = Object.keys(array).slice(array.length); - if (!array.length && !nonIndexProperties.length) return "".concat(name, "[]"); // As we know TypedArrays only contain Unsigned Integers, we can skip inspecting each one and simply - // stylise the toString() value of them - - var output = ''; - - for (var i = 0; i < array.length; i++) { - var string = "".concat(options.stylize(truncate(array[i], options.truncate), 'number')).concat(i === array.length - 1 ? '' : ', '); - options.truncate -= string.length; - - if (array[i] !== array.length && options.truncate <= 3) { - output += "".concat(truncator, "(").concat(array.length - array[i] + 1, ")"); - break; - } - - output += string; - } - - var propertyContents = ''; - - if (nonIndexProperties.length) { - propertyContents = inspectList(nonIndexProperties.map(function (key) { - return [key, array[key]]; - }), options, inspectProperty); - } - - return "".concat(name, "[ ").concat(output).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]"); - } - - function inspectDate(dateObject, options) { - // If we need to - truncate the time portion, but never the date - var split = dateObject.toJSON().split('T'); - var date = split[0]; - return options.stylize("".concat(date, "T").concat(truncate(split[1], options.truncate - date.length - 1)), 'date'); - } - - function inspectFunction(func, options) { - var name = getFuncName_1(func); - - if (!name) { - return options.stylize('[Function]', 'special'); - } - - return options.stylize("[Function ".concat(truncate(name, options.truncate - 11), "]"), 'special'); - } - - function inspectMapEntry(_ref, options) { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - options.truncate -= 4; - key = options.inspect(key, options); - options.truncate -= key.length; - value = options.inspect(value, options); - return "".concat(key, " => ").concat(value); - } // IE11 doesn't support `map.entries()` - - - function mapToEntries(map) { - var entries = []; - map.forEach(function (value, key) { - entries.push([key, value]); - }); - return entries; - } - - function inspectMap(map, options) { - var size = map.size - 1; - - if (size <= 0) { - return 'Map{}'; - } - - options.truncate -= 7; - return "Map{ ".concat(inspectList(mapToEntries(map), options, inspectMapEntry), " }"); - } - - var isNaN = Number.isNaN || function (i) { - return i !== i; - }; // eslint-disable-line no-self-compare - - - function inspectNumber(number, options) { - if (isNaN(number)) { - return options.stylize('NaN', 'number'); - } - - if (number === Infinity) { - return options.stylize('Infinity', 'number'); - } - - if (number === -Infinity) { - return options.stylize('-Infinity', 'number'); - } - - if (number === 0) { - return options.stylize(1 / number === Infinity ? '+0' : '-0', 'number'); - } - - return options.stylize(truncate(number, options.truncate), 'number'); - } - - function inspectBigInt(number, options) { - var nums = truncate(number.toString(), options.truncate - 1); - if (nums !== truncator) nums += 'n'; - return options.stylize(nums, 'bigint'); - } - - function inspectRegExp(value, options) { - var flags = value.toString().split('/')[2]; - var sourceLength = options.truncate - (2 + flags.length); - var source = value.source; - return options.stylize("/".concat(truncate(source, sourceLength), "/").concat(flags), 'regexp'); - } - - function arrayFromSet(set) { - var values = []; - set.forEach(function (value) { - values.push(value); - }); - return values; - } - - function inspectSet(set, options) { - if (set.size === 0) return 'Set{}'; - options.truncate -= 7; - return "Set{ ".concat(inspectList(arrayFromSet(set), options), " }"); - } - - var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" + "\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", 'g'); - var escapeCharacters = { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - "'": "\\'", - '\\': '\\\\' - }; - var hex = 16; - var unicodeLength = 4; - - function escape(char) { - return escapeCharacters[char] || "\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength)); - } - - function inspectString(string, options) { - if (stringEscapeChars.test(string)) { - string = string.replace(stringEscapeChars, escape); - } - - return options.stylize("'".concat(truncate(string, options.truncate - 2), "'"), 'string'); - } - - function inspectSymbol(value) { - if ('description' in Symbol.prototype) { - return value.description ? "Symbol(".concat(value.description, ")") : 'Symbol()'; - } - - return value.toString(); - } - - var getPromiseValue = function getPromiseValue() { - return 'Promise{…}'; - }; - - try { - var _process$binding = process.binding('util'), - getPromiseDetails = _process$binding.getPromiseDetails, - kPending = _process$binding.kPending, - kRejected = _process$binding.kRejected; - - getPromiseValue = function getPromiseValue(value, options) { - var _getPromiseDetails = getPromiseDetails(value), - _getPromiseDetails2 = _slicedToArray(_getPromiseDetails, 2), - state = _getPromiseDetails2[0], - innerValue = _getPromiseDetails2[1]; - - if (state === kPending) { - return 'Promise{}'; - } - - return "Promise".concat(state === kRejected ? '!' : '', "{").concat(options.inspect(innerValue, options), "}"); - }; - } catch (notNode) { - /* ignore */ - } - - var inspectPromise = getPromiseValue; - - function inspectObject(object, options) { - var properties = Object.getOwnPropertyNames(object); - var symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : []; - - if (properties.length === 0 && symbols.length === 0) { - return '{}'; - } - - options.truncate -= 4; - options.seen = options.seen || []; - - if (options.seen.indexOf(object) >= 0) { - return '[Circular]'; - } - - options.seen.push(object); - var propertyContents = inspectList(properties.map(function (key) { - return [key, object[key]]; - }), options, inspectProperty); - var symbolContents = inspectList(symbols.map(function (key) { - return [key, object[key]]; - }), options, inspectProperty); - options.seen.pop(); - var sep = ''; - - if (propertyContents && symbolContents) { - sep = ', '; - } - - return "{ ".concat(propertyContents).concat(sep).concat(symbolContents, " }"); - } - - var toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false; - function inspectClass(value, options) { - var name = ''; - - if (toStringTag && toStringTag in value) { - name = value[toStringTag]; - } - - name = name || getFuncName_1(value.constructor); // Babel transforms anonymous classes to the name `_class` - - if (!name || name === '_class') { - name = ''; - } - - options.truncate -= name.length; - return "".concat(name).concat(inspectObject(value, options)); - } - - function inspectArguments(args, options) { - if (args.length === 0) return 'Arguments[]'; - options.truncate -= 13; - return "Arguments[ ".concat(inspectList(args, options), " ]"); - } - - var errorKeys = ['stack', 'line', 'column', 'name', 'message', 'fileName', 'lineNumber', 'columnNumber', 'number', 'description']; - function inspectObject$1(error, options) { - var properties = Object.getOwnPropertyNames(error).filter(function (key) { - return errorKeys.indexOf(key) === -1; - }); - var name = error.name; - options.truncate -= name.length; - var message = ''; - - if (typeof error.message === 'string') { - message = truncate(error.message, options.truncate); - } else { - properties.unshift('message'); - } - - message = message ? ": ".concat(message) : ''; - options.truncate -= message.length + 5; - var propertyContents = inspectList(properties.map(function (key) { - return [key, error[key]]; - }), options, inspectProperty); - return "".concat(name).concat(message).concat(propertyContents ? " { ".concat(propertyContents, " }") : ''); - } - - function inspectAttribute(_ref, options) { - var _ref2 = _slicedToArray(_ref, 2), - key = _ref2[0], - value = _ref2[1]; - - options.truncate -= 3; - - if (!value) { - return "".concat(options.stylize(key, 'yellow')); - } - - return "".concat(options.stylize(key, 'yellow'), "=").concat(options.stylize("\"".concat(value, "\""), 'string')); - } - function inspectHTMLCollection(collection, options) { - // eslint-disable-next-line no-use-before-define - return inspectList(collection, options, inspectHTML, '\n'); - } - function inspectHTML(element, options) { - var properties = element.getAttributeNames(); - var name = element.tagName.toLowerCase(); - var head = options.stylize("<".concat(name), 'special'); - var headClose = options.stylize(">", 'special'); - var tail = options.stylize(""), 'special'); - options.truncate -= name.length * 2 + 5; - var propertyContents = ''; - - if (properties.length > 0) { - propertyContents += ' '; - propertyContents += inspectList(properties.map(function (key) { - return [key, element.getAttribute(key)]; - }), options, inspectAttribute, ' '); - } - - options.truncate -= propertyContents.length; - var truncate = options.truncate; - var children = inspectHTMLCollection(element.children, options); - - if (children && children.length > truncate) { - children = "".concat(truncator, "(").concat(element.children.length, ")"); - } - - return "".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail); - } - - /* ! - * loupe - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ - var symbolsSupported = typeof Symbol === 'function' && typeof Symbol.for === 'function'; - var chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/inspect'; - var nodeInspect = false; - - try { - // eslint-disable-next-line global-require - nodeInspect = require('util').inspect.custom; - } catch (noNodeInspect) { - nodeInspect = false; - } - - var constructorMap = new WeakMap(); - var stringTagMap = {}; - var baseTypesMap = { - undefined: function undefined$1(value, options) { - return options.stylize('undefined', 'undefined'); - }, - null: function _null(value, options) { - return options.stylize(null, 'null'); - }, - boolean: function boolean(value, options) { - return options.stylize(value, 'boolean'); - }, - Boolean: function Boolean(value, options) { - return options.stylize(value, 'boolean'); - }, - number: inspectNumber, - Number: inspectNumber, - bigint: inspectBigInt, - BigInt: inspectBigInt, - string: inspectString, - String: inspectString, - function: inspectFunction, - Function: inspectFunction, - symbol: inspectSymbol, - // A Symbol polyfill will return `Symbol` not `symbol` from typedetect - Symbol: inspectSymbol, - Array: inspectArray, - Date: inspectDate, - Map: inspectMap, - Set: inspectSet, - RegExp: inspectRegExp, - Promise: inspectPromise, - // WeakSet, WeakMap are totally opaque to us - WeakSet: function WeakSet(value, options) { - return options.stylize('WeakSet{…}', 'special'); - }, - WeakMap: function WeakMap(value, options) { - return options.stylize('WeakMap{…}', 'special'); - }, - Arguments: inspectArguments, - Int8Array: inspectTypedArray, - Uint8Array: inspectTypedArray, - Uint8ClampedArray: inspectTypedArray, - Int16Array: inspectTypedArray, - Uint16Array: inspectTypedArray, - Int32Array: inspectTypedArray, - Uint32Array: inspectTypedArray, - Float32Array: inspectTypedArray, - Float64Array: inspectTypedArray, - Generator: function Generator() { - return ''; - }, - DataView: function DataView() { - return ''; - }, - ArrayBuffer: function ArrayBuffer() { - return ''; - }, - Error: inspectObject$1, - HTMLCollection: inspectHTMLCollection, - NodeList: inspectHTMLCollection - }; // eslint-disable-next-line complexity - - var inspectCustom = function inspectCustom(value, options, type) { - if (chaiInspect in value && typeof value[chaiInspect] === 'function') { - return value[chaiInspect](options); - } - - if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === 'function') { - return value[nodeInspect](options.depth, options); - } - - if ('inspect' in value && typeof value.inspect === 'function') { - return value.inspect(options.depth, options); - } - - if ('constructor' in value && constructorMap.has(value.constructor)) { - return constructorMap.get(value.constructor)(value, options); - } - - if (stringTagMap[type]) { - return stringTagMap[type](value, options); - } - - return ''; - }; // eslint-disable-next-line complexity - - - function inspect(value, options) { - options = normaliseOptions(options); - options.inspect = inspect; - var _options = options, - customInspect = _options.customInspect; - var type = typeDetect(value); // If it is a base value that we already support, then use Loupe's inspector - - if (baseTypesMap[type]) { - return baseTypesMap[type](value, options); - } // If `options.customInspect` is set to true then try to use the custom inspector - - - if (customInspect && value) { - var output = inspectCustom(value, options, type); - - if (output) { - if (typeof output === 'string') return output; - return inspect(output, options); - } - } - - var proto = value ? Object.getPrototypeOf(value) : false; // If it's a plain Object then use Loupe's inspector - - if (proto === Object.prototype || proto === null) { - return inspectObject(value, options); - } // Specifically account for HTMLElements - // eslint-disable-next-line no-undef - - - if (value && typeof HTMLElement === 'function' && value instanceof HTMLElement) { - return inspectHTML(value, options); - } - - if ('constructor' in value) { - // If it is a class, inspect it like an object but add the constructor name - if (value.constructor !== Object) { - return inspectClass(value, options); - } // If it is an object with an anonymous prototype, display it as an object. - - - return inspectObject(value, options); - } // We have run out of options! Just stringify the value - - - return options.stylize(String(value), type); - } - function registerConstructor(constructor, inspector) { - if (constructorMap.has(constructor)) { - return false; - } - - constructorMap.add(constructor, inspector); - return true; - } - function registerStringTag(stringTag, inspector) { - if (stringTag in stringTagMap) { - return false; - } - - stringTagMap[stringTag] = inspector; - return true; - } - var custom = chaiInspect; - - exports.custom = custom; - exports.default = inspect; - exports.inspect = inspect; - exports.registerConstructor = registerConstructor; - exports.registerStringTag = registerStringTag; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - -},{"util":undefined}],37:[function(require,module,exports){ -'use strict'; - -/* ! - * Chai - pathval utility - * Copyright(c) 2012-2014 Jake Luer - * @see https://github.com/logicalparadox/filtr - * MIT Licensed - */ - -/** - * ### .hasProperty(object, name) - * - * This allows checking whether an object has own - * or inherited from prototype chain named property. - * - * Basically does the same thing as the `in` - * operator but works properly with null/undefined values - * and other primitives. - * - * var obj = { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * - * The following would be the results. - * - * hasProperty(obj, 'str'); // true - * hasProperty(obj, 'constructor'); // true - * hasProperty(obj, 'bar'); // false - * - * hasProperty(obj.str, 'length'); // true - * hasProperty(obj.str, 1); // true - * hasProperty(obj.str, 5); // false - * - * hasProperty(obj.arr, 'length'); // true - * hasProperty(obj.arr, 2); // true - * hasProperty(obj.arr, 3); // false - * - * @param {Object} object - * @param {String|Symbol} name - * @returns {Boolean} whether it exists - * @namespace Utils - * @name hasProperty - * @api public - */ - -function hasProperty(obj, name) { - if (typeof obj === 'undefined' || obj === null) { - return false; - } - - // The `in` operator does not work with primitives. - return name in Object(obj); -} - -/* ! - * ## parsePath(path) - * - * Helper function used to parse string object - * paths. Use in conjunction with `internalGetPathValue`. - * - * var parsed = parsePath('myobject.property.subprop'); - * - * ### Paths: - * - * * Can be infinitely deep and nested. - * * Arrays are also valid using the formal `myobject.document[3].property`. - * * Literal dots and brackets (not delimiter) must be backslash-escaped. - * - * @param {String} path - * @returns {Object} parsed - * @api private - */ - -function parsePath(path) { - var str = path.replace(/([^\\])\[/g, '$1.['); - var parts = str.match(/(\\\.|[^.]+?)+/g); - return parts.map(function mapMatches(value) { - if ( - value === 'constructor' || - value === '__proto__' || - value === 'prototype' - ) { - return {}; - } - var regexp = /^\[(\d+)\]$/; - var mArr = regexp.exec(value); - var parsed = null; - if (mArr) { - parsed = { i: parseFloat(mArr[1]) }; - } else { - parsed = { p: value.replace(/\\([.[\]])/g, '$1') }; - } - - return parsed; - }); -} - -/* ! - * ## internalGetPathValue(obj, parsed[, pathDepth]) - * - * Helper companion function for `.parsePath` that returns - * the value located at the parsed address. - * - * var value = getPathValue(obj, parsed); - * - * @param {Object} object to search against - * @param {Object} parsed definition from `parsePath`. - * @param {Number} depth (nesting level) of the property we want to retrieve - * @returns {Object|Undefined} value - * @api private - */ - -function internalGetPathValue(obj, parsed, pathDepth) { - var temporaryValue = obj; - var res = null; - pathDepth = typeof pathDepth === 'undefined' ? parsed.length : pathDepth; - - for (var i = 0; i < pathDepth; i++) { - var part = parsed[i]; - if (temporaryValue) { - if (typeof part.p === 'undefined') { - temporaryValue = temporaryValue[part.i]; - } else { - temporaryValue = temporaryValue[part.p]; - } - - if (i === pathDepth - 1) { - res = temporaryValue; - } - } - } - - return res; -} - -/* ! - * ## internalSetPathValue(obj, value, parsed) - * - * Companion function for `parsePath` that sets - * the value located at a parsed address. - * - * internalSetPathValue(obj, 'value', parsed); - * - * @param {Object} object to search and define on - * @param {*} value to use upon set - * @param {Object} parsed definition from `parsePath` - * @api private - */ - -function internalSetPathValue(obj, val, parsed) { - var tempObj = obj; - var pathDepth = parsed.length; - var part = null; - // Here we iterate through every part of the path - for (var i = 0; i < pathDepth; i++) { - var propName = null; - var propVal = null; - part = parsed[i]; - - // If it's the last part of the path, we set the 'propName' value with the property name - if (i === pathDepth - 1) { - propName = typeof part.p === 'undefined' ? part.i : part.p; - // Now we set the property with the name held by 'propName' on object with the desired val - tempObj[propName] = val; - } else if (typeof part.p !== 'undefined' && tempObj[part.p]) { - tempObj = tempObj[part.p]; - } else if (typeof part.i !== 'undefined' && tempObj[part.i]) { - tempObj = tempObj[part.i]; - } else { - // If the obj doesn't have the property we create one with that name to define it - var next = parsed[i + 1]; - // Here we set the name of the property which will be defined - propName = typeof part.p === 'undefined' ? part.i : part.p; - // Here we decide if this property will be an array or a new object - propVal = typeof next.p === 'undefined' ? [] : {}; - tempObj[propName] = propVal; - tempObj = tempObj[propName]; - } - } -} - -/** - * ### .getPathInfo(object, path) - * - * This allows the retrieval of property info in an - * object given a string path. - * - * The path info consists of an object with the - * following properties: - * - * * parent - The parent object of the property referenced by `path` - * * name - The name of the final property, a number if it was an array indexer - * * value - The value of the property, if it exists, otherwise `undefined` - * * exists - Whether the property exists or not - * - * @param {Object} object - * @param {String} path - * @returns {Object} info - * @namespace Utils - * @name getPathInfo - * @api public - */ - -function getPathInfo(obj, path) { - var parsed = parsePath(path); - var last = parsed[parsed.length - 1]; - var info = { - parent: - parsed.length > 1 ? - internalGetPathValue(obj, parsed, parsed.length - 1) : - obj, - name: last.p || last.i, - value: internalGetPathValue(obj, parsed), - }; - info.exists = hasProperty(info.parent, info.name); - - return info; -} - -/** - * ### .getPathValue(object, path) - * - * This allows the retrieval of values in an - * object given a string path. - * - * var obj = { - * prop1: { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * , prop2: { - * arr: [ { nested: 'Universe' } ] - * , str: 'Hello again!' - * } - * } - * - * The following would be the results. - * - * getPathValue(obj, 'prop1.str'); // Hello - * getPathValue(obj, 'prop1.att[2]'); // b - * getPathValue(obj, 'prop2.arr[0].nested'); // Universe - * - * @param {Object} object - * @param {String} path - * @returns {Object} value or `undefined` - * @namespace Utils - * @name getPathValue - * @api public - */ - -function getPathValue(obj, path) { - var info = getPathInfo(obj, path); - return info.value; -} - -/** - * ### .setPathValue(object, path, value) - * - * Define the value in an object at a given string path. - * - * ```js - * var obj = { - * prop1: { - * arr: ['a', 'b', 'c'] - * , str: 'Hello' - * } - * , prop2: { - * arr: [ { nested: 'Universe' } ] - * , str: 'Hello again!' - * } - * }; - * ``` - * - * The following would be acceptable. - * - * ```js - * var properties = require('tea-properties'); - * properties.set(obj, 'prop1.str', 'Hello Universe!'); - * properties.set(obj, 'prop1.arr[2]', 'B'); - * properties.set(obj, 'prop2.arr[0].nested.value', { hello: 'universe' }); - * ``` - * - * @param {Object} object - * @param {String} path - * @param {Mixed} value - * @api private - */ - -function setPathValue(obj, path, val) { - var parsed = parsePath(path); - internalSetPathValue(obj, val, parsed); - return obj; -} - -module.exports = { - hasProperty: hasProperty, - getPathInfo: getPathInfo, - getPathValue: getPathValue, - setPathValue: setPathValue, -}; - -},{}],38:[function(require,module,exports){ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.typeDetect = factory()); -}(this, (function () { 'use strict'; - -/* ! - * type-detect - * Copyright(c) 2013 jake luer - * MIT Licensed - */ -var promiseExists = typeof Promise === 'function'; - -/* eslint-disable no-undef */ -var globalObject = typeof self === 'object' ? self : global; // eslint-disable-line id-blacklist - -var symbolExists = typeof Symbol !== 'undefined'; -var mapExists = typeof Map !== 'undefined'; -var setExists = typeof Set !== 'undefined'; -var weakMapExists = typeof WeakMap !== 'undefined'; -var weakSetExists = typeof WeakSet !== 'undefined'; -var dataViewExists = typeof DataView !== 'undefined'; -var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined'; -var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined'; -var setEntriesExists = setExists && typeof Set.prototype.entries === 'function'; -var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function'; -var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries()); -var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries()); -var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function'; -var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]()); -var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function'; -var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]()); -var toStringLeftSliceLength = 8; -var toStringRightSliceLength = -1; -/** - * ### typeOf (obj) - * - * Uses `Object.prototype.toString` to determine the type of an object, - * normalising behaviour across engine versions & well optimised. - * - * @param {Mixed} object - * @return {String} object type - * @api public - */ -function typeDetect(obj) { - /* ! Speed optimisation - * Pre: - * string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled) - * boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled) - * number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled) - * undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled) - * function x 2,556,769 ops/sec ±1.73% (77 runs sampled) - * Post: - * string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled) - * boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled) - * number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled) - * undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled) - * function x 31,296,870 ops/sec ±0.96% (83 runs sampled) - */ - var typeofObj = typeof obj; - if (typeofObj !== 'object') { - return typeofObj; - } - - /* ! Speed optimisation - * Pre: - * null x 28,645,765 ops/sec ±1.17% (82 runs sampled) - * Post: - * null x 36,428,962 ops/sec ±1.37% (84 runs sampled) - */ - if (obj === null) { - return 'null'; - } - - /* ! Spec Conformance - * Test: `Object.prototype.toString.call(window)`` - * - Node === "[object global]" - * - Chrome === "[object global]" - * - Firefox === "[object Window]" - * - PhantomJS === "[object Window]" - * - Safari === "[object Window]" - * - IE 11 === "[object Window]" - * - IE Edge === "[object Window]" - * Test: `Object.prototype.toString.call(this)`` - * - Chrome Worker === "[object global]" - * - Firefox Worker === "[object DedicatedWorkerGlobalScope]" - * - Safari Worker === "[object DedicatedWorkerGlobalScope]" - * - IE 11 Worker === "[object WorkerGlobalScope]" - * - IE Edge Worker === "[object WorkerGlobalScope]" - */ - if (obj === globalObject) { - return 'global'; - } - - /* ! Speed optimisation - * Pre: - * array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled) - * Post: - * array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled) - */ - if ( - Array.isArray(obj) && - (symbolToStringTagExists === false || !(Symbol.toStringTag in obj)) - ) { - return 'Array'; - } - - // Not caching existence of `window` and related properties due to potential - // for `window` to be unset before tests in quasi-browser environments. - if (typeof window === 'object' && window !== null) { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/browsers.html#location) - * WhatWG HTML$7.7.3 - The `Location` interface - * Test: `Object.prototype.toString.call(window.location)`` - * - IE <=11 === "[object Object]" - * - IE Edge <=13 === "[object Object]" - */ - if (typeof window.location === 'object' && obj === window.location) { - return 'Location'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#document) - * WhatWG HTML$3.1.1 - The `Document` object - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * WhatWG HTML states: - * > For historical reasons, Window objects must also have a - * > writable, configurable, non-enumerable property named - * > HTMLDocument whose value is the Document interface object. - * Test: `Object.prototype.toString.call(document)`` - * - Chrome === "[object HTMLDocument]" - * - Firefox === "[object HTMLDocument]" - * - Safari === "[object HTMLDocument]" - * - IE <=10 === "[object Document]" - * - IE 11 === "[object HTMLDocument]" - * - IE Edge <=13 === "[object HTMLDocument]" - */ - if (typeof window.document === 'object' && obj === window.document) { - return 'Document'; - } - - if (typeof window.navigator === 'object') { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray) - * WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray - * Test: `Object.prototype.toString.call(navigator.mimeTypes)`` - * - IE <=10 === "[object MSMimeTypesCollection]" - */ - if (typeof window.navigator.mimeTypes === 'object' && - obj === window.navigator.mimeTypes) { - return 'MimeTypeArray'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) - * WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray - * Test: `Object.prototype.toString.call(navigator.plugins)`` - * - IE <=10 === "[object MSPluginsCollection]" - */ - if (typeof window.navigator.plugins === 'object' && - obj === window.navigator.plugins) { - return 'PluginArray'; - } - } - - if ((typeof window.HTMLElement === 'function' || - typeof window.HTMLElement === 'object') && - obj instanceof window.HTMLElement) { - /* ! Spec Conformance - * (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray) - * WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement` - * Test: `Object.prototype.toString.call(document.createElement('blockquote'))`` - * - IE <=10 === "[object HTMLBlockElement]" - */ - if (obj.tagName === 'BLOCKQUOTE') { - return 'HTMLQuoteElement'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#htmltabledatacellelement) - * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement` - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * Test: Object.prototype.toString.call(document.createElement('td')) - * - Chrome === "[object HTMLTableCellElement]" - * - Firefox === "[object HTMLTableCellElement]" - * - Safari === "[object HTMLTableCellElement]" - */ - if (obj.tagName === 'TD') { - return 'HTMLTableDataCellElement'; - } - - /* ! Spec Conformance - * (https://html.spec.whatwg.org/#htmltableheadercellelement) - * WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement` - * Note: Most browsers currently adher to the W3C DOM Level 2 spec - * (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075) - * which suggests that browsers should use HTMLTableCellElement for - * both TD and TH elements. WhatWG separates these. - * Test: Object.prototype.toString.call(document.createElement('th')) - * - Chrome === "[object HTMLTableCellElement]" - * - Firefox === "[object HTMLTableCellElement]" - * - Safari === "[object HTMLTableCellElement]" - */ - if (obj.tagName === 'TH') { - return 'HTMLTableHeaderCellElement'; - } - } - } - - /* ! Speed optimisation - * Pre: - * Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled) - * Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled) - * Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled) - * Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled) - * Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled) - * Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled) - * Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled) - * Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled) - * Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled) - * Post: - * Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled) - * Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled) - * Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled) - * Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled) - * Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled) - * Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled) - * Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled) - * Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled) - * Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled) - */ - var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]); - if (typeof stringTag === 'string') { - return stringTag; - } - - var objPrototype = Object.getPrototypeOf(obj); - /* ! Speed optimisation - * Pre: - * regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled) - * regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled) - * Post: - * regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled) - * regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled) - */ - if (objPrototype === RegExp.prototype) { - return 'RegExp'; - } - - /* ! Speed optimisation - * Pre: - * date x 2,130,074 ops/sec ±4.42% (68 runs sampled) - * Post: - * date x 3,953,779 ops/sec ±1.35% (77 runs sampled) - */ - if (objPrototype === Date.prototype) { - return 'Date'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag) - * ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise": - * Test: `Object.prototype.toString.call(Promise.resolve())`` - * - Chrome <=47 === "[object Object]" - * - Edge <=20 === "[object Object]" - * - Firefox 29-Latest === "[object Promise]" - * - Safari 7.1-Latest === "[object Promise]" - */ - if (promiseExists && objPrototype === Promise.prototype) { - return 'Promise'; - } - - /* ! Speed optimisation - * Pre: - * set x 2,222,186 ops/sec ±1.31% (82 runs sampled) - * Post: - * set x 4,545,879 ops/sec ±1.13% (83 runs sampled) - */ - if (setExists && objPrototype === Set.prototype) { - return 'Set'; - } - - /* ! Speed optimisation - * Pre: - * map x 2,396,842 ops/sec ±1.59% (81 runs sampled) - * Post: - * map x 4,183,945 ops/sec ±6.59% (82 runs sampled) - */ - if (mapExists && objPrototype === Map.prototype) { - return 'Map'; - } - - /* ! Speed optimisation - * Pre: - * weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled) - * Post: - * weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled) - */ - if (weakSetExists && objPrototype === WeakSet.prototype) { - return 'WeakSet'; - } - - /* ! Speed optimisation - * Pre: - * weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled) - * Post: - * weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled) - */ - if (weakMapExists && objPrototype === WeakMap.prototype) { - return 'WeakMap'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag) - * ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView": - * Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))`` - * - Edge <=13 === "[object Object]" - */ - if (dataViewExists && objPrototype === DataView.prototype) { - return 'DataView'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag) - * ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator": - * Test: `Object.prototype.toString.call(new Map().entries())`` - * - Edge <=13 === "[object Object]" - */ - if (mapExists && objPrototype === mapIteratorPrototype) { - return 'Map Iterator'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag) - * ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator": - * Test: `Object.prototype.toString.call(new Set().entries())`` - * - Edge <=13 === "[object Object]" - */ - if (setExists && objPrototype === setIteratorPrototype) { - return 'Set Iterator'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag) - * ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator": - * Test: `Object.prototype.toString.call([][Symbol.iterator]())`` - * - Edge <=13 === "[object Object]" - */ - if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) { - return 'Array Iterator'; - } - - /* ! Spec Conformance - * (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag) - * ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator": - * Test: `Object.prototype.toString.call(''[Symbol.iterator]())`` - * - Edge <=13 === "[object Object]" - */ - if (stringIteratorExists && objPrototype === stringIteratorPrototype) { - return 'String Iterator'; - } - - /* ! Speed optimisation - * Pre: - * object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled) - * Post: - * object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled) - */ - if (objPrototype === null) { - return 'Object'; - } - - return Object - .prototype - .toString - .call(obj) - .slice(toStringLeftSliceLength, toStringRightSliceLength); -} - -return typeDetect; - -}))); - -},{}]},{},[1])(1) -}); diff --git a/index.js b/index.js index 634483b02..ea4874863 100644 --- a/index.js +++ b/index.js @@ -1 +1 @@ -module.exports = require('./lib/chai'); +export * from './lib/chai.js'; diff --git a/index.mjs b/index.mjs index fb824396f..65b726ad9 100644 --- a/index.mjs +++ b/index.mjs @@ -2,6 +2,7 @@ import chai from './index.js'; export const expect = chai.expect; export const version = chai.version; +export const Assertion = chai.Assertion; export const AssertionError = chai.AssertionError; export const util = chai.util; export const config = chai.config; diff --git a/karma.conf.js b/karma.conf.cjs similarity index 78% rename from karma.conf.js rename to karma.conf.cjs index e22923fc5..edbd5a97a 100644 --- a/karma.conf.js +++ b/karma.conf.cjs @@ -2,9 +2,9 @@ module.exports = function(config) { config.set({ frameworks: [ 'mocha' ] , files: [ - 'chai.js' - , 'test/bootstrap/index.js' - , 'test/*.js' + { pattern: 'chai.js', type: 'module', included: false, served: true } + , { pattern: 'test/bootstrap/index.js', type: 'module'} + , { pattern: 'test/*.js', type: 'module' } ] , reporters: [ 'progress' ] , colors: true diff --git a/lib/chai.js b/lib/chai.js index 85e2878bb..5a994e549 100644 --- a/lib/chai.js +++ b/lib/chai.js @@ -4,25 +4,28 @@ * MIT Licensed */ -var used = []; +import * as util from './chai/utils/index.js'; +import AssertionError from 'assertion-error'; +import {config} from './chai/config.js'; +import './chai/core/assertions.js'; +import {expect} from './chai/interface/expect.js'; +import {Assertion} from './chai/assertion.js'; +import * as should from './chai/interface/should.js'; +import {assert} from './chai/interface/assert.js'; + +const used = []; /*! * Chai version */ -exports.version = '4.3.1'; +export const version = '4.3.3'; /*! * Assertion Error */ -exports.AssertionError = require('assertion-error'); - -/*! - * Utils for plugins (not exported) - */ - -var util = require('./chai/utils'); +export {AssertionError}; /** * # .use(function) @@ -34,7 +37,17 @@ var util = require('./chai/utils'); * @api public */ -exports.use = function (fn) { +export function use(fn) { + const exports = { + AssertionError, + util, + config, + expect, + assert, + Assertion, + ...should + }; + if (!~used.indexOf(fn)) { fn(exports, util); used.push(fn); @@ -47,46 +60,34 @@ exports.use = function (fn) { * Utility Functions */ -exports.util = util; +export {util}; /*! * Configuration */ -var config = require('./chai/config'); -exports.config = config; +export {config}; /*! * Primary `Assertion` prototype */ -var assertion = require('./chai/assertion'); -exports.use(assertion); - -/*! - * Core Assertions - */ - -var core = require('./chai/core/assertions'); -exports.use(core); +export * from './chai/assertion.js'; /*! * Expect interface */ -var expect = require('./chai/interface/expect'); -exports.use(expect); +export * from './chai/interface/expect.js'; /*! * Should interface */ -var should = require('./chai/interface/should'); -exports.use(should); +export * from './chai/interface/should.js'; /*! * Assert interface */ -var assert = require('./chai/interface/assert'); -exports.use(assert); +export * from './chai/interface/assert.js'; diff --git a/lib/chai/assertion.js b/lib/chai/assertion.js index 8ed93ae7e..24a4fb1f9 100644 --- a/lib/chai/assertion.js +++ b/lib/chai/assertion.js @@ -5,171 +5,158 @@ * MIT Licensed */ -var config = require('./config'); - -module.exports = function (_chai, util) { - /*! - * Module dependencies. - */ - - var AssertionError = _chai.AssertionError - , flag = util.flag; - - /*! - * Module export. - */ - - _chai.Assertion = Assertion; - - /*! - * Assertion Constructor - * - * Creates object for chaining. - * - * `Assertion` objects contain metadata in the form of flags. Three flags can - * be assigned during instantiation by passing arguments to this constructor: - * - * - `object`: This flag contains the target of the assertion. For example, in - * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will - * contain `numKittens` so that the `equal` assertion can reference it when - * needed. - * - * - `message`: This flag contains an optional custom error message to be - * prepended to the error message that's generated by the assertion when it - * fails. - * - * - `ssfi`: This flag stands for "start stack function indicator". It - * contains a function reference that serves as the starting point for - * removing frames from the stack trace of the error that's created by the - * assertion when it fails. The goal is to provide a cleaner stack trace to - * end users by removing Chai's internal functions. Note that it only works - * in environments that support `Error.captureStackTrace`, and only when - * `Chai.config.includeStack` hasn't been set to `false`. - * - * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag - * should retain its current value, even as assertions are chained off of - * this object. This is usually set to `true` when creating a new assertion - * from within another assertion. It's also temporarily set to `true` before - * an overwritten assertion gets called by the overwriting assertion. - * - * @param {Mixed} obj target of the assertion - * @param {String} msg (optional) custom error message - * @param {Function} ssfi (optional) starting point for removing stack frames - * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked - * @api private - */ - - function Assertion (obj, msg, ssfi, lockSsfi) { - flag(this, 'ssfi', ssfi || Assertion); - flag(this, 'lockSsfi', lockSsfi); - flag(this, 'object', obj); - flag(this, 'message', msg); - - return util.proxify(this); +import {config} from './config.js'; +import AssertionError from 'assertion-error'; +import * as util from './utils/index.js'; + +/*! + * Assertion Constructor + * + * Creates object for chaining. + * + * `Assertion` objects contain metadata in the form of flags. Three flags can + * be assigned during instantiation by passing arguments to this constructor: + * + * - `object`: This flag contains the target of the assertion. For example, in + * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will + * contain `numKittens` so that the `equal` assertion can reference it when + * needed. + * + * - `message`: This flag contains an optional custom error message to be + * prepended to the error message that's generated by the assertion when it + * fails. + * + * - `ssfi`: This flag stands for "start stack function indicator". It + * contains a function reference that serves as the starting point for + * removing frames from the stack trace of the error that's created by the + * assertion when it fails. The goal is to provide a cleaner stack trace to + * end users by removing Chai's internal functions. Note that it only works + * in environments that support `Error.captureStackTrace`, and only when + * `Chai.config.includeStack` hasn't been set to `false`. + * + * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag + * should retain its current value, even as assertions are chained off of + * this object. This is usually set to `true` when creating a new assertion + * from within another assertion. It's also temporarily set to `true` before + * an overwritten assertion gets called by the overwriting assertion. + * + * @param {Mixed} obj target of the assertion + * @param {String} msg (optional) custom error message + * @param {Function} ssfi (optional) starting point for removing stack frames + * @param {Boolean} lockSsfi (optional) whether or not the ssfi flag is locked + * @api private + */ + +export function Assertion (obj, msg, ssfi, lockSsfi) { + util.flag(this, 'ssfi', ssfi || Assertion); + util.flag(this, 'lockSsfi', lockSsfi); + util.flag(this, 'object', obj); + util.flag(this, 'message', msg); + + return util.proxify(this); +} + +Object.defineProperty(Assertion, 'includeStack', { + get: function() { + console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); + return config.includeStack; + }, + set: function(value) { + console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); + config.includeStack = value; } +}); + +Object.defineProperty(Assertion, 'showDiff', { + get: function() { + console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); + return config.showDiff; + }, + set: function(value) { + console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); + config.showDiff = value; + } +}); + +Assertion.addProperty = function (name, fn) { + util.addProperty(this.prototype, name, fn); +}; - Object.defineProperty(Assertion, 'includeStack', { - get: function() { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - return config.includeStack; - }, - set: function(value) { - console.warn('Assertion.includeStack is deprecated, use chai.config.includeStack instead.'); - config.includeStack = value; +Assertion.addMethod = function (name, fn) { + util.addMethod(this.prototype, name, fn); +}; + +Assertion.addChainableMethod = function (name, fn, chainingBehavior) { + util.addChainableMethod(this.prototype, name, fn, chainingBehavior); +}; + +Assertion.overwriteProperty = function (name, fn) { + util.overwriteProperty(this.prototype, name, fn); +}; + +Assertion.overwriteMethod = function (name, fn) { + util.overwriteMethod(this.prototype, name, fn); +}; + +Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) { + util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); +}; + +/** + * ### .assert(expression, message, negateMessage, expected, actual, showDiff) + * + * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. + * + * @name assert + * @param {Philosophical} expression to be tested + * @param {String|Function} message or function that returns message to display if expression fails + * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails + * @param {Mixed} expected value (remember to check for negation) + * @param {Mixed} actual (optional) will default to `this.obj` + * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails + * @api private + */ + +Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) { + var ok = util.test(this, arguments); + if (false !== showDiff) showDiff = true; + if (undefined === expected && undefined === _actual) showDiff = false; + if (true !== config.showDiff) showDiff = false; + + if (!ok) { + msg = util.getMessage(this, arguments); + var actual = util.getActual(this, arguments); + var assertionErrorObjectProperties = { + actual: actual + , expected: expected + , showDiff: showDiff + }; + + var operator = util.getOperator(this, arguments); + if (operator) { + assertionErrorObjectProperties.operator = operator; } - }); - - Object.defineProperty(Assertion, 'showDiff', { - get: function() { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - return config.showDiff; - }, - set: function(value) { - console.warn('Assertion.showDiff is deprecated, use chai.config.showDiff instead.'); - config.showDiff = value; + + throw new AssertionError( + msg, + assertionErrorObjectProperties, + (config.includeStack) ? this.assert : util.flag(this, 'ssfi')); + } +}; + +/*! + * ### ._obj + * + * Quick reference to stored `actual` value for plugin developers. + * + * @api private + */ + +Object.defineProperty(Assertion.prototype, '_obj', + { get: function () { + return util.flag(this, 'object'); } - }); - - Assertion.addProperty = function (name, fn) { - util.addProperty(this.prototype, name, fn); - }; - - Assertion.addMethod = function (name, fn) { - util.addMethod(this.prototype, name, fn); - }; - - Assertion.addChainableMethod = function (name, fn, chainingBehavior) { - util.addChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - Assertion.overwriteProperty = function (name, fn) { - util.overwriteProperty(this.prototype, name, fn); - }; - - Assertion.overwriteMethod = function (name, fn) { - util.overwriteMethod(this.prototype, name, fn); - }; - - Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) { - util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); - }; - - /** - * ### .assert(expression, message, negateMessage, expected, actual, showDiff) - * - * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. - * - * @name assert - * @param {Philosophical} expression to be tested - * @param {String|Function} message or function that returns message to display if expression fails - * @param {String|Function} negatedMessage or function that returns negatedMessage to display if negated expression fails - * @param {Mixed} expected value (remember to check for negation) - * @param {Mixed} actual (optional) will default to `this.obj` - * @param {Boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails - * @api private - */ - - Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) { - var ok = util.test(this, arguments); - if (false !== showDiff) showDiff = true; - if (undefined === expected && undefined === _actual) showDiff = false; - if (true !== config.showDiff) showDiff = false; - - if (!ok) { - msg = util.getMessage(this, arguments); - var actual = util.getActual(this, arguments); - var assertionErrorObjectProperties = { - actual: actual - , expected: expected - , showDiff: showDiff - }; - - var operator = util.getOperator(this, arguments); - if (operator) { - assertionErrorObjectProperties.operator = operator; - } - - throw new AssertionError( - msg, - assertionErrorObjectProperties, - (config.includeStack) ? this.assert : flag(this, 'ssfi')); + , set: function (val) { + util.flag(this, 'object', val); } - }; - - /*! - * ### ._obj - * - * Quick reference to stored `actual` value for plugin developers. - * - * @api private - */ - - Object.defineProperty(Assertion.prototype, '_obj', - { get: function () { - return flag(this, 'object'); - } - , set: function (val) { - flag(this, 'object', val); - } - }); -}; +}); diff --git a/lib/chai/config.js b/lib/chai/config.js index 412a0c806..eb0e169fc 100644 --- a/lib/chai/config.js +++ b/lib/chai/config.js @@ -1,4 +1,4 @@ -module.exports = { +export const config = { /** * ### config.includeStack diff --git a/lib/chai/core/assertions.js b/lib/chai/core/assertions.js index 5cfd2d94e..2820327ea 100644 --- a/lib/chai/core/assertions.js +++ b/lib/chai/core/assertions.js @@ -5,3849 +5,3849 @@ * MIT Licensed */ -module.exports = function (chai, _) { - var Assertion = chai.Assertion - , AssertionError = chai.AssertionError - , flag = _.flag; - - /** - * ### Language Chains - * - * The following are provided as chainable getters to improve the readability - * of your assertions. - * - * **Chains** - * - * - to - * - be - * - been - * - is - * - that - * - which - * - and - * - has - * - have - * - with - * - at - * - of - * - same - * - but - * - does - * - still - * - also - * - * @name language chains - * @namespace BDD - * @api public - */ - - [ 'to', 'be', 'been', 'is' - , 'and', 'has', 'have', 'with' - , 'that', 'which', 'at', 'of' - , 'same', 'but', 'does', 'still', "also" ].forEach(function (chain) { - Assertion.addProperty(chain); - }); +import {Assertion} from '../assertion.js'; +import AssertionError from 'assertion-error'; +import * as _ from '../utils/index.js'; + +const {flag} = _; + +/** + * ### Language Chains + * + * The following are provided as chainable getters to improve the readability + * of your assertions. + * + * **Chains** + * + * - to + * - be + * - been + * - is + * - that + * - which + * - and + * - has + * - have + * - with + * - at + * - of + * - same + * - but + * - does + * - still + * - also + * + * @name language chains + * @namespace BDD + * @api public + */ - /** - * ### .not - * - * Negates all assertions that follow in the chain. - * - * expect(function () {}).to.not.throw(); - * expect({a: 1}).to.not.have.property('b'); - * expect([1, 2]).to.be.an('array').that.does.not.include(3); - * - * Just because you can negate any assertion with `.not` doesn't mean you - * should. With great power comes great responsibility. It's often best to - * assert that the one expected output was produced, rather than asserting - * that one of countless unexpected outputs wasn't produced. See individual - * assertions for specific guidance. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.not.equal(1); // Not recommended - * - * @name not - * @namespace BDD - * @api public - */ - - Assertion.addProperty('not', function () { - flag(this, 'negate', true); - }); +[ 'to', 'be', 'been', 'is' +, 'and', 'has', 'have', 'with' +, 'that', 'which', 'at', 'of' +, 'same', 'but', 'does', 'still', "also" ].forEach(function (chain) { + Assertion.addProperty(chain); +}); + +/** + * ### .not + * + * Negates all assertions that follow in the chain. + * + * expect(function () {}).to.not.throw(); + * expect({a: 1}).to.not.have.property('b'); + * expect([1, 2]).to.be.an('array').that.does.not.include(3); + * + * Just because you can negate any assertion with `.not` doesn't mean you + * should. With great power comes great responsibility. It's often best to + * assert that the one expected output was produced, rather than asserting + * that one of countless unexpected outputs wasn't produced. See individual + * assertions for specific guidance. + * + * expect(2).to.equal(2); // Recommended + * expect(2).to.not.equal(1); // Not recommended + * + * @name not + * @namespace BDD + * @api public + */ - /** - * ### .deep - * - * Causes all `.equal`, `.include`, `.members`, `.keys`, and `.property` - * assertions that follow in the chain to use deep equality instead of strict - * (`===`) equality. See the `deep-eql` project page for info on the deep - * equality algorithm: https://github.com/chaijs/deep-eql. - * - * // Target object deeply (but not strictly) equals `{a: 1}` - * expect({a: 1}).to.deep.equal({a: 1}); - * expect({a: 1}).to.not.equal({a: 1}); - * - * // Target array deeply (but not strictly) includes `{a: 1}` - * expect([{a: 1}]).to.deep.include({a: 1}); - * expect([{a: 1}]).to.not.include({a: 1}); - * - * // Target object deeply (but not strictly) includes `x: {a: 1}` - * expect({x: {a: 1}}).to.deep.include({x: {a: 1}}); - * expect({x: {a: 1}}).to.not.include({x: {a: 1}}); - * - * // Target array deeply (but not strictly) has member `{a: 1}` - * expect([{a: 1}]).to.have.deep.members([{a: 1}]); - * expect([{a: 1}]).to.not.have.members([{a: 1}]); - * - * // Target set deeply (but not strictly) has key `{a: 1}` - * expect(new Set([{a: 1}])).to.have.deep.keys([{a: 1}]); - * expect(new Set([{a: 1}])).to.not.have.keys([{a: 1}]); - * - * // Target object deeply (but not strictly) has property `x: {a: 1}` - * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1}); - * expect({x: {a: 1}}).to.not.have.property('x', {a: 1}); - * - * @name deep - * @namespace BDD - * @api public - */ - - Assertion.addProperty('deep', function () { - flag(this, 'deep', true); - }); +Assertion.addProperty('not', function () { + flag(this, 'negate', true); +}); + +/** + * ### .deep + * + * Causes all `.equal`, `.include`, `.members`, `.keys`, and `.property` + * assertions that follow in the chain to use deep equality instead of strict + * (`===`) equality. See the `deep-eql` project page for info on the deep + * equality algorithm: https://github.com/chaijs/deep-eql. + * + * // Target object deeply (but not strictly) equals `{a: 1}` + * expect({a: 1}).to.deep.equal({a: 1}); + * expect({a: 1}).to.not.equal({a: 1}); + * + * // Target array deeply (but not strictly) includes `{a: 1}` + * expect([{a: 1}]).to.deep.include({a: 1}); + * expect([{a: 1}]).to.not.include({a: 1}); + * + * // Target object deeply (but not strictly) includes `x: {a: 1}` + * expect({x: {a: 1}}).to.deep.include({x: {a: 1}}); + * expect({x: {a: 1}}).to.not.include({x: {a: 1}}); + * + * // Target array deeply (but not strictly) has member `{a: 1}` + * expect([{a: 1}]).to.have.deep.members([{a: 1}]); + * expect([{a: 1}]).to.not.have.members([{a: 1}]); + * + * // Target set deeply (but not strictly) has key `{a: 1}` + * expect(new Set([{a: 1}])).to.have.deep.keys([{a: 1}]); + * expect(new Set([{a: 1}])).to.not.have.keys([{a: 1}]); + * + * // Target object deeply (but not strictly) has property `x: {a: 1}` + * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1}); + * expect({x: {a: 1}}).to.not.have.property('x', {a: 1}); + * + * @name deep + * @namespace BDD + * @api public + */ - /** - * ### .nested - * - * Enables dot- and bracket-notation in all `.property` and `.include` - * assertions that follow in the chain. - * - * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]'); - * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'}); - * - * If `.` or `[]` are part of an actual property name, they can be escaped by - * adding two backslashes before them. - * - * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]'); - * expect({'.a': {'[b]': 'x'}}).to.nested.include({'\\.a.\\[b\\]': 'x'}); - * - * `.nested` cannot be combined with `.own`. - * - * @name nested - * @namespace BDD - * @api public - */ - - Assertion.addProperty('nested', function () { - flag(this, 'nested', true); - }); +Assertion.addProperty('deep', function () { + flag(this, 'deep', true); +}); + +/** + * ### .nested + * + * Enables dot- and bracket-notation in all `.property` and `.include` + * assertions that follow in the chain. + * + * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]'); + * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'}); + * + * If `.` or `[]` are part of an actual property name, they can be escaped by + * adding two backslashes before them. + * + * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]'); + * expect({'.a': {'[b]': 'x'}}).to.nested.include({'\\.a.\\[b\\]': 'x'}); + * + * `.nested` cannot be combined with `.own`. + * + * @name nested + * @namespace BDD + * @api public + */ - /** - * ### .own - * - * Causes all `.property` and `.include` assertions that follow in the chain - * to ignore inherited properties. - * - * Object.prototype.b = 2; - * - * expect({a: 1}).to.have.own.property('a'); - * expect({a: 1}).to.have.property('b'); - * expect({a: 1}).to.not.have.own.property('b'); - * - * expect({a: 1}).to.own.include({a: 1}); - * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2}); - * - * `.own` cannot be combined with `.nested`. - * - * @name own - * @namespace BDD - * @api public - */ - - Assertion.addProperty('own', function () { - flag(this, 'own', true); - }); +Assertion.addProperty('nested', function () { + flag(this, 'nested', true); +}); + +/** + * ### .own + * + * Causes all `.property` and `.include` assertions that follow in the chain + * to ignore inherited properties. + * + * Object.prototype.b = 2; + * + * expect({a: 1}).to.have.own.property('a'); + * expect({a: 1}).to.have.property('b'); + * expect({a: 1}).to.not.have.own.property('b'); + * + * expect({a: 1}).to.own.include({a: 1}); + * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2}); + * + * `.own` cannot be combined with `.nested`. + * + * @name own + * @namespace BDD + * @api public + */ - /** - * ### .ordered - * - * Causes all `.members` assertions that follow in the chain to require that - * members be in the same order. - * - * expect([1, 2]).to.have.ordered.members([1, 2]) - * .but.not.have.ordered.members([2, 1]); - * - * When `.include` and `.ordered` are combined, the ordering begins at the - * start of both arrays. - * - * expect([1, 2, 3]).to.include.ordered.members([1, 2]) - * .but.not.include.ordered.members([2, 3]); - * - * @name ordered - * @namespace BDD - * @api public - */ - - Assertion.addProperty('ordered', function () { - flag(this, 'ordered', true); - }); +Assertion.addProperty('own', function () { + flag(this, 'own', true); +}); + +/** + * ### .ordered + * + * Causes all `.members` assertions that follow in the chain to require that + * members be in the same order. + * + * expect([1, 2]).to.have.ordered.members([1, 2]) + * .but.not.have.ordered.members([2, 1]); + * + * When `.include` and `.ordered` are combined, the ordering begins at the + * start of both arrays. + * + * expect([1, 2, 3]).to.include.ordered.members([1, 2]) + * .but.not.include.ordered.members([2, 3]); + * + * @name ordered + * @namespace BDD + * @api public + */ - /** - * ### .any - * - * Causes all `.keys` assertions that follow in the chain to only require that - * the target have at least one of the given keys. This is the opposite of - * `.all`, which requires that the target have all of the given keys. - * - * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd'); - * - * See the `.keys` doc for guidance on when to use `.any` or `.all`. - * - * @name any - * @namespace BDD - * @api public - */ - - Assertion.addProperty('any', function () { - flag(this, 'any', true); - flag(this, 'all', false); - }); +Assertion.addProperty('ordered', function () { + flag(this, 'ordered', true); +}); + +/** + * ### .any + * + * Causes all `.keys` assertions that follow in the chain to only require that + * the target have at least one of the given keys. This is the opposite of + * `.all`, which requires that the target have all of the given keys. + * + * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd'); + * + * See the `.keys` doc for guidance on when to use `.any` or `.all`. + * + * @name any + * @namespace BDD + * @api public + */ - /** - * ### .all - * - * Causes all `.keys` assertions that follow in the chain to require that the - * target have all of the given keys. This is the opposite of `.any`, which - * only requires that the target have at least one of the given keys. - * - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); - * - * Note that `.all` is used by default when neither `.all` nor `.any` are - * added earlier in the chain. However, it's often best to add `.all` anyway - * because it improves readability. - * - * See the `.keys` doc for guidance on when to use `.any` or `.all`. - * - * @name all - * @namespace BDD - * @api public - */ - - Assertion.addProperty('all', function () { - flag(this, 'all', true); - flag(this, 'any', false); - }); +Assertion.addProperty('any', function () { + flag(this, 'any', true); + flag(this, 'all', false); +}); + +/** + * ### .all + * + * Causes all `.keys` assertions that follow in the chain to require that the + * target have all of the given keys. This is the opposite of `.any`, which + * only requires that the target have at least one of the given keys. + * + * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); + * + * Note that `.all` is used by default when neither `.all` nor `.any` are + * added earlier in the chain. However, it's often best to add `.all` anyway + * because it improves readability. + * + * See the `.keys` doc for guidance on when to use `.any` or `.all`. + * + * @name all + * @namespace BDD + * @api public + */ - /** - * ### .a(type[, msg]) - * - * Asserts that the target's type is equal to the given string `type`. Types - * are case insensitive. See the `type-detect` project page for info on the - * type detection algorithm: https://github.com/chaijs/type-detect. - * - * expect('foo').to.be.a('string'); - * expect({a: 1}).to.be.an('object'); - * expect(null).to.be.a('null'); - * expect(undefined).to.be.an('undefined'); - * expect(new Error).to.be.an('error'); - * expect(Promise.resolve()).to.be.a('promise'); - * expect(new Float32Array).to.be.a('float32array'); - * expect(Symbol()).to.be.a('symbol'); - * - * `.a` supports objects that have a custom type set via `Symbol.toStringTag`. - * - * var myObj = { - * [Symbol.toStringTag]: 'myCustomType' - * }; - * - * expect(myObj).to.be.a('myCustomType').but.not.an('object'); - * - * It's often best to use `.a` to check a target's type before making more - * assertions on the same target. That way, you avoid unexpected behavior from - * any assertion that does different things based on the target's type. - * - * expect([1, 2, 3]).to.be.an('array').that.includes(2); - * expect([]).to.be.an('array').that.is.empty; - * - * Add `.not` earlier in the chain to negate `.a`. However, it's often best to - * assert that the target is the expected type, rather than asserting that it - * isn't one of many unexpected types. - * - * expect('foo').to.be.a('string'); // Recommended - * expect('foo').to.not.be.an('array'); // Not recommended - * - * `.a` accepts an optional `msg` argument which is a custom error message to - * show when the assertion fails. The message can also be given as the second - * argument to `expect`. - * - * expect(1).to.be.a('string', 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.a('string'); - * - * `.a` can also be used as a language chain to improve the readability of - * your assertions. - * - * expect({b: 2}).to.have.a.property('b'); - * - * The alias `.an` can be used interchangeably with `.a`. - * - * @name a - * @alias an - * @param {String} type - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function an (type, msg) { - if (msg) flag(this, 'message', msg); - type = type.toLowerCase(); - var obj = flag(this, 'object') - , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a '; +Assertion.addProperty('all', function () { + flag(this, 'all', true); + flag(this, 'any', false); +}); + +/** + * ### .a(type[, msg]) + * + * Asserts that the target's type is equal to the given string `type`. Types + * are case insensitive. See the `type-detect` project page for info on the + * type detection algorithm: https://github.com/chaijs/type-detect. + * + * expect('foo').to.be.a('string'); + * expect({a: 1}).to.be.an('object'); + * expect(null).to.be.a('null'); + * expect(undefined).to.be.an('undefined'); + * expect(new Error).to.be.an('error'); + * expect(Promise.resolve()).to.be.a('promise'); + * expect(new Float32Array).to.be.a('float32array'); + * expect(Symbol()).to.be.a('symbol'); + * + * `.a` supports objects that have a custom type set via `Symbol.toStringTag`. + * + * var myObj = { + * [Symbol.toStringTag]: 'myCustomType' + * }; + * + * expect(myObj).to.be.a('myCustomType').but.not.an('object'); + * + * It's often best to use `.a` to check a target's type before making more + * assertions on the same target. That way, you avoid unexpected behavior from + * any assertion that does different things based on the target's type. + * + * expect([1, 2, 3]).to.be.an('array').that.includes(2); + * expect([]).to.be.an('array').that.is.empty; + * + * Add `.not` earlier in the chain to negate `.a`. However, it's often best to + * assert that the target is the expected type, rather than asserting that it + * isn't one of many unexpected types. + * + * expect('foo').to.be.a('string'); // Recommended + * expect('foo').to.not.be.an('array'); // Not recommended + * + * `.a` accepts an optional `msg` argument which is a custom error message to + * show when the assertion fails. The message can also be given as the second + * argument to `expect`. + * + * expect(1).to.be.a('string', 'nooo why fail??'); + * expect(1, 'nooo why fail??').to.be.a('string'); + * + * `.a` can also be used as a language chain to improve the readability of + * your assertions. + * + * expect({b: 2}).to.have.a.property('b'); + * + * The alias `.an` can be used interchangeably with `.a`. + * + * @name a + * @alias an + * @param {String} type + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - this.assert( - type === _.type(obj).toLowerCase() - , 'expected #{this} to be ' + article + type - , 'expected #{this} not to be ' + article + type - ); - } +function an (type, msg) { + if (msg) flag(this, 'message', msg); + type = type.toLowerCase(); + var obj = flag(this, 'object') + , article = ~[ 'a', 'e', 'i', 'o', 'u' ].indexOf(type.charAt(0)) ? 'an ' : 'a '; + + this.assert( + type === _.type(obj).toLowerCase() + , 'expected #{this} to be ' + article + type + , 'expected #{this} not to be ' + article + type + ); +} + +Assertion.addChainableMethod('an', an); +Assertion.addChainableMethod('a', an); + +/** + * ### .include(val[, msg]) + * + * When the target is a string, `.include` asserts that the given string `val` + * is a substring of the target. + * + * expect('foobar').to.include('foo'); + * + * When the target is an array, `.include` asserts that the given `val` is a + * member of the target. + * + * expect([1, 2, 3]).to.include(2); + * + * When the target is an object, `.include` asserts that the given object + * `val`'s properties are a subset of the target's properties. + * + * expect({a: 1, b: 2, c: 3}).to.include({a: 1, b: 2}); + * + * When the target is a Set or WeakSet, `.include` asserts that the given `val` is a + * member of the target. SameValueZero equality algorithm is used. + * + * expect(new Set([1, 2])).to.include(2); + * + * When the target is a Map, `.include` asserts that the given `val` is one of + * the values of the target. SameValueZero equality algorithm is used. + * + * expect(new Map([['a', 1], ['b', 2]])).to.include(2); + * + * Because `.include` does different things based on the target's type, it's + * important to check the target's type before using `.include`. See the `.a` + * doc for info on testing a target's type. + * + * expect([1, 2, 3]).to.be.an('array').that.includes(2); + * + * By default, strict (`===`) equality is used to compare array members and + * object properties. Add `.deep` earlier in the chain to use deep equality + * instead (WeakSet targets are not supported). See the `deep-eql` project + * page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql. + * + * // Target array deeply (but not strictly) includes `{a: 1}` + * expect([{a: 1}]).to.deep.include({a: 1}); + * expect([{a: 1}]).to.not.include({a: 1}); + * + * // Target object deeply (but not strictly) includes `x: {a: 1}` + * expect({x: {a: 1}}).to.deep.include({x: {a: 1}}); + * expect({x: {a: 1}}).to.not.include({x: {a: 1}}); + * + * By default, all of the target's properties are searched when working with + * objects. This includes properties that are inherited and/or non-enumerable. + * Add `.own` earlier in the chain to exclude the target's inherited + * properties from the search. + * + * Object.prototype.b = 2; + * + * expect({a: 1}).to.own.include({a: 1}); + * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2}); + * + * Note that a target object is always only searched for `val`'s own + * enumerable properties. + * + * `.deep` and `.own` can be combined. + * + * expect({a: {b: 2}}).to.deep.own.include({a: {b: 2}}); + * + * Add `.nested` earlier in the chain to enable dot- and bracket-notation when + * referencing nested properties. + * + * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'}); + * + * If `.` or `[]` are part of an actual property name, they can be escaped by + * adding two backslashes before them. + * + * expect({'.a': {'[b]': 2}}).to.nested.include({'\\.a.\\[b\\]': 2}); + * + * `.deep` and `.nested` can be combined. + * + * expect({a: {b: [{c: 3}]}}).to.deep.nested.include({'a.b[0]': {c: 3}}); + * + * `.own` and `.nested` cannot be combined. + * + * Add `.not` earlier in the chain to negate `.include`. + * + * expect('foobar').to.not.include('taco'); + * expect([1, 2, 3]).to.not.include(4); + * + * However, it's dangerous to negate `.include` when the target is an object. + * The problem is that it creates uncertain expectations by asserting that the + * target object doesn't have all of `val`'s key/value pairs but may or may + * not have some of them. It's often best to identify the exact output that's + * expected, and then write an assertion that only accepts that exact output. + * + * When the target object isn't even expected to have `val`'s keys, it's + * often best to assert exactly that. + * + * expect({c: 3}).to.not.have.any.keys('a', 'b'); // Recommended + * expect({c: 3}).to.not.include({a: 1, b: 2}); // Not recommended + * + * When the target object is expected to have `val`'s keys, it's often best to + * assert that each of the properties has its expected value, rather than + * asserting that each property doesn't have one of many unexpected values. + * + * expect({a: 3, b: 4}).to.include({a: 3, b: 4}); // Recommended + * expect({a: 3, b: 4}).to.not.include({a: 1, b: 2}); // Not recommended + * + * `.include` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect([1, 2, 3]).to.include(4, 'nooo why fail??'); + * expect([1, 2, 3], 'nooo why fail??').to.include(4); + * + * `.include` can also be used as a language chain, causing all `.members` and + * `.keys` assertions that follow in the chain to require the target to be a + * superset of the expected set, rather than an identical set. Note that + * `.members` ignores duplicates in the subset when `.include` is added. + * + * // Target object's keys are a superset of ['a', 'b'] but not identical + * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b'); + * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b'); + * + * // Target array is a superset of [1, 2] but not identical + * expect([1, 2, 3]).to.include.members([1, 2]); + * expect([1, 2, 3]).to.not.have.members([1, 2]); + * + * // Duplicates in the subset are ignored + * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]); + * + * Note that adding `.any` earlier in the chain causes the `.keys` assertion + * to ignore `.include`. + * + * // Both assertions are identical + * expect({a: 1}).to.include.any.keys('a', 'b'); + * expect({a: 1}).to.have.any.keys('a', 'b'); + * + * The aliases `.includes`, `.contain`, and `.contains` can be used + * interchangeably with `.include`. + * + * @name include + * @alias contain + * @alias includes + * @alias contains + * @param {Mixed} val + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - Assertion.addChainableMethod('an', an); - Assertion.addChainableMethod('a', an); - - /** - * ### .include(val[, msg]) - * - * When the target is a string, `.include` asserts that the given string `val` - * is a substring of the target. - * - * expect('foobar').to.include('foo'); - * - * When the target is an array, `.include` asserts that the given `val` is a - * member of the target. - * - * expect([1, 2, 3]).to.include(2); - * - * When the target is an object, `.include` asserts that the given object - * `val`'s properties are a subset of the target's properties. - * - * expect({a: 1, b: 2, c: 3}).to.include({a: 1, b: 2}); - * - * When the target is a Set or WeakSet, `.include` asserts that the given `val` is a - * member of the target. SameValueZero equality algorithm is used. - * - * expect(new Set([1, 2])).to.include(2); - * - * When the target is a Map, `.include` asserts that the given `val` is one of - * the values of the target. SameValueZero equality algorithm is used. - * - * expect(new Map([['a', 1], ['b', 2]])).to.include(2); - * - * Because `.include` does different things based on the target's type, it's - * important to check the target's type before using `.include`. See the `.a` - * doc for info on testing a target's type. - * - * expect([1, 2, 3]).to.be.an('array').that.includes(2); - * - * By default, strict (`===`) equality is used to compare array members and - * object properties. Add `.deep` earlier in the chain to use deep equality - * instead (WeakSet targets are not supported). See the `deep-eql` project - * page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql. - * - * // Target array deeply (but not strictly) includes `{a: 1}` - * expect([{a: 1}]).to.deep.include({a: 1}); - * expect([{a: 1}]).to.not.include({a: 1}); - * - * // Target object deeply (but not strictly) includes `x: {a: 1}` - * expect({x: {a: 1}}).to.deep.include({x: {a: 1}}); - * expect({x: {a: 1}}).to.not.include({x: {a: 1}}); - * - * By default, all of the target's properties are searched when working with - * objects. This includes properties that are inherited and/or non-enumerable. - * Add `.own` earlier in the chain to exclude the target's inherited - * properties from the search. - * - * Object.prototype.b = 2; - * - * expect({a: 1}).to.own.include({a: 1}); - * expect({a: 1}).to.include({b: 2}).but.not.own.include({b: 2}); - * - * Note that a target object is always only searched for `val`'s own - * enumerable properties. - * - * `.deep` and `.own` can be combined. - * - * expect({a: {b: 2}}).to.deep.own.include({a: {b: 2}}); - * - * Add `.nested` earlier in the chain to enable dot- and bracket-notation when - * referencing nested properties. - * - * expect({a: {b: ['x', 'y']}}).to.nested.include({'a.b[1]': 'y'}); - * - * If `.` or `[]` are part of an actual property name, they can be escaped by - * adding two backslashes before them. - * - * expect({'.a': {'[b]': 2}}).to.nested.include({'\\.a.\\[b\\]': 2}); - * - * `.deep` and `.nested` can be combined. - * - * expect({a: {b: [{c: 3}]}}).to.deep.nested.include({'a.b[0]': {c: 3}}); - * - * `.own` and `.nested` cannot be combined. - * - * Add `.not` earlier in the chain to negate `.include`. - * - * expect('foobar').to.not.include('taco'); - * expect([1, 2, 3]).to.not.include(4); - * - * However, it's dangerous to negate `.include` when the target is an object. - * The problem is that it creates uncertain expectations by asserting that the - * target object doesn't have all of `val`'s key/value pairs but may or may - * not have some of them. It's often best to identify the exact output that's - * expected, and then write an assertion that only accepts that exact output. - * - * When the target object isn't even expected to have `val`'s keys, it's - * often best to assert exactly that. - * - * expect({c: 3}).to.not.have.any.keys('a', 'b'); // Recommended - * expect({c: 3}).to.not.include({a: 1, b: 2}); // Not recommended - * - * When the target object is expected to have `val`'s keys, it's often best to - * assert that each of the properties has its expected value, rather than - * asserting that each property doesn't have one of many unexpected values. - * - * expect({a: 3, b: 4}).to.include({a: 3, b: 4}); // Recommended - * expect({a: 3, b: 4}).to.not.include({a: 1, b: 2}); // Not recommended - * - * `.include` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect([1, 2, 3]).to.include(4, 'nooo why fail??'); - * expect([1, 2, 3], 'nooo why fail??').to.include(4); - * - * `.include` can also be used as a language chain, causing all `.members` and - * `.keys` assertions that follow in the chain to require the target to be a - * superset of the expected set, rather than an identical set. Note that - * `.members` ignores duplicates in the subset when `.include` is added. - * - * // Target object's keys are a superset of ['a', 'b'] but not identical - * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b'); - * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b'); - * - * // Target array is a superset of [1, 2] but not identical - * expect([1, 2, 3]).to.include.members([1, 2]); - * expect([1, 2, 3]).to.not.have.members([1, 2]); - * - * // Duplicates in the subset are ignored - * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]); - * - * Note that adding `.any` earlier in the chain causes the `.keys` assertion - * to ignore `.include`. - * - * // Both assertions are identical - * expect({a: 1}).to.include.any.keys('a', 'b'); - * expect({a: 1}).to.have.any.keys('a', 'b'); - * - * The aliases `.includes`, `.contain`, and `.contains` can be used - * interchangeably with `.include`. - * - * @name include - * @alias contain - * @alias includes - * @alias contains - * @param {Mixed} val - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function SameValueZero(a, b) { - return (_.isNaN(a) && _.isNaN(b)) || a === b; - } +function SameValueZero(a, b) { + return (_.isNaN(a) && _.isNaN(b)) || a === b; +} - function includeChainingBehavior () { - flag(this, 'contains', true); - } +function includeChainingBehavior () { + flag(this, 'contains', true); +} - function include (val, msg) { - if (msg) flag(this, 'message', msg); +function include (val, msg) { + if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , objType = _.type(obj).toLowerCase() - , flagMsg = flag(this, 'message') - , negate = flag(this, 'negate') - , ssfi = flag(this, 'ssfi') - , isDeep = flag(this, 'deep') - , descriptor = isDeep ? 'deep ' : ''; + var obj = flag(this, 'object') + , objType = _.type(obj).toLowerCase() + , flagMsg = flag(this, 'message') + , negate = flag(this, 'negate') + , ssfi = flag(this, 'ssfi') + , isDeep = flag(this, 'deep') + , descriptor = isDeep ? 'deep ' : ''; - flagMsg = flagMsg ? flagMsg + ': ' : ''; + flagMsg = flagMsg ? flagMsg + ': ' : ''; - var included = false; + var included = false; - switch (objType) { - case 'string': - included = obj.indexOf(val) !== -1; - break; + switch (objType) { + case 'string': + included = obj.indexOf(val) !== -1; + break; - case 'weakset': - if (isDeep) { - throw new AssertionError( - flagMsg + 'unable to use .deep.include with WeakSet', - undefined, - ssfi - ); - } + case 'weakset': + if (isDeep) { + throw new AssertionError( + flagMsg + 'unable to use .deep.include with WeakSet', + undefined, + ssfi + ); + } - included = obj.has(val); - break; + included = obj.has(val); + break; + + case 'map': + var isEql = isDeep ? _.eql : SameValueZero; + obj.forEach(function (item) { + included = included || isEql(item, val); + }); + break; - case 'map': - var isEql = isDeep ? _.eql : SameValueZero; + case 'set': + if (isDeep) { obj.forEach(function (item) { - included = included || isEql(item, val); + included = included || _.eql(item, val); }); - break; - - case 'set': - if (isDeep) { - obj.forEach(function (item) { - included = included || _.eql(item, val); - }); - } else { - included = obj.has(val); - } - break; + } else { + included = obj.has(val); + } + break; - case 'array': - if (isDeep) { - included = obj.some(function (item) { - return _.eql(item, val); - }) - } else { - included = obj.indexOf(val) !== -1; - } - break; + case 'array': + if (isDeep) { + included = obj.some(function (item) { + return _.eql(item, val); + }) + } else { + included = obj.indexOf(val) !== -1; + } + break; - default: - // This block is for asserting a subset of properties in an object. - // `_.expectTypes` isn't used here because `.include` should work with - // objects with a custom `@@toStringTag`. - if (val !== Object(val)) { - throw new AssertionError( - flagMsg + 'the given combination of arguments (' - + objType + ' and ' - + _.type(val).toLowerCase() + ')' - + ' is invalid for this assertion. ' - + 'You can use an array, a map, an object, a set, a string, ' - + 'or a weakset instead of a ' - + _.type(val).toLowerCase(), - undefined, - ssfi - ); - } + default: + // This block is for asserting a subset of properties in an object. + // `_.expectTypes` isn't used here because `.include` should work with + // objects with a custom `@@toStringTag`. + if (val !== Object(val)) { + throw new AssertionError( + flagMsg + 'the given combination of arguments (' + + objType + ' and ' + + _.type(val).toLowerCase() + ')' + + ' is invalid for this assertion. ' + + 'You can use an array, a map, an object, a set, a string, ' + + 'or a weakset instead of a ' + + _.type(val).toLowerCase(), + undefined, + ssfi + ); + } - var props = Object.keys(val) - , firstErr = null - , numErrs = 0; + var props = Object.keys(val) + , firstErr = null + , numErrs = 0; - props.forEach(function (prop) { - var propAssertion = new Assertion(obj); - _.transferFlags(this, propAssertion, true); - flag(propAssertion, 'lockSsfi', true); + props.forEach(function (prop) { + var propAssertion = new Assertion(obj); + _.transferFlags(this, propAssertion, true); + flag(propAssertion, 'lockSsfi', true); - if (!negate || props.length === 1) { - propAssertion.property(prop, val[prop]); - return; - } + if (!negate || props.length === 1) { + propAssertion.property(prop, val[prop]); + return; + } - try { - propAssertion.property(prop, val[prop]); - } catch (err) { - if (!_.checkError.compatibleConstructor(err, AssertionError)) { - throw err; - } - if (firstErr === null) firstErr = err; - numErrs++; + try { + propAssertion.property(prop, val[prop]); + } catch (err) { + if (!_.checkError.compatibleConstructor(err, AssertionError)) { + throw err; } - }, this); - - // When validating .not.include with multiple properties, we only want - // to throw an assertion error if all of the properties are included, - // in which case we throw the first property assertion error that we - // encountered. - if (negate && props.length > 1 && numErrs === props.length) { - throw firstErr; + if (firstErr === null) firstErr = err; + numErrs++; } - return; - } - - // Assert inclusion in collection or substring in a string. - this.assert( - included - , 'expected #{this} to ' + descriptor + 'include ' + _.inspect(val) - , 'expected #{this} to not ' + descriptor + 'include ' + _.inspect(val)); + }, this); + + // When validating .not.include with multiple properties, we only want + // to throw an assertion error if all of the properties are included, + // in which case we throw the first property assertion error that we + // encountered. + if (negate && props.length > 1 && numErrs === props.length) { + throw firstErr; + } + return; } - Assertion.addChainableMethod('include', include, includeChainingBehavior); - Assertion.addChainableMethod('contain', include, includeChainingBehavior); - Assertion.addChainableMethod('contains', include, includeChainingBehavior); - Assertion.addChainableMethod('includes', include, includeChainingBehavior); - - /** - * ### .ok - * - * Asserts that the target is a truthy value (considered `true` in boolean context). - * However, it's often best to assert that the target is strictly (`===`) or - * deeply equal to its expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.ok; // Not recommended - * - * expect(true).to.be.true; // Recommended - * expect(true).to.be.ok; // Not recommended - * - * Add `.not` earlier in the chain to negate `.ok`. - * - * expect(0).to.equal(0); // Recommended - * expect(0).to.not.be.ok; // Not recommended - * - * expect(false).to.be.false; // Recommended - * expect(false).to.not.be.ok; // Not recommended - * - * expect(null).to.be.null; // Recommended - * expect(null).to.not.be.ok; // Not recommended - * - * expect(undefined).to.be.undefined; // Recommended - * expect(undefined).to.not.be.ok; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(false, 'nooo why fail??').to.be.ok; - * - * @name ok - * @namespace BDD - * @api public - */ - - Assertion.addProperty('ok', function () { - this.assert( - flag(this, 'object') - , 'expected #{this} to be truthy' - , 'expected #{this} to be falsy'); - }); - - /** - * ### .true - * - * Asserts that the target is strictly (`===`) equal to `true`. - * - * expect(true).to.be.true; - * - * Add `.not` earlier in the chain to negate `.true`. However, it's often best - * to assert that the target is equal to its expected value, rather than not - * equal to `true`. - * - * expect(false).to.be.false; // Recommended - * expect(false).to.not.be.true; // Not recommended - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.true; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(false, 'nooo why fail??').to.be.true; - * - * @name true - * @namespace BDD - * @api public - */ - - Assertion.addProperty('true', function () { - this.assert( - true === flag(this, 'object') - , 'expected #{this} to be true' - , 'expected #{this} to be false' - , flag(this, 'negate') ? false : true - ); - }); + // Assert inclusion in collection or substring in a string. + this.assert( + included + , 'expected #{this} to ' + descriptor + 'include ' + _.inspect(val) + , 'expected #{this} to not ' + descriptor + 'include ' + _.inspect(val)); +} + +Assertion.addChainableMethod('include', include, includeChainingBehavior); +Assertion.addChainableMethod('contain', include, includeChainingBehavior); +Assertion.addChainableMethod('contains', include, includeChainingBehavior); +Assertion.addChainableMethod('includes', include, includeChainingBehavior); + +/** + * ### .ok + * + * Asserts that the target is a truthy value (considered `true` in boolean context). + * However, it's often best to assert that the target is strictly (`===`) or + * deeply equal to its expected value. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.be.ok; // Not recommended + * + * expect(true).to.be.true; // Recommended + * expect(true).to.be.ok; // Not recommended + * + * Add `.not` earlier in the chain to negate `.ok`. + * + * expect(0).to.equal(0); // Recommended + * expect(0).to.not.be.ok; // Not recommended + * + * expect(false).to.be.false; // Recommended + * expect(false).to.not.be.ok; // Not recommended + * + * expect(null).to.be.null; // Recommended + * expect(null).to.not.be.ok; // Not recommended + * + * expect(undefined).to.be.undefined; // Recommended + * expect(undefined).to.not.be.ok; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(false, 'nooo why fail??').to.be.ok; + * + * @name ok + * @namespace BDD + * @api public + */ - /** - * ### .false - * - * Asserts that the target is strictly (`===`) equal to `false`. - * - * expect(false).to.be.false; - * - * Add `.not` earlier in the chain to negate `.false`. However, it's often - * best to assert that the target is equal to its expected value, rather than - * not equal to `false`. - * - * expect(true).to.be.true; // Recommended - * expect(true).to.not.be.false; // Not recommended - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.false; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(true, 'nooo why fail??').to.be.false; - * - * @name false - * @namespace BDD - * @api public - */ - - Assertion.addProperty('false', function () { - this.assert( - false === flag(this, 'object') - , 'expected #{this} to be false' - , 'expected #{this} to be true' - , flag(this, 'negate') ? true : false - ); - }); +Assertion.addProperty('ok', function () { + this.assert( + flag(this, 'object') + , 'expected #{this} to be truthy' + , 'expected #{this} to be falsy'); +}); + +/** + * ### .true + * + * Asserts that the target is strictly (`===`) equal to `true`. + * + * expect(true).to.be.true; + * + * Add `.not` earlier in the chain to negate `.true`. However, it's often best + * to assert that the target is equal to its expected value, rather than not + * equal to `true`. + * + * expect(false).to.be.false; // Recommended + * expect(false).to.not.be.true; // Not recommended + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.true; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(false, 'nooo why fail??').to.be.true; + * + * @name true + * @namespace BDD + * @api public + */ - /** - * ### .null - * - * Asserts that the target is strictly (`===`) equal to `null`. - * - * expect(null).to.be.null; - * - * Add `.not` earlier in the chain to negate `.null`. However, it's often best - * to assert that the target is equal to its expected value, rather than not - * equal to `null`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.null; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(42, 'nooo why fail??').to.be.null; - * - * @name null - * @namespace BDD - * @api public - */ - - Assertion.addProperty('null', function () { - this.assert( - null === flag(this, 'object') - , 'expected #{this} to be null' - , 'expected #{this} not to be null' - ); - }); +Assertion.addProperty('true', function () { + this.assert( + true === flag(this, 'object') + , 'expected #{this} to be true' + , 'expected #{this} to be false' + , flag(this, 'negate') ? false : true + ); +}); + +/** + * ### .false + * + * Asserts that the target is strictly (`===`) equal to `false`. + * + * expect(false).to.be.false; + * + * Add `.not` earlier in the chain to negate `.false`. However, it's often + * best to assert that the target is equal to its expected value, rather than + * not equal to `false`. + * + * expect(true).to.be.true; // Recommended + * expect(true).to.not.be.false; // Not recommended + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.false; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(true, 'nooo why fail??').to.be.false; + * + * @name false + * @namespace BDD + * @api public + */ - /** - * ### .undefined - * - * Asserts that the target is strictly (`===`) equal to `undefined`. - * - * expect(undefined).to.be.undefined; - * - * Add `.not` earlier in the chain to negate `.undefined`. However, it's often - * best to assert that the target is equal to its expected value, rather than - * not equal to `undefined`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.undefined; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(42, 'nooo why fail??').to.be.undefined; - * - * @name undefined - * @namespace BDD - * @api public - */ - - Assertion.addProperty('undefined', function () { - this.assert( - undefined === flag(this, 'object') - , 'expected #{this} to be undefined' - , 'expected #{this} not to be undefined' - ); - }); +Assertion.addProperty('false', function () { + this.assert( + false === flag(this, 'object') + , 'expected #{this} to be false' + , 'expected #{this} to be true' + , flag(this, 'negate') ? true : false + ); +}); + +/** + * ### .null + * + * Asserts that the target is strictly (`===`) equal to `null`. + * + * expect(null).to.be.null; + * + * Add `.not` earlier in the chain to negate `.null`. However, it's often best + * to assert that the target is equal to its expected value, rather than not + * equal to `null`. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.null; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(42, 'nooo why fail??').to.be.null; + * + * @name null + * @namespace BDD + * @api public + */ - /** - * ### .NaN - * - * Asserts that the target is exactly `NaN`. - * - * expect(NaN).to.be.NaN; - * - * Add `.not` earlier in the chain to negate `.NaN`. However, it's often best - * to assert that the target is equal to its expected value, rather than not - * equal to `NaN`. - * - * expect('foo').to.equal('foo'); // Recommended - * expect('foo').to.not.be.NaN; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(42, 'nooo why fail??').to.be.NaN; - * - * @name NaN - * @namespace BDD - * @api public - */ - - Assertion.addProperty('NaN', function () { - this.assert( - _.isNaN(flag(this, 'object')) - , 'expected #{this} to be NaN' - , 'expected #{this} not to be NaN' - ); - }); +Assertion.addProperty('null', function () { + this.assert( + null === flag(this, 'object') + , 'expected #{this} to be null' + , 'expected #{this} not to be null' + ); +}); + +/** + * ### .undefined + * + * Asserts that the target is strictly (`===`) equal to `undefined`. + * + * expect(undefined).to.be.undefined; + * + * Add `.not` earlier in the chain to negate `.undefined`. However, it's often + * best to assert that the target is equal to its expected value, rather than + * not equal to `undefined`. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.undefined; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(42, 'nooo why fail??').to.be.undefined; + * + * @name undefined + * @namespace BDD + * @api public + */ - /** - * ### .exist - * - * Asserts that the target is not strictly (`===`) equal to either `null` or - * `undefined`. However, it's often best to assert that the target is equal to - * its expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.exist; // Not recommended - * - * expect(0).to.equal(0); // Recommended - * expect(0).to.exist; // Not recommended - * - * Add `.not` earlier in the chain to negate `.exist`. - * - * expect(null).to.be.null; // Recommended - * expect(null).to.not.exist; // Not recommended - * - * expect(undefined).to.be.undefined; // Recommended - * expect(undefined).to.not.exist; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(null, 'nooo why fail??').to.exist; - * - * The alias `.exists` can be used interchangeably with `.exist`. - * - * @name exist - * @alias exists - * @namespace BDD - * @api public - */ - - function assertExist () { - var val = flag(this, 'object'); - this.assert( - val !== null && val !== undefined - , 'expected #{this} to exist' - , 'expected #{this} to not exist' - ); - } +Assertion.addProperty('undefined', function () { + this.assert( + undefined === flag(this, 'object') + , 'expected #{this} to be undefined' + , 'expected #{this} not to be undefined' + ); +}); + +/** + * ### .NaN + * + * Asserts that the target is exactly `NaN`. + * + * expect(NaN).to.be.NaN; + * + * Add `.not` earlier in the chain to negate `.NaN`. However, it's often best + * to assert that the target is equal to its expected value, rather than not + * equal to `NaN`. + * + * expect('foo').to.equal('foo'); // Recommended + * expect('foo').to.not.be.NaN; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(42, 'nooo why fail??').to.be.NaN; + * + * @name NaN + * @namespace BDD + * @api public + */ - Assertion.addProperty('exist', assertExist); - Assertion.addProperty('exists', assertExist); - - /** - * ### .empty - * - * When the target is a string or array, `.empty` asserts that the target's - * `length` property is strictly (`===`) equal to `0`. - * - * expect([]).to.be.empty; - * expect('').to.be.empty; - * - * When the target is a map or set, `.empty` asserts that the target's `size` - * property is strictly equal to `0`. - * - * expect(new Set()).to.be.empty; - * expect(new Map()).to.be.empty; - * - * When the target is a non-function object, `.empty` asserts that the target - * doesn't have any own enumerable properties. Properties with Symbol-based - * keys are excluded from the count. - * - * expect({}).to.be.empty; - * - * Because `.empty` does different things based on the target's type, it's - * important to check the target's type before using `.empty`. See the `.a` - * doc for info on testing a target's type. - * - * expect([]).to.be.an('array').that.is.empty; - * - * Add `.not` earlier in the chain to negate `.empty`. However, it's often - * best to assert that the target contains its expected number of values, - * rather than asserting that it's not empty. - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.not.be.empty; // Not recommended - * - * expect(new Set([1, 2, 3])).to.have.property('size', 3); // Recommended - * expect(new Set([1, 2, 3])).to.not.be.empty; // Not recommended - * - * expect(Object.keys({a: 1})).to.have.lengthOf(1); // Recommended - * expect({a: 1}).to.not.be.empty; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect([1, 2, 3], 'nooo why fail??').to.be.empty; - * - * @name empty - * @namespace BDD - * @api public - */ - - Assertion.addProperty('empty', function () { - var val = flag(this, 'object') - , ssfi = flag(this, 'ssfi') - , flagMsg = flag(this, 'message') - , itemsCount; +Assertion.addProperty('NaN', function () { + this.assert( + _.isNaN(flag(this, 'object')) + , 'expected #{this} to be NaN' + , 'expected #{this} not to be NaN' + ); +}); + +/** + * ### .exist + * + * Asserts that the target is not strictly (`===`) equal to either `null` or + * `undefined`. However, it's often best to assert that the target is equal to + * its expected value. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.exist; // Not recommended + * + * expect(0).to.equal(0); // Recommended + * expect(0).to.exist; // Not recommended + * + * Add `.not` earlier in the chain to negate `.exist`. + * + * expect(null).to.be.null; // Recommended + * expect(null).to.not.exist; // Not recommended + * + * expect(undefined).to.be.undefined; // Recommended + * expect(undefined).to.not.exist; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(null, 'nooo why fail??').to.exist; + * + * The alias `.exists` can be used interchangeably with `.exist`. + * + * @name exist + * @alias exists + * @namespace BDD + * @api public + */ - flagMsg = flagMsg ? flagMsg + ': ' : ''; +function assertExist () { + var val = flag(this, 'object'); + this.assert( + val !== null && val !== undefined + , 'expected #{this} to exist' + , 'expected #{this} to not exist' + ); +} + +Assertion.addProperty('exist', assertExist); +Assertion.addProperty('exists', assertExist); + +/** + * ### .empty + * + * When the target is a string or array, `.empty` asserts that the target's + * `length` property is strictly (`===`) equal to `0`. + * + * expect([]).to.be.empty; + * expect('').to.be.empty; + * + * When the target is a map or set, `.empty` asserts that the target's `size` + * property is strictly equal to `0`. + * + * expect(new Set()).to.be.empty; + * expect(new Map()).to.be.empty; + * + * When the target is a non-function object, `.empty` asserts that the target + * doesn't have any own enumerable properties. Properties with Symbol-based + * keys are excluded from the count. + * + * expect({}).to.be.empty; + * + * Because `.empty` does different things based on the target's type, it's + * important to check the target's type before using `.empty`. See the `.a` + * doc for info on testing a target's type. + * + * expect([]).to.be.an('array').that.is.empty; + * + * Add `.not` earlier in the chain to negate `.empty`. However, it's often + * best to assert that the target contains its expected number of values, + * rather than asserting that it's not empty. + * + * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended + * expect([1, 2, 3]).to.not.be.empty; // Not recommended + * + * expect(new Set([1, 2, 3])).to.have.property('size', 3); // Recommended + * expect(new Set([1, 2, 3])).to.not.be.empty; // Not recommended + * + * expect(Object.keys({a: 1})).to.have.lengthOf(1); // Recommended + * expect({a: 1}).to.not.be.empty; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect([1, 2, 3], 'nooo why fail??').to.be.empty; + * + * @name empty + * @namespace BDD + * @api public + */ - switch (_.type(val).toLowerCase()) { - case 'array': - case 'string': - itemsCount = val.length; - break; - case 'map': - case 'set': - itemsCount = val.size; - break; - case 'weakmap': - case 'weakset': +Assertion.addProperty('empty', function () { + var val = flag(this, 'object') + , ssfi = flag(this, 'ssfi') + , flagMsg = flag(this, 'message') + , itemsCount; + + flagMsg = flagMsg ? flagMsg + ': ' : ''; + + switch (_.type(val).toLowerCase()) { + case 'array': + case 'string': + itemsCount = val.length; + break; + case 'map': + case 'set': + itemsCount = val.size; + break; + case 'weakmap': + case 'weakset': + throw new AssertionError( + flagMsg + '.empty was passed a weak collection', + undefined, + ssfi + ); + case 'function': + var msg = flagMsg + '.empty was passed a function ' + _.getName(val); + throw new AssertionError(msg.trim(), undefined, ssfi); + default: + if (val !== Object(val)) { throw new AssertionError( - flagMsg + '.empty was passed a weak collection', + flagMsg + '.empty was passed non-string primitive ' + _.inspect(val), undefined, ssfi ); - case 'function': - var msg = flagMsg + '.empty was passed a function ' + _.getName(val); - throw new AssertionError(msg.trim(), undefined, ssfi); - default: - if (val !== Object(val)) { - throw new AssertionError( - flagMsg + '.empty was passed non-string primitive ' + _.inspect(val), - undefined, - ssfi - ); - } - itemsCount = Object.keys(val).length; - } - - this.assert( - 0 === itemsCount - , 'expected #{this} to be empty' - , 'expected #{this} not to be empty' - ); - }); - - /** - * ### .arguments - * - * Asserts that the target is an `arguments` object. - * - * function test () { - * expect(arguments).to.be.arguments; - * } - * - * test(); - * - * Add `.not` earlier in the chain to negate `.arguments`. However, it's often - * best to assert which type the target is expected to be, rather than - * asserting that it’s not an `arguments` object. - * - * expect('foo').to.be.a('string'); // Recommended - * expect('foo').to.not.be.arguments; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({}, 'nooo why fail??').to.be.arguments; - * - * The alias `.Arguments` can be used interchangeably with `.arguments`. - * - * @name arguments - * @alias Arguments - * @namespace BDD - * @api public - */ - - function checkArguments () { - var obj = flag(this, 'object') - , type = _.type(obj); - this.assert( - 'Arguments' === type - , 'expected #{this} to be arguments but got ' + type - , 'expected #{this} to not be arguments' - ); + } + itemsCount = Object.keys(val).length; } - Assertion.addProperty('arguments', checkArguments); - Assertion.addProperty('Arguments', checkArguments); - - /** - * ### .equal(val[, msg]) - * - * Asserts that the target is strictly (`===`) equal to the given `val`. - * - * expect(1).to.equal(1); - * expect('foo').to.equal('foo'); - * - * Add `.deep` earlier in the chain to use deep equality instead. See the - * `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target object deeply (but not strictly) equals `{a: 1}` - * expect({a: 1}).to.deep.equal({a: 1}); - * expect({a: 1}).to.not.equal({a: 1}); - * - * // Target array deeply (but not strictly) equals `[1, 2]` - * expect([1, 2]).to.deep.equal([1, 2]); - * expect([1, 2]).to.not.equal([1, 2]); - * - * Add `.not` earlier in the chain to negate `.equal`. However, it's often - * best to assert that the target is equal to its expected value, rather than - * not equal to one of countless unexpected values. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.equal(2); // Not recommended - * - * `.equal` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.equal(2, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.equal(2); - * - * The aliases `.equals` and `eq` can be used interchangeably with `.equal`. - * - * @name equal - * @alias equals - * @alias eq - * @param {Mixed} val - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertEqual (val, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - if (flag(this, 'deep')) { - var prevLockSsfi = flag(this, 'lockSsfi'); - flag(this, 'lockSsfi', true); - this.eql(val); - flag(this, 'lockSsfi', prevLockSsfi); - } else { - this.assert( - val === obj - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{exp}' - , val - , this._obj - , true - ); - } - } + this.assert( + 0 === itemsCount + , 'expected #{this} to be empty' + , 'expected #{this} not to be empty' + ); +}); + +/** + * ### .arguments + * + * Asserts that the target is an `arguments` object. + * + * function test () { + * expect(arguments).to.be.arguments; + * } + * + * test(); + * + * Add `.not` earlier in the chain to negate `.arguments`. However, it's often + * best to assert which type the target is expected to be, rather than + * asserting that it’s not an `arguments` object. + * + * expect('foo').to.be.a('string'); // Recommended + * expect('foo').to.not.be.arguments; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect({}, 'nooo why fail??').to.be.arguments; + * + * The alias `.Arguments` can be used interchangeably with `.arguments`. + * + * @name arguments + * @alias Arguments + * @namespace BDD + * @api public + */ - Assertion.addMethod('equal', assertEqual); - Assertion.addMethod('equals', assertEqual); - Assertion.addMethod('eq', assertEqual); - - /** - * ### .eql(obj[, msg]) - * - * Asserts that the target is deeply equal to the given `obj`. See the - * `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target object is deeply (but not strictly) equal to {a: 1} - * expect({a: 1}).to.eql({a: 1}).but.not.equal({a: 1}); - * - * // Target array is deeply (but not strictly) equal to [1, 2] - * expect([1, 2]).to.eql([1, 2]).but.not.equal([1, 2]); - * - * Add `.not` earlier in the chain to negate `.eql`. However, it's often best - * to assert that the target is deeply equal to its expected value, rather - * than not deeply equal to one of countless unexpected values. - * - * expect({a: 1}).to.eql({a: 1}); // Recommended - * expect({a: 1}).to.not.eql({b: 2}); // Not recommended - * - * `.eql` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect({a: 1}).to.eql({b: 2}, 'nooo why fail??'); - * expect({a: 1}, 'nooo why fail??').to.eql({b: 2}); - * - * The alias `.eqls` can be used interchangeably with `.eql`. - * - * The `.deep.equal` assertion is almost identical to `.eql` but with one - * difference: `.deep.equal` causes deep equality comparisons to also be used - * for any other assertions that follow in the chain. - * - * @name eql - * @alias eqls - * @param {Mixed} obj - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertEql(obj, msg) { - if (msg) flag(this, 'message', msg); +function checkArguments () { + var obj = flag(this, 'object') + , type = _.type(obj); + this.assert( + 'Arguments' === type + , 'expected #{this} to be arguments but got ' + type + , 'expected #{this} to not be arguments' + ); +} + +Assertion.addProperty('arguments', checkArguments); +Assertion.addProperty('Arguments', checkArguments); + +/** + * ### .equal(val[, msg]) + * + * Asserts that the target is strictly (`===`) equal to the given `val`. + * + * expect(1).to.equal(1); + * expect('foo').to.equal('foo'); + * + * Add `.deep` earlier in the chain to use deep equality instead. See the + * `deep-eql` project page for info on the deep equality algorithm: + * https://github.com/chaijs/deep-eql. + * + * // Target object deeply (but not strictly) equals `{a: 1}` + * expect({a: 1}).to.deep.equal({a: 1}); + * expect({a: 1}).to.not.equal({a: 1}); + * + * // Target array deeply (but not strictly) equals `[1, 2]` + * expect([1, 2]).to.deep.equal([1, 2]); + * expect([1, 2]).to.not.equal([1, 2]); + * + * Add `.not` earlier in the chain to negate `.equal`. However, it's often + * best to assert that the target is equal to its expected value, rather than + * not equal to one of countless unexpected values. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.equal(2); // Not recommended + * + * `.equal` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect(1).to.equal(2, 'nooo why fail??'); + * expect(1, 'nooo why fail??').to.equal(2); + * + * The aliases `.equals` and `eq` can be used interchangeably with `.equal`. + * + * @name equal + * @alias equals + * @alias eq + * @param {Mixed} val + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ + +function assertEqual (val, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object'); + if (flag(this, 'deep')) { + var prevLockSsfi = flag(this, 'lockSsfi'); + flag(this, 'lockSsfi', true); + this.eql(val); + flag(this, 'lockSsfi', prevLockSsfi); + } else { this.assert( - _.eql(obj, flag(this, 'object')) - , 'expected #{this} to deeply equal #{exp}' - , 'expected #{this} to not deeply equal #{exp}' - , obj + val === obj + , 'expected #{this} to equal #{exp}' + , 'expected #{this} to not equal #{exp}' + , val , this._obj , true ); } +} + +Assertion.addMethod('equal', assertEqual); +Assertion.addMethod('equals', assertEqual); +Assertion.addMethod('eq', assertEqual); + +/** + * ### .eql(obj[, msg]) + * + * Asserts that the target is deeply equal to the given `obj`. See the + * `deep-eql` project page for info on the deep equality algorithm: + * https://github.com/chaijs/deep-eql. + * + * // Target object is deeply (but not strictly) equal to {a: 1} + * expect({a: 1}).to.eql({a: 1}).but.not.equal({a: 1}); + * + * // Target array is deeply (but not strictly) equal to [1, 2] + * expect([1, 2]).to.eql([1, 2]).but.not.equal([1, 2]); + * + * Add `.not` earlier in the chain to negate `.eql`. However, it's often best + * to assert that the target is deeply equal to its expected value, rather + * than not deeply equal to one of countless unexpected values. + * + * expect({a: 1}).to.eql({a: 1}); // Recommended + * expect({a: 1}).to.not.eql({b: 2}); // Not recommended + * + * `.eql` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect({a: 1}).to.eql({b: 2}, 'nooo why fail??'); + * expect({a: 1}, 'nooo why fail??').to.eql({b: 2}); + * + * The alias `.eqls` can be used interchangeably with `.eql`. + * + * The `.deep.equal` assertion is almost identical to `.eql` but with one + * difference: `.deep.equal` causes deep equality comparisons to also be used + * for any other assertions that follow in the chain. + * + * @name eql + * @alias eqls + * @param {Mixed} obj + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - Assertion.addMethod('eql', assertEql); - Assertion.addMethod('eqls', assertEql); - - /** - * ### .above(n[, msg]) - * - * Asserts that the target is a number or a date greater than the given number or date `n` respectively. - * However, it's often best to assert that the target is equal to its expected - * value. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.be.above(1); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is greater than the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.above(2); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.above(2); // Not recommended - * - * Add `.not` earlier in the chain to negate `.above`. - * - * expect(2).to.equal(2); // Recommended - * expect(1).to.not.be.above(2); // Not recommended - * - * `.above` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.be.above(2, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.above(2); - * - * The aliases `.gt` and `.greaterThan` can be used interchangeably with - * `.above`. - * - * @name above - * @alias gt - * @alias greaterThan - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertAbove (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } - - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to above must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to above must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; - } else { - shouldThrow = false; - } +function assertEql(obj, msg) { + if (msg) flag(this, 'message', msg); + this.assert( + _.eql(obj, flag(this, 'object')) + , 'expected #{this} to deeply equal #{exp}' + , 'expected #{this} to not deeply equal #{exp}' + , obj + , this._obj + , true + ); +} + +Assertion.addMethod('eql', assertEql); +Assertion.addMethod('eqls', assertEql); + +/** + * ### .above(n[, msg]) + * + * Asserts that the target is a number or a date greater than the given number or date `n` respectively. + * However, it's often best to assert that the target is equal to its expected + * value. + * + * expect(2).to.equal(2); // Recommended + * expect(2).to.be.above(1); // Not recommended + * + * Add `.lengthOf` earlier in the chain to assert that the target's `length` + * or `size` is greater than the given number `n`. + * + * expect('foo').to.have.lengthOf(3); // Recommended + * expect('foo').to.have.lengthOf.above(2); // Not recommended + * + * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended + * expect([1, 2, 3]).to.have.lengthOf.above(2); // Not recommended + * + * Add `.not` earlier in the chain to negate `.above`. + * + * expect(2).to.equal(2); // Recommended + * expect(1).to.not.be.above(2); // Not recommended + * + * `.above` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect(1).to.be.above(2, 'nooo why fail??'); + * expect(1, 'nooo why fail??').to.be.above(2); + * + * The aliases `.gt` and `.greaterThan` can be used interchangeably with + * `.above`. + * + * @name above + * @alias gt + * @alias greaterThan + * @param {Number} n + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } +function assertAbove (n, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , doLength = flag(this, 'doLength') + , flagMsg = flag(this, 'message') + , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') + , ssfi = flag(this, 'ssfi') + , objType = _.type(obj).toLowerCase() + , nType = _.type(n).toLowerCase() + , errorMessage + , shouldThrow = true; + + if (doLength && objType !== 'map' && objType !== 'set') { + new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); + } - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount > n - , 'expected #{this} to have a ' + descriptor + ' above #{exp} but got #{act}' - , 'expected #{this} to not have a ' + descriptor + ' above #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj > n - , 'expected #{this} to be above #{exp}' - , 'expected #{this} to be at most #{exp}' - , n - ); - } + if (!doLength && (objType === 'date' && nType !== 'date')) { + errorMessage = msgPrefix + 'the argument to above must be a date'; + } else if (nType !== 'number' && (doLength || objType === 'number')) { + errorMessage = msgPrefix + 'the argument to above must be a number'; + } else if (!doLength && (objType !== 'date' && objType !== 'number')) { + var printObj = (objType === 'string') ? "'" + obj + "'" : obj; + errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + } else { + shouldThrow = false; } - Assertion.addMethod('above', assertAbove); - Assertion.addMethod('gt', assertAbove); - Assertion.addMethod('greaterThan', assertAbove); - - /** - * ### .least(n[, msg]) - * - * Asserts that the target is a number or a date greater than or equal to the given - * number or date `n` respectively. However, it's often best to assert that the target is equal to - * its expected value. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.be.at.least(1); // Not recommended - * expect(2).to.be.at.least(2); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is greater than or equal to the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.at.least(2); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.at.least(2); // Not recommended - * - * Add `.not` earlier in the chain to negate `.least`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.at.least(2); // Not recommended - * - * `.least` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.be.at.least(2, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.at.least(2); - * - * The aliases `.gte` and `.greaterThanOrEqual` can be used interchangeably with - * `.least`. - * - * @name least - * @alias gte - * @alias greaterThanOrEqual - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertLeast (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } + if (shouldThrow) { + throw new AssertionError(errorMessage, undefined, ssfi); + } - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to least must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to least must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + if (doLength) { + var descriptor = 'length' + , itemsCount; + if (objType === 'map' || objType === 'set') { + descriptor = 'size'; + itemsCount = obj.size; } else { - shouldThrow = false; + itemsCount = obj.length; } + this.assert( + itemsCount > n + , 'expected #{this} to have a ' + descriptor + ' above #{exp} but got #{act}' + , 'expected #{this} to not have a ' + descriptor + ' above #{exp}' + , n + , itemsCount + ); + } else { + this.assert( + obj > n + , 'expected #{this} to be above #{exp}' + , 'expected #{this} to be at most #{exp}' + , n + ); + } +} + +Assertion.addMethod('above', assertAbove); +Assertion.addMethod('gt', assertAbove); +Assertion.addMethod('greaterThan', assertAbove); + +/** + * ### .least(n[, msg]) + * + * Asserts that the target is a number or a date greater than or equal to the given + * number or date `n` respectively. However, it's often best to assert that the target is equal to + * its expected value. + * + * expect(2).to.equal(2); // Recommended + * expect(2).to.be.at.least(1); // Not recommended + * expect(2).to.be.at.least(2); // Not recommended + * + * Add `.lengthOf` earlier in the chain to assert that the target's `length` + * or `size` is greater than or equal to the given number `n`. + * + * expect('foo').to.have.lengthOf(3); // Recommended + * expect('foo').to.have.lengthOf.at.least(2); // Not recommended + * + * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended + * expect([1, 2, 3]).to.have.lengthOf.at.least(2); // Not recommended + * + * Add `.not` earlier in the chain to negate `.least`. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.at.least(2); // Not recommended + * + * `.least` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect(1).to.be.at.least(2, 'nooo why fail??'); + * expect(1, 'nooo why fail??').to.be.at.least(2); + * + * The aliases `.gte` and `.greaterThanOrEqual` can be used interchangeably with + * `.least`. + * + * @name least + * @alias gte + * @alias greaterThanOrEqual + * @param {Number} n + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } +function assertLeast (n, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , doLength = flag(this, 'doLength') + , flagMsg = flag(this, 'message') + , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') + , ssfi = flag(this, 'ssfi') + , objType = _.type(obj).toLowerCase() + , nType = _.type(n).toLowerCase() + , errorMessage + , shouldThrow = true; + + if (doLength && objType !== 'map' && objType !== 'set') { + new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); + } - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount >= n - , 'expected #{this} to have a ' + descriptor + ' at least #{exp} but got #{act}' - , 'expected #{this} to have a ' + descriptor + ' below #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj >= n - , 'expected #{this} to be at least #{exp}' - , 'expected #{this} to be below #{exp}' - , n - ); - } + if (!doLength && (objType === 'date' && nType !== 'date')) { + errorMessage = msgPrefix + 'the argument to least must be a date'; + } else if (nType !== 'number' && (doLength || objType === 'number')) { + errorMessage = msgPrefix + 'the argument to least must be a number'; + } else if (!doLength && (objType !== 'date' && objType !== 'number')) { + var printObj = (objType === 'string') ? "'" + obj + "'" : obj; + errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + } else { + shouldThrow = false; } - Assertion.addMethod('least', assertLeast); - Assertion.addMethod('gte', assertLeast); - Assertion.addMethod('greaterThanOrEqual', assertLeast); - - /** - * ### .below(n[, msg]) - * - * Asserts that the target is a number or a date less than the given number or date `n` respectively. - * However, it's often best to assert that the target is equal to its expected - * value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.below(2); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is less than the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.below(4); // Not recommended - * - * expect([1, 2, 3]).to.have.length(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.below(4); // Not recommended - * - * Add `.not` earlier in the chain to negate `.below`. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.not.be.below(1); // Not recommended - * - * `.below` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(2).to.be.below(1, 'nooo why fail??'); - * expect(2, 'nooo why fail??').to.be.below(1); - * - * The aliases `.lt` and `.lessThan` can be used interchangeably with - * `.below`. - * - * @name below - * @alias lt - * @alias lessThan - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertBelow (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } + if (shouldThrow) { + throw new AssertionError(errorMessage, undefined, ssfi); + } - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to below must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to below must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + if (doLength) { + var descriptor = 'length' + , itemsCount; + if (objType === 'map' || objType === 'set') { + descriptor = 'size'; + itemsCount = obj.size; } else { - shouldThrow = false; + itemsCount = obj.length; } + this.assert( + itemsCount >= n + , 'expected #{this} to have a ' + descriptor + ' at least #{exp} but got #{act}' + , 'expected #{this} to have a ' + descriptor + ' below #{exp}' + , n + , itemsCount + ); + } else { + this.assert( + obj >= n + , 'expected #{this} to be at least #{exp}' + , 'expected #{this} to be below #{exp}' + , n + ); + } +} + +Assertion.addMethod('least', assertLeast); +Assertion.addMethod('gte', assertLeast); +Assertion.addMethod('greaterThanOrEqual', assertLeast); + +/** + * ### .below(n[, msg]) + * + * Asserts that the target is a number or a date less than the given number or date `n` respectively. + * However, it's often best to assert that the target is equal to its expected + * value. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.be.below(2); // Not recommended + * + * Add `.lengthOf` earlier in the chain to assert that the target's `length` + * or `size` is less than the given number `n`. + * + * expect('foo').to.have.lengthOf(3); // Recommended + * expect('foo').to.have.lengthOf.below(4); // Not recommended + * + * expect([1, 2, 3]).to.have.length(3); // Recommended + * expect([1, 2, 3]).to.have.lengthOf.below(4); // Not recommended + * + * Add `.not` earlier in the chain to negate `.below`. + * + * expect(2).to.equal(2); // Recommended + * expect(2).to.not.be.below(1); // Not recommended + * + * `.below` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect(2).to.be.below(1, 'nooo why fail??'); + * expect(2, 'nooo why fail??').to.be.below(1); + * + * The aliases `.lt` and `.lessThan` can be used interchangeably with + * `.below`. + * + * @name below + * @alias lt + * @alias lessThan + * @param {Number} n + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } +function assertBelow (n, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , doLength = flag(this, 'doLength') + , flagMsg = flag(this, 'message') + , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') + , ssfi = flag(this, 'ssfi') + , objType = _.type(obj).toLowerCase() + , nType = _.type(n).toLowerCase() + , errorMessage + , shouldThrow = true; + + if (doLength && objType !== 'map' && objType !== 'set') { + new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); + } - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount < n - , 'expected #{this} to have a ' + descriptor + ' below #{exp} but got #{act}' - , 'expected #{this} to not have a ' + descriptor + ' below #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj < n - , 'expected #{this} to be below #{exp}' - , 'expected #{this} to be at least #{exp}' - , n - ); - } + if (!doLength && (objType === 'date' && nType !== 'date')) { + errorMessage = msgPrefix + 'the argument to below must be a date'; + } else if (nType !== 'number' && (doLength || objType === 'number')) { + errorMessage = msgPrefix + 'the argument to below must be a number'; + } else if (!doLength && (objType !== 'date' && objType !== 'number')) { + var printObj = (objType === 'string') ? "'" + obj + "'" : obj; + errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + } else { + shouldThrow = false; } - Assertion.addMethod('below', assertBelow); - Assertion.addMethod('lt', assertBelow); - Assertion.addMethod('lessThan', assertBelow); - - /** - * ### .most(n[, msg]) - * - * Asserts that the target is a number or a date less than or equal to the given number - * or date `n` respectively. However, it's often best to assert that the target is equal to its - * expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.at.most(2); // Not recommended - * expect(1).to.be.at.most(1); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is less than or equal to the given number `n`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.at.most(4); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.at.most(4); // Not recommended - * - * Add `.not` earlier in the chain to negate `.most`. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.not.be.at.most(1); // Not recommended - * - * `.most` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(2).to.be.at.most(1, 'nooo why fail??'); - * expect(2, 'nooo why fail??').to.be.at.most(1); - * - * The aliases `.lte` and `.lessThanOrEqual` can be used interchangeably with - * `.most`. - * - * @name most - * @alias lte - * @alias lessThanOrEqual - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertMost (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , nType = _.type(n).toLowerCase() - , errorMessage - , shouldThrow = true; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } + if (shouldThrow) { + throw new AssertionError(errorMessage, undefined, ssfi); + } - if (!doLength && (objType === 'date' && nType !== 'date')) { - errorMessage = msgPrefix + 'the argument to most must be a date'; - } else if (nType !== 'number' && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the argument to most must be a number'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + if (doLength) { + var descriptor = 'length' + , itemsCount; + if (objType === 'map' || objType === 'set') { + descriptor = 'size'; + itemsCount = obj.size; } else { - shouldThrow = false; + itemsCount = obj.length; } + this.assert( + itemsCount < n + , 'expected #{this} to have a ' + descriptor + ' below #{exp} but got #{act}' + , 'expected #{this} to not have a ' + descriptor + ' below #{exp}' + , n + , itemsCount + ); + } else { + this.assert( + obj < n + , 'expected #{this} to be below #{exp}' + , 'expected #{this} to be at least #{exp}' + , n + ); + } +} + +Assertion.addMethod('below', assertBelow); +Assertion.addMethod('lt', assertBelow); +Assertion.addMethod('lessThan', assertBelow); + +/** + * ### .most(n[, msg]) + * + * Asserts that the target is a number or a date less than or equal to the given number + * or date `n` respectively. However, it's often best to assert that the target is equal to its + * expected value. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.be.at.most(2); // Not recommended + * expect(1).to.be.at.most(1); // Not recommended + * + * Add `.lengthOf` earlier in the chain to assert that the target's `length` + * or `size` is less than or equal to the given number `n`. + * + * expect('foo').to.have.lengthOf(3); // Recommended + * expect('foo').to.have.lengthOf.at.most(4); // Not recommended + * + * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended + * expect([1, 2, 3]).to.have.lengthOf.at.most(4); // Not recommended + * + * Add `.not` earlier in the chain to negate `.most`. + * + * expect(2).to.equal(2); // Recommended + * expect(2).to.not.be.at.most(1); // Not recommended + * + * `.most` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect(2).to.be.at.most(1, 'nooo why fail??'); + * expect(2, 'nooo why fail??').to.be.at.most(1); + * + * The aliases `.lte` and `.lessThanOrEqual` can be used interchangeably with + * `.most`. + * + * @name most + * @alias lte + * @alias lessThanOrEqual + * @param {Number} n + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } +function assertMost (n, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , doLength = flag(this, 'doLength') + , flagMsg = flag(this, 'message') + , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') + , ssfi = flag(this, 'ssfi') + , objType = _.type(obj).toLowerCase() + , nType = _.type(n).toLowerCase() + , errorMessage + , shouldThrow = true; + + if (doLength && objType !== 'map' && objType !== 'set') { + new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); + } - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount <= n - , 'expected #{this} to have a ' + descriptor + ' at most #{exp} but got #{act}' - , 'expected #{this} to have a ' + descriptor + ' above #{exp}' - , n - , itemsCount - ); - } else { - this.assert( - obj <= n - , 'expected #{this} to be at most #{exp}' - , 'expected #{this} to be above #{exp}' - , n - ); - } + if (!doLength && (objType === 'date' && nType !== 'date')) { + errorMessage = msgPrefix + 'the argument to most must be a date'; + } else if (nType !== 'number' && (doLength || objType === 'number')) { + errorMessage = msgPrefix + 'the argument to most must be a number'; + } else if (!doLength && (objType !== 'date' && objType !== 'number')) { + var printObj = (objType === 'string') ? "'" + obj + "'" : obj; + errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + } else { + shouldThrow = false; } - Assertion.addMethod('most', assertMost); - Assertion.addMethod('lte', assertMost); - Assertion.addMethod('lessThanOrEqual', assertMost); - - /** - * ### .within(start, finish[, msg]) - * - * Asserts that the target is a number or a date greater than or equal to the given - * number or date `start`, and less than or equal to the given number or date `finish` respectively. - * However, it's often best to assert that the target is equal to its expected - * value. - * - * expect(2).to.equal(2); // Recommended - * expect(2).to.be.within(1, 3); // Not recommended - * expect(2).to.be.within(2, 3); // Not recommended - * expect(2).to.be.within(1, 2); // Not recommended - * - * Add `.lengthOf` earlier in the chain to assert that the target's `length` - * or `size` is greater than or equal to the given number `start`, and less - * than or equal to the given number `finish`. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.have.lengthOf.within(2, 4); // Not recommended - * - * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended - * expect([1, 2, 3]).to.have.lengthOf.within(2, 4); // Not recommended - * - * Add `.not` earlier in the chain to negate `.within`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.within(2, 4); // Not recommended - * - * `.within` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(4).to.be.within(1, 3, 'nooo why fail??'); - * expect(4, 'nooo why fail??').to.be.within(1, 3); - * - * @name within - * @param {Number} start lower bound inclusive - * @param {Number} finish upper bound inclusive - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - Assertion.addMethod('within', function (start, finish, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , doLength = flag(this, 'doLength') - , flagMsg = flag(this, 'message') - , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') - , ssfi = flag(this, 'ssfi') - , objType = _.type(obj).toLowerCase() - , startType = _.type(start).toLowerCase() - , finishType = _.type(finish).toLowerCase() - , errorMessage - , shouldThrow = true - , range = (startType === 'date' && finishType === 'date') - ? start.toISOString() + '..' + finish.toISOString() - : start + '..' + finish; - - if (doLength && objType !== 'map' && objType !== 'set') { - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - } + if (shouldThrow) { + throw new AssertionError(errorMessage, undefined, ssfi); + } - if (!doLength && (objType === 'date' && (startType !== 'date' || finishType !== 'date'))) { - errorMessage = msgPrefix + 'the arguments to within must be dates'; - } else if ((startType !== 'number' || finishType !== 'number') && (doLength || objType === 'number')) { - errorMessage = msgPrefix + 'the arguments to within must be numbers'; - } else if (!doLength && (objType !== 'date' && objType !== 'number')) { - var printObj = (objType === 'string') ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + if (doLength) { + var descriptor = 'length' + , itemsCount; + if (objType === 'map' || objType === 'set') { + descriptor = 'size'; + itemsCount = obj.size; } else { - shouldThrow = false; + itemsCount = obj.length; } + this.assert( + itemsCount <= n + , 'expected #{this} to have a ' + descriptor + ' at most #{exp} but got #{act}' + , 'expected #{this} to have a ' + descriptor + ' above #{exp}' + , n + , itemsCount + ); + } else { + this.assert( + obj <= n + , 'expected #{this} to be at most #{exp}' + , 'expected #{this} to be above #{exp}' + , n + ); + } +} + +Assertion.addMethod('most', assertMost); +Assertion.addMethod('lte', assertMost); +Assertion.addMethod('lessThanOrEqual', assertMost); + +/** + * ### .within(start, finish[, msg]) + * + * Asserts that the target is a number or a date greater than or equal to the given + * number or date `start`, and less than or equal to the given number or date `finish` respectively. + * However, it's often best to assert that the target is equal to its expected + * value. + * + * expect(2).to.equal(2); // Recommended + * expect(2).to.be.within(1, 3); // Not recommended + * expect(2).to.be.within(2, 3); // Not recommended + * expect(2).to.be.within(1, 2); // Not recommended + * + * Add `.lengthOf` earlier in the chain to assert that the target's `length` + * or `size` is greater than or equal to the given number `start`, and less + * than or equal to the given number `finish`. + * + * expect('foo').to.have.lengthOf(3); // Recommended + * expect('foo').to.have.lengthOf.within(2, 4); // Not recommended + * + * expect([1, 2, 3]).to.have.lengthOf(3); // Recommended + * expect([1, 2, 3]).to.have.lengthOf.within(2, 4); // Not recommended + * + * Add `.not` earlier in the chain to negate `.within`. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.within(2, 4); // Not recommended + * + * `.within` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect(4).to.be.within(1, 3, 'nooo why fail??'); + * expect(4, 'nooo why fail??').to.be.within(1, 3); + * + * @name within + * @param {Number} start lower bound inclusive + * @param {Number} finish upper bound inclusive + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - if (shouldThrow) { - throw new AssertionError(errorMessage, undefined, ssfi); - } +Assertion.addMethod('within', function (start, finish, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , doLength = flag(this, 'doLength') + , flagMsg = flag(this, 'message') + , msgPrefix = ((flagMsg) ? flagMsg + ': ' : '') + , ssfi = flag(this, 'ssfi') + , objType = _.type(obj).toLowerCase() + , startType = _.type(start).toLowerCase() + , finishType = _.type(finish).toLowerCase() + , errorMessage + , shouldThrow = true + , range = (startType === 'date' && finishType === 'date') + ? start.toISOString() + '..' + finish.toISOString() + : start + '..' + finish; + + if (doLength && objType !== 'map' && objType !== 'set') { + new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); + } - if (doLength) { - var descriptor = 'length' - , itemsCount; - if (objType === 'map' || objType === 'set') { - descriptor = 'size'; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount >= start && itemsCount <= finish - , 'expected #{this} to have a ' + descriptor + ' within ' + range - , 'expected #{this} to not have a ' + descriptor + ' within ' + range - ); - } else { - this.assert( - obj >= start && obj <= finish - , 'expected #{this} to be within ' + range - , 'expected #{this} to not be within ' + range - ); - } - }); + if (!doLength && (objType === 'date' && (startType !== 'date' || finishType !== 'date'))) { + errorMessage = msgPrefix + 'the arguments to within must be dates'; + } else if ((startType !== 'number' || finishType !== 'number') && (doLength || objType === 'number')) { + errorMessage = msgPrefix + 'the arguments to within must be numbers'; + } else if (!doLength && (objType !== 'date' && objType !== 'number')) { + var printObj = (objType === 'string') ? "'" + obj + "'" : obj; + errorMessage = msgPrefix + 'expected ' + printObj + ' to be a number or a date'; + } else { + shouldThrow = false; + } - /** - * ### .instanceof(constructor[, msg]) - * - * Asserts that the target is an instance of the given `constructor`. - * - * function Cat () { } - * - * expect(new Cat()).to.be.an.instanceof(Cat); - * expect([1, 2]).to.be.an.instanceof(Array); - * - * Add `.not` earlier in the chain to negate `.instanceof`. - * - * expect({a: 1}).to.not.be.an.instanceof(Array); - * - * `.instanceof` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(1).to.be.an.instanceof(Array, 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.an.instanceof(Array); - * - * Due to limitations in ES5, `.instanceof` may not always work as expected - * when using a transpiler such as Babel or TypeScript. In particular, it may - * produce unexpected results when subclassing built-in object such as - * `Array`, `Error`, and `Map`. See your transpiler's docs for details: - * - * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes)) - * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)) - * - * The alias `.instanceOf` can be used interchangeably with `.instanceof`. - * - * @name instanceof - * @param {Constructor} constructor - * @param {String} msg _optional_ - * @alias instanceOf - * @namespace BDD - * @api public - */ - - function assertInstanceOf (constructor, msg) { - if (msg) flag(this, 'message', msg); - - var target = flag(this, 'object') - var ssfi = flag(this, 'ssfi'); - var flagMsg = flag(this, 'message'); - - try { - var isInstanceOf = target instanceof constructor; - } catch (err) { - if (err instanceof TypeError) { - flagMsg = flagMsg ? flagMsg + ': ' : ''; - throw new AssertionError( - flagMsg + 'The instanceof assertion needs a constructor but ' - + _.type(constructor) + ' was given.', - undefined, - ssfi - ); - } - throw err; - } + if (shouldThrow) { + throw new AssertionError(errorMessage, undefined, ssfi); + } - var name = _.getName(constructor); - if (name == null) { - name = 'an unnamed constructor'; + if (doLength) { + var descriptor = 'length' + , itemsCount; + if (objType === 'map' || objType === 'set') { + descriptor = 'size'; + itemsCount = obj.size; + } else { + itemsCount = obj.length; } - this.assert( - isInstanceOf - , 'expected #{this} to be an instance of ' + name - , 'expected #{this} to not be an instance of ' + name + itemsCount >= start && itemsCount <= finish + , 'expected #{this} to have a ' + descriptor + ' within ' + range + , 'expected #{this} to not have a ' + descriptor + ' within ' + range ); - }; - - Assertion.addMethod('instanceof', assertInstanceOf); - Assertion.addMethod('instanceOf', assertInstanceOf); - - /** - * ### .property(name[, val[, msg]]) - * - * Asserts that the target has a property with the given key `name`. - * - * expect({a: 1}).to.have.property('a'); - * - * When `val` is provided, `.property` also asserts that the property's value - * is equal to the given `val`. - * - * expect({a: 1}).to.have.property('a', 1); - * - * By default, strict (`===`) equality is used. Add `.deep` earlier in the - * chain to use deep equality instead. See the `deep-eql` project page for - * info on the deep equality algorithm: https://github.com/chaijs/deep-eql. - * - * // Target object deeply (but not strictly) has property `x: {a: 1}` - * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1}); - * expect({x: {a: 1}}).to.not.have.property('x', {a: 1}); - * - * The target's enumerable and non-enumerable properties are always included - * in the search. By default, both own and inherited properties are included. - * Add `.own` earlier in the chain to exclude inherited properties from the - * search. - * - * Object.prototype.b = 2; - * - * expect({a: 1}).to.have.own.property('a'); - * expect({a: 1}).to.have.own.property('a', 1); - * expect({a: 1}).to.have.property('b'); - * expect({a: 1}).to.not.have.own.property('b'); - * - * `.deep` and `.own` can be combined. - * - * expect({x: {a: 1}}).to.have.deep.own.property('x', {a: 1}); - * - * Add `.nested` earlier in the chain to enable dot- and bracket-notation when - * referencing nested properties. - * - * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]'); - * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]', 'y'); - * - * If `.` or `[]` are part of an actual property name, they can be escaped by - * adding two backslashes before them. - * - * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]'); - * - * `.deep` and `.nested` can be combined. - * - * expect({a: {b: [{c: 3}]}}) - * .to.have.deep.nested.property('a.b[0]', {c: 3}); - * - * `.own` and `.nested` cannot be combined. - * - * Add `.not` earlier in the chain to negate `.property`. - * - * expect({a: 1}).to.not.have.property('b'); - * - * However, it's dangerous to negate `.property` when providing `val`. The - * problem is that it creates uncertain expectations by asserting that the - * target either doesn't have a property with the given key `name`, or that it - * does have a property with the given key `name` but its value isn't equal to - * the given `val`. It's often best to identify the exact output that's - * expected, and then write an assertion that only accepts that exact output. - * - * When the target isn't expected to have a property with the given key - * `name`, it's often best to assert exactly that. - * - * expect({b: 2}).to.not.have.property('a'); // Recommended - * expect({b: 2}).to.not.have.property('a', 1); // Not recommended - * - * When the target is expected to have a property with the given key `name`, - * it's often best to assert that the property has its expected value, rather - * than asserting that it doesn't have one of many unexpected values. - * - * expect({a: 3}).to.have.property('a', 3); // Recommended - * expect({a: 3}).to.not.have.property('a', 1); // Not recommended - * - * `.property` changes the target of any assertions that follow in the chain - * to be the value of the property from the original target object. - * - * expect({a: 1}).to.have.property('a').that.is.a('number'); - * - * `.property` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing `val`, only use the - * second form. - * - * // Recommended - * expect({a: 1}).to.have.property('a', 2, 'nooo why fail??'); - * expect({a: 1}, 'nooo why fail??').to.have.property('a', 2); - * expect({a: 1}, 'nooo why fail??').to.have.property('b'); - * - * // Not recommended - * expect({a: 1}).to.have.property('b', undefined, 'nooo why fail??'); - * - * The above assertion isn't the same thing as not providing `val`. Instead, - * it's asserting that the target object has a `b` property that's equal to - * `undefined`. - * - * The assertions `.ownProperty` and `.haveOwnProperty` can be used - * interchangeably with `.own.property`. - * - * @name property - * @param {String} name - * @param {Mixed} val (optional) - * @param {String} msg _optional_ - * @returns value of property for chaining - * @namespace BDD - * @api public - */ - - function assertProperty (name, val, msg) { - if (msg) flag(this, 'message', msg); - - var isNested = flag(this, 'nested') - , isOwn = flag(this, 'own') - , flagMsg = flag(this, 'message') - , obj = flag(this, 'object') - , ssfi = flag(this, 'ssfi') - , nameType = typeof name; + } else { + this.assert( + obj >= start && obj <= finish + , 'expected #{this} to be within ' + range + , 'expected #{this} to not be within ' + range + ); + } +}); + +/** + * ### .instanceof(constructor[, msg]) + * + * Asserts that the target is an instance of the given `constructor`. + * + * function Cat () { } + * + * expect(new Cat()).to.be.an.instanceof(Cat); + * expect([1, 2]).to.be.an.instanceof(Array); + * + * Add `.not` earlier in the chain to negate `.instanceof`. + * + * expect({a: 1}).to.not.be.an.instanceof(Array); + * + * `.instanceof` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect(1).to.be.an.instanceof(Array, 'nooo why fail??'); + * expect(1, 'nooo why fail??').to.be.an.instanceof(Array); + * + * Due to limitations in ES5, `.instanceof` may not always work as expected + * when using a transpiler such as Babel or TypeScript. In particular, it may + * produce unexpected results when subclassing built-in object such as + * `Array`, `Error`, and `Map`. See your transpiler's docs for details: + * + * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes)) + * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)) + * + * The alias `.instanceOf` can be used interchangeably with `.instanceof`. + * + * @name instanceof + * @param {Constructor} constructor + * @param {String} msg _optional_ + * @alias instanceOf + * @namespace BDD + * @api public + */ - flagMsg = flagMsg ? flagMsg + ': ' : ''; +function assertInstanceOf (constructor, msg) { + if (msg) flag(this, 'message', msg); - if (isNested) { - if (nameType !== 'string') { - throw new AssertionError( - flagMsg + 'the argument to property must be a string when using nested syntax', - undefined, - ssfi - ); - } - } else { - if (nameType !== 'string' && nameType !== 'number' && nameType !== 'symbol') { - throw new AssertionError( - flagMsg + 'the argument to property must be a string, number, or symbol', - undefined, - ssfi - ); - } - } + var target = flag(this, 'object') + var ssfi = flag(this, 'ssfi'); + var flagMsg = flag(this, 'message'); - if (isNested && isOwn) { + try { + var isInstanceOf = target instanceof constructor; + } catch (err) { + if (err instanceof TypeError) { + flagMsg = flagMsg ? flagMsg + ': ' : ''; throw new AssertionError( - flagMsg + 'The "nested" and "own" flags cannot be combined.', + flagMsg + 'The instanceof assertion needs a constructor but ' + + _.type(constructor) + ' was given.', undefined, ssfi ); } + throw err; + } - if (obj === null || obj === undefined) { - throw new AssertionError( - flagMsg + 'Target cannot be null or undefined.', - undefined, - ssfi - ); - } + var name = _.getName(constructor); + if (name == null) { + name = 'an unnamed constructor'; + } - var isDeep = flag(this, 'deep') - , negate = flag(this, 'negate') - , pathInfo = isNested ? _.getPathInfo(obj, name) : null - , value = isNested ? pathInfo.value : obj[name]; - - var descriptor = ''; - if (isDeep) descriptor += 'deep '; - if (isOwn) descriptor += 'own '; - if (isNested) descriptor += 'nested '; - descriptor += 'property '; - - var hasProperty; - if (isOwn) hasProperty = Object.prototype.hasOwnProperty.call(obj, name); - else if (isNested) hasProperty = pathInfo.exists; - else hasProperty = _.hasProperty(obj, name); - - // When performing a negated assertion for both name and val, merely having - // a property with the given name isn't enough to cause the assertion to - // fail. It must both have a property with the given name, and the value of - // that property must equal the given val. Therefore, skip this assertion in - // favor of the next. - if (!negate || arguments.length === 1) { - this.assert( - hasProperty - , 'expected #{this} to have ' + descriptor + _.inspect(name) - , 'expected #{this} to not have ' + descriptor + _.inspect(name)); - } + this.assert( + isInstanceOf + , 'expected #{this} to be an instance of ' + name + , 'expected #{this} to not be an instance of ' + name + ); +}; - if (arguments.length > 1) { - this.assert( - hasProperty && (isDeep ? _.eql(val, value) : val === value) - , 'expected #{this} to have ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}' - , 'expected #{this} to not have ' + descriptor + _.inspect(name) + ' of #{act}' - , val - , value - ); - } +Assertion.addMethod('instanceof', assertInstanceOf); +Assertion.addMethod('instanceOf', assertInstanceOf); + +/** + * ### .property(name[, val[, msg]]) + * + * Asserts that the target has a property with the given key `name`. + * + * expect({a: 1}).to.have.property('a'); + * + * When `val` is provided, `.property` also asserts that the property's value + * is equal to the given `val`. + * + * expect({a: 1}).to.have.property('a', 1); + * + * By default, strict (`===`) equality is used. Add `.deep` earlier in the + * chain to use deep equality instead. See the `deep-eql` project page for + * info on the deep equality algorithm: https://github.com/chaijs/deep-eql. + * + * // Target object deeply (but not strictly) has property `x: {a: 1}` + * expect({x: {a: 1}}).to.have.deep.property('x', {a: 1}); + * expect({x: {a: 1}}).to.not.have.property('x', {a: 1}); + * + * The target's enumerable and non-enumerable properties are always included + * in the search. By default, both own and inherited properties are included. + * Add `.own` earlier in the chain to exclude inherited properties from the + * search. + * + * Object.prototype.b = 2; + * + * expect({a: 1}).to.have.own.property('a'); + * expect({a: 1}).to.have.own.property('a', 1); + * expect({a: 1}).to.have.property('b'); + * expect({a: 1}).to.not.have.own.property('b'); + * + * `.deep` and `.own` can be combined. + * + * expect({x: {a: 1}}).to.have.deep.own.property('x', {a: 1}); + * + * Add `.nested` earlier in the chain to enable dot- and bracket-notation when + * referencing nested properties. + * + * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]'); + * expect({a: {b: ['x', 'y']}}).to.have.nested.property('a.b[1]', 'y'); + * + * If `.` or `[]` are part of an actual property name, they can be escaped by + * adding two backslashes before them. + * + * expect({'.a': {'[b]': 'x'}}).to.have.nested.property('\\.a.\\[b\\]'); + * + * `.deep` and `.nested` can be combined. + * + * expect({a: {b: [{c: 3}]}}) + * .to.have.deep.nested.property('a.b[0]', {c: 3}); + * + * `.own` and `.nested` cannot be combined. + * + * Add `.not` earlier in the chain to negate `.property`. + * + * expect({a: 1}).to.not.have.property('b'); + * + * However, it's dangerous to negate `.property` when providing `val`. The + * problem is that it creates uncertain expectations by asserting that the + * target either doesn't have a property with the given key `name`, or that it + * does have a property with the given key `name` but its value isn't equal to + * the given `val`. It's often best to identify the exact output that's + * expected, and then write an assertion that only accepts that exact output. + * + * When the target isn't expected to have a property with the given key + * `name`, it's often best to assert exactly that. + * + * expect({b: 2}).to.not.have.property('a'); // Recommended + * expect({b: 2}).to.not.have.property('a', 1); // Not recommended + * + * When the target is expected to have a property with the given key `name`, + * it's often best to assert that the property has its expected value, rather + * than asserting that it doesn't have one of many unexpected values. + * + * expect({a: 3}).to.have.property('a', 3); // Recommended + * expect({a: 3}).to.not.have.property('a', 1); // Not recommended + * + * `.property` changes the target of any assertions that follow in the chain + * to be the value of the property from the original target object. + * + * expect({a: 1}).to.have.property('a').that.is.a('number'); + * + * `.property` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. When not providing `val`, only use the + * second form. + * + * // Recommended + * expect({a: 1}).to.have.property('a', 2, 'nooo why fail??'); + * expect({a: 1}, 'nooo why fail??').to.have.property('a', 2); + * expect({a: 1}, 'nooo why fail??').to.have.property('b'); + * + * // Not recommended + * expect({a: 1}).to.have.property('b', undefined, 'nooo why fail??'); + * + * The above assertion isn't the same thing as not providing `val`. Instead, + * it's asserting that the target object has a `b` property that's equal to + * `undefined`. + * + * The assertions `.ownProperty` and `.haveOwnProperty` can be used + * interchangeably with `.own.property`. + * + * @name property + * @param {String} name + * @param {Mixed} val (optional) + * @param {String} msg _optional_ + * @returns value of property for chaining + * @namespace BDD + * @api public + */ - flag(this, 'object', value); - } +function assertProperty (name, val, msg) { + if (msg) flag(this, 'message', msg); - Assertion.addMethod('property', assertProperty); + var isNested = flag(this, 'nested') + , isOwn = flag(this, 'own') + , flagMsg = flag(this, 'message') + , obj = flag(this, 'object') + , ssfi = flag(this, 'ssfi') + , nameType = typeof name; - function assertOwnProperty (name, value, msg) { - flag(this, 'own', true); - assertProperty.apply(this, arguments); - } + flagMsg = flagMsg ? flagMsg + ': ' : ''; - Assertion.addMethod('ownProperty', assertOwnProperty); - Assertion.addMethod('haveOwnProperty', assertOwnProperty); - - /** - * ### .ownPropertyDescriptor(name[, descriptor[, msg]]) - * - * Asserts that the target has its own property descriptor with the given key - * `name`. Enumerable and non-enumerable properties are included in the - * search. - * - * expect({a: 1}).to.have.ownPropertyDescriptor('a'); - * - * When `descriptor` is provided, `.ownPropertyDescriptor` also asserts that - * the property's descriptor is deeply equal to the given `descriptor`. See - * the `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * expect({a: 1}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, - * }); - * - * Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`. - * - * expect({a: 1}).to.not.have.ownPropertyDescriptor('b'); - * - * However, it's dangerous to negate `.ownPropertyDescriptor` when providing - * a `descriptor`. The problem is that it creates uncertain expectations by - * asserting that the target either doesn't have a property descriptor with - * the given key `name`, or that it does have a property descriptor with the - * given key `name` but it’s not deeply equal to the given `descriptor`. It's - * often best to identify the exact output that's expected, and then write an - * assertion that only accepts that exact output. - * - * When the target isn't expected to have a property descriptor with the given - * key `name`, it's often best to assert exactly that. - * - * // Recommended - * expect({b: 2}).to.not.have.ownPropertyDescriptor('a'); - * - * // Not recommended - * expect({b: 2}).to.not.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, - * }); - * - * When the target is expected to have a property descriptor with the given - * key `name`, it's often best to assert that the property has its expected - * descriptor, rather than asserting that it doesn't have one of many - * unexpected descriptors. - * - * // Recommended - * expect({a: 3}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 3, - * }); - * - * // Not recommended - * expect({a: 3}).to.not.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 1, - * }); - * - * `.ownPropertyDescriptor` changes the target of any assertions that follow - * in the chain to be the value of the property descriptor from the original - * target object. - * - * expect({a: 1}).to.have.ownPropertyDescriptor('a') - * .that.has.property('enumerable', true); - * - * `.ownPropertyDescriptor` accepts an optional `msg` argument which is a - * custom error message to show when the assertion fails. The message can also - * be given as the second argument to `expect`. When not providing - * `descriptor`, only use the second form. - * - * // Recommended - * expect({a: 1}).to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 2, - * }, 'nooo why fail??'); - * - * // Recommended - * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('a', { - * configurable: true, - * enumerable: true, - * writable: true, - * value: 2, - * }); - * - * // Recommended - * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b'); - * - * // Not recommended - * expect({a: 1}) - * .to.have.ownPropertyDescriptor('b', undefined, 'nooo why fail??'); - * - * The above assertion isn't the same thing as not providing `descriptor`. - * Instead, it's asserting that the target object has a `b` property - * descriptor that's deeply equal to `undefined`. - * - * The alias `.haveOwnPropertyDescriptor` can be used interchangeably with - * `.ownPropertyDescriptor`. - * - * @name ownPropertyDescriptor - * @alias haveOwnPropertyDescriptor - * @param {String} name - * @param {Object} descriptor _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertOwnPropertyDescriptor (name, descriptor, msg) { - if (typeof descriptor === 'string') { - msg = descriptor; - descriptor = null; - } - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); - if (actualDescriptor && descriptor) { - this.assert( - _.eql(descriptor, actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor) - , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor) - , descriptor - , actualDescriptor - , true + if (isNested) { + if (nameType !== 'string') { + throw new AssertionError( + flagMsg + 'the argument to property must be a string when using nested syntax', + undefined, + ssfi ); - } else { - this.assert( - actualDescriptor - , 'expected #{this} to have an own property descriptor for ' + _.inspect(name) - , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name) + } + } else { + if (nameType !== 'string' && nameType !== 'number' && nameType !== 'symbol') { + throw new AssertionError( + flagMsg + 'the argument to property must be a string, number, or symbol', + undefined, + ssfi ); } - flag(this, 'object', actualDescriptor); } - Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); - Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); - - /** - * ### .lengthOf(n[, msg]) - * - * Asserts that the target's `length` or `size` is equal to the given number - * `n`. - * - * expect([1, 2, 3]).to.have.lengthOf(3); - * expect('foo').to.have.lengthOf(3); - * expect(new Set([1, 2, 3])).to.have.lengthOf(3); - * expect(new Map([['a', 1], ['b', 2], ['c', 3]])).to.have.lengthOf(3); - * - * Add `.not` earlier in the chain to negate `.lengthOf`. However, it's often - * best to assert that the target's `length` property is equal to its expected - * value, rather than not equal to one of many unexpected values. - * - * expect('foo').to.have.lengthOf(3); // Recommended - * expect('foo').to.not.have.lengthOf(4); // Not recommended - * - * `.lengthOf` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect([1, 2, 3]).to.have.lengthOf(2, 'nooo why fail??'); - * expect([1, 2, 3], 'nooo why fail??').to.have.lengthOf(2); - * - * `.lengthOf` can also be used as a language chain, causing all `.above`, - * `.below`, `.least`, `.most`, and `.within` assertions that follow in the - * chain to use the target's `length` property as the target. However, it's - * often best to assert that the target's `length` property is equal to its - * expected length, rather than asserting that its `length` property falls - * within some range of values. - * - * // Recommended - * expect([1, 2, 3]).to.have.lengthOf(3); - * - * // Not recommended - * expect([1, 2, 3]).to.have.lengthOf.above(2); - * expect([1, 2, 3]).to.have.lengthOf.below(4); - * expect([1, 2, 3]).to.have.lengthOf.at.least(3); - * expect([1, 2, 3]).to.have.lengthOf.at.most(3); - * expect([1, 2, 3]).to.have.lengthOf.within(2,4); - * - * Due to a compatibility issue, the alias `.length` can't be chained directly - * off of an uninvoked method such as `.a`. Therefore, `.length` can't be used - * interchangeably with `.lengthOf` in every situation. It's recommended to - * always use `.lengthOf` instead of `.length`. - * - * expect([1, 2, 3]).to.have.a.length(3); // incompatible; throws error - * expect([1, 2, 3]).to.have.a.lengthOf(3); // passes as expected - * - * @name lengthOf - * @alias length - * @param {Number} n - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertLengthChain () { - flag(this, 'doLength', true); + if (isNested && isOwn) { + throw new AssertionError( + flagMsg + 'The "nested" and "own" flags cannot be combined.', + undefined, + ssfi + ); } - function assertLength (n, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , objType = _.type(obj).toLowerCase() - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi') - , descriptor = 'length' - , itemsCount; - - switch (objType) { - case 'map': - case 'set': - descriptor = 'size'; - itemsCount = obj.size; - break; - default: - new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); - itemsCount = obj.length; - } + if (obj === null || obj === undefined) { + throw new AssertionError( + flagMsg + 'Target cannot be null or undefined.', + undefined, + ssfi + ); + } + var isDeep = flag(this, 'deep') + , negate = flag(this, 'negate') + , pathInfo = isNested ? _.getPathInfo(obj, name) : null + , value = isNested ? pathInfo.value : obj[name]; + + var descriptor = ''; + if (isDeep) descriptor += 'deep '; + if (isOwn) descriptor += 'own '; + if (isNested) descriptor += 'nested '; + descriptor += 'property '; + + var hasProperty; + if (isOwn) hasProperty = Object.prototype.hasOwnProperty.call(obj, name); + else if (isNested) hasProperty = pathInfo.exists; + else hasProperty = _.hasProperty(obj, name); + + // When performing a negated assertion for both name and val, merely having + // a property with the given name isn't enough to cause the assertion to + // fail. It must both have a property with the given name, and the value of + // that property must equal the given val. Therefore, skip this assertion in + // favor of the next. + if (!negate || arguments.length === 1) { this.assert( - itemsCount == n - , 'expected #{this} to have a ' + descriptor + ' of #{exp} but got #{act}' - , 'expected #{this} to not have a ' + descriptor + ' of #{act}' - , n - , itemsCount - ); + hasProperty + , 'expected #{this} to have ' + descriptor + _.inspect(name) + , 'expected #{this} to not have ' + descriptor + _.inspect(name)); } - Assertion.addChainableMethod('length', assertLength, assertLengthChain); - Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain); - - /** - * ### .match(re[, msg]) - * - * Asserts that the target matches the given regular expression `re`. - * - * expect('foobar').to.match(/^foo/); - * - * Add `.not` earlier in the chain to negate `.match`. - * - * expect('foobar').to.not.match(/taco/); - * - * `.match` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect('foobar').to.match(/taco/, 'nooo why fail??'); - * expect('foobar', 'nooo why fail??').to.match(/taco/); - * - * The alias `.matches` can be used interchangeably with `.match`. - * - * @name match - * @alias matches - * @param {RegExp} re - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - function assertMatch(re, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); + if (arguments.length > 1) { this.assert( - re.exec(obj) - , 'expected #{this} to match ' + re - , 'expected #{this} not to match ' + re + hasProperty && (isDeep ? _.eql(val, value) : val === value) + , 'expected #{this} to have ' + descriptor + _.inspect(name) + ' of #{exp}, but got #{act}' + , 'expected #{this} to not have ' + descriptor + _.inspect(name) + ' of #{act}' + , val + , value ); } - Assertion.addMethod('match', assertMatch); - Assertion.addMethod('matches', assertMatch); - - /** - * ### .string(str[, msg]) - * - * Asserts that the target string contains the given substring `str`. - * - * expect('foobar').to.have.string('bar'); - * - * Add `.not` earlier in the chain to negate `.string`. - * - * expect('foobar').to.not.have.string('taco'); - * - * `.string` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect('foobar').to.have.string('taco', 'nooo why fail??'); - * expect('foobar', 'nooo why fail??').to.have.string('taco'); - * - * @name string - * @param {String} str - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - Assertion.addMethod('string', function (str, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(obj, flagMsg, ssfi, true).is.a('string'); + flag(this, 'object', value); +} + +Assertion.addMethod('property', assertProperty); + +function assertOwnProperty (name, value, msg) { + flag(this, 'own', true); + assertProperty.apply(this, arguments); +} + +Assertion.addMethod('ownProperty', assertOwnProperty); +Assertion.addMethod('haveOwnProperty', assertOwnProperty); + +/** + * ### .ownPropertyDescriptor(name[, descriptor[, msg]]) + * + * Asserts that the target has its own property descriptor with the given key + * `name`. Enumerable and non-enumerable properties are included in the + * search. + * + * expect({a: 1}).to.have.ownPropertyDescriptor('a'); + * + * When `descriptor` is provided, `.ownPropertyDescriptor` also asserts that + * the property's descriptor is deeply equal to the given `descriptor`. See + * the `deep-eql` project page for info on the deep equality algorithm: + * https://github.com/chaijs/deep-eql. + * + * expect({a: 1}).to.have.ownPropertyDescriptor('a', { + * configurable: true, + * enumerable: true, + * writable: true, + * value: 1, + * }); + * + * Add `.not` earlier in the chain to negate `.ownPropertyDescriptor`. + * + * expect({a: 1}).to.not.have.ownPropertyDescriptor('b'); + * + * However, it's dangerous to negate `.ownPropertyDescriptor` when providing + * a `descriptor`. The problem is that it creates uncertain expectations by + * asserting that the target either doesn't have a property descriptor with + * the given key `name`, or that it does have a property descriptor with the + * given key `name` but it’s not deeply equal to the given `descriptor`. It's + * often best to identify the exact output that's expected, and then write an + * assertion that only accepts that exact output. + * + * When the target isn't expected to have a property descriptor with the given + * key `name`, it's often best to assert exactly that. + * + * // Recommended + * expect({b: 2}).to.not.have.ownPropertyDescriptor('a'); + * + * // Not recommended + * expect({b: 2}).to.not.have.ownPropertyDescriptor('a', { + * configurable: true, + * enumerable: true, + * writable: true, + * value: 1, + * }); + * + * When the target is expected to have a property descriptor with the given + * key `name`, it's often best to assert that the property has its expected + * descriptor, rather than asserting that it doesn't have one of many + * unexpected descriptors. + * + * // Recommended + * expect({a: 3}).to.have.ownPropertyDescriptor('a', { + * configurable: true, + * enumerable: true, + * writable: true, + * value: 3, + * }); + * + * // Not recommended + * expect({a: 3}).to.not.have.ownPropertyDescriptor('a', { + * configurable: true, + * enumerable: true, + * writable: true, + * value: 1, + * }); + * + * `.ownPropertyDescriptor` changes the target of any assertions that follow + * in the chain to be the value of the property descriptor from the original + * target object. + * + * expect({a: 1}).to.have.ownPropertyDescriptor('a') + * .that.has.property('enumerable', true); + * + * `.ownPropertyDescriptor` accepts an optional `msg` argument which is a + * custom error message to show when the assertion fails. The message can also + * be given as the second argument to `expect`. When not providing + * `descriptor`, only use the second form. + * + * // Recommended + * expect({a: 1}).to.have.ownPropertyDescriptor('a', { + * configurable: true, + * enumerable: true, + * writable: true, + * value: 2, + * }, 'nooo why fail??'); + * + * // Recommended + * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('a', { + * configurable: true, + * enumerable: true, + * writable: true, + * value: 2, + * }); + * + * // Recommended + * expect({a: 1}, 'nooo why fail??').to.have.ownPropertyDescriptor('b'); + * + * // Not recommended + * expect({a: 1}) + * .to.have.ownPropertyDescriptor('b', undefined, 'nooo why fail??'); + * + * The above assertion isn't the same thing as not providing `descriptor`. + * Instead, it's asserting that the target object has a `b` property + * descriptor that's deeply equal to `undefined`. + * + * The alias `.haveOwnPropertyDescriptor` can be used interchangeably with + * `.ownPropertyDescriptor`. + * + * @name ownPropertyDescriptor + * @alias haveOwnPropertyDescriptor + * @param {String} name + * @param {Object} descriptor _optional_ + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ +function assertOwnPropertyDescriptor (name, descriptor, msg) { + if (typeof descriptor === 'string') { + msg = descriptor; + descriptor = null; + } + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object'); + var actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); + if (actualDescriptor && descriptor) { this.assert( - ~obj.indexOf(str) - , 'expected #{this} to contain ' + _.inspect(str) - , 'expected #{this} to not contain ' + _.inspect(str) + _.eql(descriptor, actualDescriptor) + , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to match ' + _.inspect(descriptor) + ', got ' + _.inspect(actualDescriptor) + , 'expected the own property descriptor for ' + _.inspect(name) + ' on #{this} to not match ' + _.inspect(descriptor) + , descriptor + , actualDescriptor + , true ); - }); + } else { + this.assert( + actualDescriptor + , 'expected #{this} to have an own property descriptor for ' + _.inspect(name) + , 'expected #{this} to not have an own property descriptor for ' + _.inspect(name) + ); + } + flag(this, 'object', actualDescriptor); +} + +Assertion.addMethod('ownPropertyDescriptor', assertOwnPropertyDescriptor); +Assertion.addMethod('haveOwnPropertyDescriptor', assertOwnPropertyDescriptor); + +/** + * ### .lengthOf(n[, msg]) + * + * Asserts that the target's `length` or `size` is equal to the given number + * `n`. + * + * expect([1, 2, 3]).to.have.lengthOf(3); + * expect('foo').to.have.lengthOf(3); + * expect(new Set([1, 2, 3])).to.have.lengthOf(3); + * expect(new Map([['a', 1], ['b', 2], ['c', 3]])).to.have.lengthOf(3); + * + * Add `.not` earlier in the chain to negate `.lengthOf`. However, it's often + * best to assert that the target's `length` property is equal to its expected + * value, rather than not equal to one of many unexpected values. + * + * expect('foo').to.have.lengthOf(3); // Recommended + * expect('foo').to.not.have.lengthOf(4); // Not recommended + * + * `.lengthOf` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect([1, 2, 3]).to.have.lengthOf(2, 'nooo why fail??'); + * expect([1, 2, 3], 'nooo why fail??').to.have.lengthOf(2); + * + * `.lengthOf` can also be used as a language chain, causing all `.above`, + * `.below`, `.least`, `.most`, and `.within` assertions that follow in the + * chain to use the target's `length` property as the target. However, it's + * often best to assert that the target's `length` property is equal to its + * expected length, rather than asserting that its `length` property falls + * within some range of values. + * + * // Recommended + * expect([1, 2, 3]).to.have.lengthOf(3); + * + * // Not recommended + * expect([1, 2, 3]).to.have.lengthOf.above(2); + * expect([1, 2, 3]).to.have.lengthOf.below(4); + * expect([1, 2, 3]).to.have.lengthOf.at.least(3); + * expect([1, 2, 3]).to.have.lengthOf.at.most(3); + * expect([1, 2, 3]).to.have.lengthOf.within(2,4); + * + * Due to a compatibility issue, the alias `.length` can't be chained directly + * off of an uninvoked method such as `.a`. Therefore, `.length` can't be used + * interchangeably with `.lengthOf` in every situation. It's recommended to + * always use `.lengthOf` instead of `.length`. + * + * expect([1, 2, 3]).to.have.a.length(3); // incompatible; throws error + * expect([1, 2, 3]).to.have.a.lengthOf(3); // passes as expected + * + * @name lengthOf + * @alias length + * @param {Number} n + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - /** - * ### .keys(key1[, key2[, ...]]) - * - * Asserts that the target object, array, map, or set has the given keys. Only - * the target's own inherited properties are included in the search. - * - * When the target is an object or array, keys can be provided as one or more - * string arguments, a single array argument, or a single object argument. In - * the latter case, only the keys in the given object matter; the values are - * ignored. - * - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); - * expect(['x', 'y']).to.have.all.keys(0, 1); - * - * expect({a: 1, b: 2}).to.have.all.keys(['a', 'b']); - * expect(['x', 'y']).to.have.all.keys([0, 1]); - * - * expect({a: 1, b: 2}).to.have.all.keys({a: 4, b: 5}); // ignore 4 and 5 - * expect(['x', 'y']).to.have.all.keys({0: 4, 1: 5}); // ignore 4 and 5 - * - * When the target is a map or set, each key must be provided as a separate - * argument. - * - * expect(new Map([['a', 1], ['b', 2]])).to.have.all.keys('a', 'b'); - * expect(new Set(['a', 'b'])).to.have.all.keys('a', 'b'); - * - * Because `.keys` does different things based on the target's type, it's - * important to check the target's type before using `.keys`. See the `.a` doc - * for info on testing a target's type. - * - * expect({a: 1, b: 2}).to.be.an('object').that.has.all.keys('a', 'b'); - * - * By default, strict (`===`) equality is used to compare keys of maps and - * sets. Add `.deep` earlier in the chain to use deep equality instead. See - * the `deep-eql` project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target set deeply (but not strictly) has key `{a: 1}` - * expect(new Set([{a: 1}])).to.have.all.deep.keys([{a: 1}]); - * expect(new Set([{a: 1}])).to.not.have.all.keys([{a: 1}]); - * - * By default, the target must have all of the given keys and no more. Add - * `.any` earlier in the chain to only require that the target have at least - * one of the given keys. Also, add `.not` earlier in the chain to negate - * `.keys`. It's often best to add `.any` when negating `.keys`, and to use - * `.all` when asserting `.keys` without negation. - * - * When negating `.keys`, `.any` is preferred because `.not.any.keys` asserts - * exactly what's expected of the output, whereas `.not.all.keys` creates - * uncertain expectations. - * - * // Recommended; asserts that target doesn't have any of the given keys - * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd'); - * - * // Not recommended; asserts that target doesn't have all of the given - * // keys but may or may not have some of them - * expect({a: 1, b: 2}).to.not.have.all.keys('c', 'd'); - * - * When asserting `.keys` without negation, `.all` is preferred because - * `.all.keys` asserts exactly what's expected of the output, whereas - * `.any.keys` creates uncertain expectations. - * - * // Recommended; asserts that target has all the given keys - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); - * - * // Not recommended; asserts that target has at least one of the given - * // keys but may or may not have more of them - * expect({a: 1, b: 2}).to.have.any.keys('a', 'b'); - * - * Note that `.all` is used by default when neither `.all` nor `.any` appear - * earlier in the chain. However, it's often best to add `.all` anyway because - * it improves readability. - * - * // Both assertions are identical - * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); // Recommended - * expect({a: 1, b: 2}).to.have.keys('a', 'b'); // Not recommended - * - * Add `.include` earlier in the chain to require that the target's keys be a - * superset of the expected keys, rather than identical sets. - * - * // Target object's keys are a superset of ['a', 'b'] but not identical - * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b'); - * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b'); - * - * However, if `.any` and `.include` are combined, only the `.any` takes - * effect. The `.include` is ignored in this case. - * - * // Both assertions are identical - * expect({a: 1}).to.have.any.keys('a', 'b'); - * expect({a: 1}).to.include.any.keys('a', 'b'); - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({a: 1}, 'nooo why fail??').to.have.key('b'); - * - * The alias `.key` can be used interchangeably with `.keys`. - * - * @name keys - * @alias key - * @param {...String|Array|Object} keys - * @namespace BDD - * @api public - */ - - function assertKeys (keys) { - var obj = flag(this, 'object') - , objType = _.type(obj) - , keysType = _.type(keys) - , ssfi = flag(this, 'ssfi') - , isDeep = flag(this, 'deep') - , str - , deepStr = '' - , actual - , ok = true - , flagMsg = flag(this, 'message'); +function assertLengthChain () { + flag(this, 'doLength', true); +} + +function assertLength (n, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , objType = _.type(obj).toLowerCase() + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi') + , descriptor = 'length' + , itemsCount; + + switch (objType) { + case 'map': + case 'set': + descriptor = 'size'; + itemsCount = obj.size; + break; + default: + new Assertion(obj, flagMsg, ssfi, true).to.have.property('length'); + itemsCount = obj.length; + } - flagMsg = flagMsg ? flagMsg + ': ' : ''; - var mixedArgsMsg = flagMsg + 'when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments'; + this.assert( + itemsCount == n + , 'expected #{this} to have a ' + descriptor + ' of #{exp} but got #{act}' + , 'expected #{this} to not have a ' + descriptor + ' of #{act}' + , n + , itemsCount + ); +} + +Assertion.addChainableMethod('length', assertLength, assertLengthChain); +Assertion.addChainableMethod('lengthOf', assertLength, assertLengthChain); + +/** + * ### .match(re[, msg]) + * + * Asserts that the target matches the given regular expression `re`. + * + * expect('foobar').to.match(/^foo/); + * + * Add `.not` earlier in the chain to negate `.match`. + * + * expect('foobar').to.not.match(/taco/); + * + * `.match` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect('foobar').to.match(/taco/, 'nooo why fail??'); + * expect('foobar', 'nooo why fail??').to.match(/taco/); + * + * The alias `.matches` can be used interchangeably with `.match`. + * + * @name match + * @alias matches + * @param {RegExp} re + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ +function assertMatch(re, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object'); + this.assert( + re.exec(obj) + , 'expected #{this} to match ' + re + , 'expected #{this} not to match ' + re + ); +} + +Assertion.addMethod('match', assertMatch); +Assertion.addMethod('matches', assertMatch); + +/** + * ### .string(str[, msg]) + * + * Asserts that the target string contains the given substring `str`. + * + * expect('foobar').to.have.string('bar'); + * + * Add `.not` earlier in the chain to negate `.string`. + * + * expect('foobar').to.not.have.string('taco'); + * + * `.string` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect('foobar').to.have.string('taco', 'nooo why fail??'); + * expect('foobar', 'nooo why fail??').to.have.string('taco'); + * + * @name string + * @param {String} str + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - if (objType === 'Map' || objType === 'Set') { - deepStr = isDeep ? 'deeply ' : ''; - actual = []; +Assertion.addMethod('string', function (str, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi'); + new Assertion(obj, flagMsg, ssfi, true).is.a('string'); + + this.assert( + ~obj.indexOf(str) + , 'expected #{this} to contain ' + _.inspect(str) + , 'expected #{this} to not contain ' + _.inspect(str) + ); +}); + +/** + * ### .keys(key1[, key2[, ...]]) + * + * Asserts that the target object, array, map, or set has the given keys. Only + * the target's own inherited properties are included in the search. + * + * When the target is an object or array, keys can be provided as one or more + * string arguments, a single array argument, or a single object argument. In + * the latter case, only the keys in the given object matter; the values are + * ignored. + * + * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); + * expect(['x', 'y']).to.have.all.keys(0, 1); + * + * expect({a: 1, b: 2}).to.have.all.keys(['a', 'b']); + * expect(['x', 'y']).to.have.all.keys([0, 1]); + * + * expect({a: 1, b: 2}).to.have.all.keys({a: 4, b: 5}); // ignore 4 and 5 + * expect(['x', 'y']).to.have.all.keys({0: 4, 1: 5}); // ignore 4 and 5 + * + * When the target is a map or set, each key must be provided as a separate + * argument. + * + * expect(new Map([['a', 1], ['b', 2]])).to.have.all.keys('a', 'b'); + * expect(new Set(['a', 'b'])).to.have.all.keys('a', 'b'); + * + * Because `.keys` does different things based on the target's type, it's + * important to check the target's type before using `.keys`. See the `.a` doc + * for info on testing a target's type. + * + * expect({a: 1, b: 2}).to.be.an('object').that.has.all.keys('a', 'b'); + * + * By default, strict (`===`) equality is used to compare keys of maps and + * sets. Add `.deep` earlier in the chain to use deep equality instead. See + * the `deep-eql` project page for info on the deep equality algorithm: + * https://github.com/chaijs/deep-eql. + * + * // Target set deeply (but not strictly) has key `{a: 1}` + * expect(new Set([{a: 1}])).to.have.all.deep.keys([{a: 1}]); + * expect(new Set([{a: 1}])).to.not.have.all.keys([{a: 1}]); + * + * By default, the target must have all of the given keys and no more. Add + * `.any` earlier in the chain to only require that the target have at least + * one of the given keys. Also, add `.not` earlier in the chain to negate + * `.keys`. It's often best to add `.any` when negating `.keys`, and to use + * `.all` when asserting `.keys` without negation. + * + * When negating `.keys`, `.any` is preferred because `.not.any.keys` asserts + * exactly what's expected of the output, whereas `.not.all.keys` creates + * uncertain expectations. + * + * // Recommended; asserts that target doesn't have any of the given keys + * expect({a: 1, b: 2}).to.not.have.any.keys('c', 'd'); + * + * // Not recommended; asserts that target doesn't have all of the given + * // keys but may or may not have some of them + * expect({a: 1, b: 2}).to.not.have.all.keys('c', 'd'); + * + * When asserting `.keys` without negation, `.all` is preferred because + * `.all.keys` asserts exactly what's expected of the output, whereas + * `.any.keys` creates uncertain expectations. + * + * // Recommended; asserts that target has all the given keys + * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); + * + * // Not recommended; asserts that target has at least one of the given + * // keys but may or may not have more of them + * expect({a: 1, b: 2}).to.have.any.keys('a', 'b'); + * + * Note that `.all` is used by default when neither `.all` nor `.any` appear + * earlier in the chain. However, it's often best to add `.all` anyway because + * it improves readability. + * + * // Both assertions are identical + * expect({a: 1, b: 2}).to.have.all.keys('a', 'b'); // Recommended + * expect({a: 1, b: 2}).to.have.keys('a', 'b'); // Not recommended + * + * Add `.include` earlier in the chain to require that the target's keys be a + * superset of the expected keys, rather than identical sets. + * + * // Target object's keys are a superset of ['a', 'b'] but not identical + * expect({a: 1, b: 2, c: 3}).to.include.all.keys('a', 'b'); + * expect({a: 1, b: 2, c: 3}).to.not.have.all.keys('a', 'b'); + * + * However, if `.any` and `.include` are combined, only the `.any` takes + * effect. The `.include` is ignored in this case. + * + * // Both assertions are identical + * expect({a: 1}).to.have.any.keys('a', 'b'); + * expect({a: 1}).to.include.any.keys('a', 'b'); + * + * A custom error message can be given as the second argument to `expect`. + * + * expect({a: 1}, 'nooo why fail??').to.have.key('b'); + * + * The alias `.key` can be used interchangeably with `.keys`. + * + * @name keys + * @alias key + * @param {...String|Array|Object} keys + * @namespace BDD + * @api public + */ - // Map and Set '.keys' aren't supported in IE 11. Therefore, use .forEach. - obj.forEach(function (val, key) { actual.push(key) }); +function assertKeys (keys) { + var obj = flag(this, 'object') + , objType = _.type(obj) + , keysType = _.type(keys) + , ssfi = flag(this, 'ssfi') + , isDeep = flag(this, 'deep') + , str + , deepStr = '' + , actual + , ok = true + , flagMsg = flag(this, 'message'); + + flagMsg = flagMsg ? flagMsg + ': ' : ''; + var mixedArgsMsg = flagMsg + 'when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments'; + + if (objType === 'Map' || objType === 'Set') { + deepStr = isDeep ? 'deeply ' : ''; + actual = []; + + // Map and Set '.keys' aren't supported in IE 11. Therefore, use .forEach. + obj.forEach(function (val, key) { actual.push(key) }); + + if (keysType !== 'Array') { + keys = Array.prototype.slice.call(arguments); + } + } else { + actual = _.getOwnEnumerableProperties(obj); - if (keysType !== 'Array') { + switch (keysType) { + case 'Array': + if (arguments.length > 1) { + throw new AssertionError(mixedArgsMsg, undefined, ssfi); + } + break; + case 'Object': + if (arguments.length > 1) { + throw new AssertionError(mixedArgsMsg, undefined, ssfi); + } + keys = Object.keys(keys); + break; + default: keys = Array.prototype.slice.call(arguments); - } - } else { - actual = _.getOwnEnumerableProperties(obj); - - switch (keysType) { - case 'Array': - if (arguments.length > 1) { - throw new AssertionError(mixedArgsMsg, undefined, ssfi); - } - break; - case 'Object': - if (arguments.length > 1) { - throw new AssertionError(mixedArgsMsg, undefined, ssfi); - } - keys = Object.keys(keys); - break; - default: - keys = Array.prototype.slice.call(arguments); - } - - // Only stringify non-Symbols because Symbols would become "Symbol()" - keys = keys.map(function (val) { - return typeof val === 'symbol' ? val : String(val); - }); } - if (!keys.length) { - throw new AssertionError(flagMsg + 'keys required', undefined, ssfi); - } + // Only stringify non-Symbols because Symbols would become "Symbol()" + keys = keys.map(function (val) { + return typeof val === 'symbol' ? val : String(val); + }); + } - var len = keys.length - , any = flag(this, 'any') - , all = flag(this, 'all') - , expected = keys; + if (!keys.length) { + throw new AssertionError(flagMsg + 'keys required', undefined, ssfi); + } - if (!any && !all) { - all = true; - } + var len = keys.length + , any = flag(this, 'any') + , all = flag(this, 'all') + , expected = keys; - // Has any - if (any) { - ok = expected.some(function(expectedKey) { - return actual.some(function(actualKey) { - if (isDeep) { - return _.eql(expectedKey, actualKey); - } else { - return expectedKey === actualKey; - } - }); + if (!any && !all) { + all = true; + } + + // Has any + if (any) { + ok = expected.some(function(expectedKey) { + return actual.some(function(actualKey) { + if (isDeep) { + return _.eql(expectedKey, actualKey); + } else { + return expectedKey === actualKey; + } }); - } + }); + } - // Has all - if (all) { - ok = expected.every(function(expectedKey) { - return actual.some(function(actualKey) { - if (isDeep) { - return _.eql(expectedKey, actualKey); - } else { - return expectedKey === actualKey; - } - }); + // Has all + if (all) { + ok = expected.every(function(expectedKey) { + return actual.some(function(actualKey) { + if (isDeep) { + return _.eql(expectedKey, actualKey); + } else { + return expectedKey === actualKey; + } }); + }); - if (!flag(this, 'contains')) { - ok = ok && keys.length == actual.length; - } + if (!flag(this, 'contains')) { + ok = ok && keys.length == actual.length; } + } - // Key string - if (len > 1) { - keys = keys.map(function(key) { - return _.inspect(key); - }); - var last = keys.pop(); - if (all) { - str = keys.join(', ') + ', and ' + last; - } - if (any) { - str = keys.join(', ') + ', or ' + last; - } - } else { - str = _.inspect(keys[0]); + // Key string + if (len > 1) { + keys = keys.map(function(key) { + return _.inspect(key); + }); + var last = keys.pop(); + if (all) { + str = keys.join(', ') + ', and ' + last; } + if (any) { + str = keys.join(', ') + ', or ' + last; + } + } else { + str = _.inspect(keys[0]); + } - // Form - str = (len > 1 ? 'keys ' : 'key ') + str; - - // Have / include - str = (flag(this, 'contains') ? 'contain ' : 'have ') + str; + // Form + str = (len > 1 ? 'keys ' : 'key ') + str; + + // Have / include + str = (flag(this, 'contains') ? 'contain ' : 'have ') + str; + + // Assertion + this.assert( + ok + , 'expected #{this} to ' + deepStr + str + , 'expected #{this} to not ' + deepStr + str + , expected.slice(0).sort(_.compareByInspect) + , actual.sort(_.compareByInspect) + , true + ); +} + +Assertion.addMethod('keys', assertKeys); +Assertion.addMethod('key', assertKeys); + +/** + * ### .throw([errorLike], [errMsgMatcher], [msg]) + * + * When no arguments are provided, `.throw` invokes the target function and + * asserts that an error is thrown. + * + * var badFn = function () { throw new TypeError('Illegal salmon!'); }; + * + * expect(badFn).to.throw(); + * + * When one argument is provided, and it's an error constructor, `.throw` + * invokes the target function and asserts that an error is thrown that's an + * instance of that error constructor. + * + * var badFn = function () { throw new TypeError('Illegal salmon!'); }; + * + * expect(badFn).to.throw(TypeError); + * + * When one argument is provided, and it's an error instance, `.throw` invokes + * the target function and asserts that an error is thrown that's strictly + * (`===`) equal to that error instance. + * + * var err = new TypeError('Illegal salmon!'); + * var badFn = function () { throw err; }; + * + * expect(badFn).to.throw(err); + * + * When one argument is provided, and it's a string, `.throw` invokes the + * target function and asserts that an error is thrown with a message that + * contains that string. + * + * var badFn = function () { throw new TypeError('Illegal salmon!'); }; + * + * expect(badFn).to.throw('salmon'); + * + * When one argument is provided, and it's a regular expression, `.throw` + * invokes the target function and asserts that an error is thrown with a + * message that matches that regular expression. + * + * var badFn = function () { throw new TypeError('Illegal salmon!'); }; + * + * expect(badFn).to.throw(/salmon/); + * + * When two arguments are provided, and the first is an error instance or + * constructor, and the second is a string or regular expression, `.throw` + * invokes the function and asserts that an error is thrown that fulfills both + * conditions as described above. + * + * var err = new TypeError('Illegal salmon!'); + * var badFn = function () { throw err; }; + * + * expect(badFn).to.throw(TypeError, 'salmon'); + * expect(badFn).to.throw(TypeError, /salmon/); + * expect(badFn).to.throw(err, 'salmon'); + * expect(badFn).to.throw(err, /salmon/); + * + * Add `.not` earlier in the chain to negate `.throw`. + * + * var goodFn = function () {}; + * + * expect(goodFn).to.not.throw(); + * + * However, it's dangerous to negate `.throw` when providing any arguments. + * The problem is that it creates uncertain expectations by asserting that the + * target either doesn't throw an error, or that it throws an error but of a + * different type than the given type, or that it throws an error of the given + * type but with a message that doesn't include the given string. It's often + * best to identify the exact output that's expected, and then write an + * assertion that only accepts that exact output. + * + * When the target isn't expected to throw an error, it's often best to assert + * exactly that. + * + * var goodFn = function () {}; + * + * expect(goodFn).to.not.throw(); // Recommended + * expect(goodFn).to.not.throw(ReferenceError, 'x'); // Not recommended + * + * When the target is expected to throw an error, it's often best to assert + * that the error is of its expected type, and has a message that includes an + * expected string, rather than asserting that it doesn't have one of many + * unexpected types, and doesn't have a message that includes some string. + * + * var badFn = function () { throw new TypeError('Illegal salmon!'); }; + * + * expect(badFn).to.throw(TypeError, 'salmon'); // Recommended + * expect(badFn).to.not.throw(ReferenceError, 'x'); // Not recommended + * + * `.throw` changes the target of any assertions that follow in the chain to + * be the error object that's thrown. + * + * var err = new TypeError('Illegal salmon!'); + * err.code = 42; + * var badFn = function () { throw err; }; + * + * expect(badFn).to.throw(TypeError).with.property('code', 42); + * + * `.throw` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. When not providing two arguments, always use + * the second form. + * + * var goodFn = function () {}; + * + * expect(goodFn).to.throw(TypeError, 'x', 'nooo why fail??'); + * expect(goodFn, 'nooo why fail??').to.throw(); + * + * Due to limitations in ES5, `.throw` may not always work as expected when + * using a transpiler such as Babel or TypeScript. In particular, it may + * produce unexpected results when subclassing the built-in `Error` object and + * then passing the subclassed constructor to `.throw`. See your transpiler's + * docs for details: + * + * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes)) + * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)) + * + * Beware of some common mistakes when using the `throw` assertion. One common + * mistake is to accidentally invoke the function yourself instead of letting + * the `throw` assertion invoke the function for you. For example, when + * testing if a function named `fn` throws, provide `fn` instead of `fn()` as + * the target for the assertion. + * + * expect(fn).to.throw(); // Good! Tests `fn` as desired + * expect(fn()).to.throw(); // Bad! Tests result of `fn()`, not `fn` + * + * If you need to assert that your function `fn` throws when passed certain + * arguments, then wrap a call to `fn` inside of another function. + * + * expect(function () { fn(42); }).to.throw(); // Function expression + * expect(() => fn(42)).to.throw(); // ES6 arrow function + * + * Another common mistake is to provide an object method (or any stand-alone + * function that relies on `this`) as the target of the assertion. Doing so is + * problematic because the `this` context will be lost when the function is + * invoked by `.throw`; there's no way for it to know what `this` is supposed + * to be. There are two ways around this problem. One solution is to wrap the + * method or function call inside of another function. Another solution is to + * use `bind`. + * + * expect(function () { cat.meow(); }).to.throw(); // Function expression + * expect(() => cat.meow()).to.throw(); // ES6 arrow function + * expect(cat.meow.bind(cat)).to.throw(); // Bind + * + * Finally, it's worth mentioning that it's a best practice in JavaScript to + * only throw `Error` and derivatives of `Error` such as `ReferenceError`, + * `TypeError`, and user-defined objects that extend `Error`. No other type of + * value will generate a stack trace when initialized. With that said, the + * `throw` assertion does technically support any type of value being thrown, + * not just `Error` and its derivatives. + * + * The aliases `.throws` and `.Throw` can be used interchangeably with + * `.throw`. + * + * @name throw + * @alias throws + * @alias Throw + * @param {Error|ErrorConstructor} errorLike + * @param {String|RegExp} errMsgMatcher error message + * @param {String} msg _optional_ + * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types + * @returns error for chaining (null if no error) + * @namespace BDD + * @api public + */ - // Assertion - this.assert( - ok - , 'expected #{this} to ' + deepStr + str - , 'expected #{this} to not ' + deepStr + str - , expected.slice(0).sort(_.compareByInspect) - , actual.sort(_.compareByInspect) - , true - ); +function assertThrows (errorLike, errMsgMatcher, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , ssfi = flag(this, 'ssfi') + , flagMsg = flag(this, 'message') + , negate = flag(this, 'negate') || false; + new Assertion(obj, flagMsg, ssfi, true).is.a('function'); + + if (errorLike instanceof RegExp || typeof errorLike === 'string') { + errMsgMatcher = errorLike; + errorLike = null; } - Assertion.addMethod('keys', assertKeys); - Assertion.addMethod('key', assertKeys); - - /** - * ### .throw([errorLike], [errMsgMatcher], [msg]) - * - * When no arguments are provided, `.throw` invokes the target function and - * asserts that an error is thrown. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(); - * - * When one argument is provided, and it's an error constructor, `.throw` - * invokes the target function and asserts that an error is thrown that's an - * instance of that error constructor. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(TypeError); - * - * When one argument is provided, and it's an error instance, `.throw` invokes - * the target function and asserts that an error is thrown that's strictly - * (`===`) equal to that error instance. - * - * var err = new TypeError('Illegal salmon!'); - * var badFn = function () { throw err; }; - * - * expect(badFn).to.throw(err); - * - * When one argument is provided, and it's a string, `.throw` invokes the - * target function and asserts that an error is thrown with a message that - * contains that string. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw('salmon'); - * - * When one argument is provided, and it's a regular expression, `.throw` - * invokes the target function and asserts that an error is thrown with a - * message that matches that regular expression. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(/salmon/); - * - * When two arguments are provided, and the first is an error instance or - * constructor, and the second is a string or regular expression, `.throw` - * invokes the function and asserts that an error is thrown that fulfills both - * conditions as described above. - * - * var err = new TypeError('Illegal salmon!'); - * var badFn = function () { throw err; }; - * - * expect(badFn).to.throw(TypeError, 'salmon'); - * expect(badFn).to.throw(TypeError, /salmon/); - * expect(badFn).to.throw(err, 'salmon'); - * expect(badFn).to.throw(err, /salmon/); - * - * Add `.not` earlier in the chain to negate `.throw`. - * - * var goodFn = function () {}; - * - * expect(goodFn).to.not.throw(); - * - * However, it's dangerous to negate `.throw` when providing any arguments. - * The problem is that it creates uncertain expectations by asserting that the - * target either doesn't throw an error, or that it throws an error but of a - * different type than the given type, or that it throws an error of the given - * type but with a message that doesn't include the given string. It's often - * best to identify the exact output that's expected, and then write an - * assertion that only accepts that exact output. - * - * When the target isn't expected to throw an error, it's often best to assert - * exactly that. - * - * var goodFn = function () {}; - * - * expect(goodFn).to.not.throw(); // Recommended - * expect(goodFn).to.not.throw(ReferenceError, 'x'); // Not recommended - * - * When the target is expected to throw an error, it's often best to assert - * that the error is of its expected type, and has a message that includes an - * expected string, rather than asserting that it doesn't have one of many - * unexpected types, and doesn't have a message that includes some string. - * - * var badFn = function () { throw new TypeError('Illegal salmon!'); }; - * - * expect(badFn).to.throw(TypeError, 'salmon'); // Recommended - * expect(badFn).to.not.throw(ReferenceError, 'x'); // Not recommended - * - * `.throw` changes the target of any assertions that follow in the chain to - * be the error object that's thrown. - * - * var err = new TypeError('Illegal salmon!'); - * err.code = 42; - * var badFn = function () { throw err; }; - * - * expect(badFn).to.throw(TypeError).with.property('code', 42); - * - * `.throw` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. When not providing two arguments, always use - * the second form. - * - * var goodFn = function () {}; - * - * expect(goodFn).to.throw(TypeError, 'x', 'nooo why fail??'); - * expect(goodFn, 'nooo why fail??').to.throw(); - * - * Due to limitations in ES5, `.throw` may not always work as expected when - * using a transpiler such as Babel or TypeScript. In particular, it may - * produce unexpected results when subclassing the built-in `Error` object and - * then passing the subclassed constructor to `.throw`. See your transpiler's - * docs for details: - * - * - ([Babel](https://babeljs.io/docs/usage/caveats/#classes)) - * - ([TypeScript](https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work)) - * - * Beware of some common mistakes when using the `throw` assertion. One common - * mistake is to accidentally invoke the function yourself instead of letting - * the `throw` assertion invoke the function for you. For example, when - * testing if a function named `fn` throws, provide `fn` instead of `fn()` as - * the target for the assertion. - * - * expect(fn).to.throw(); // Good! Tests `fn` as desired - * expect(fn()).to.throw(); // Bad! Tests result of `fn()`, not `fn` - * - * If you need to assert that your function `fn` throws when passed certain - * arguments, then wrap a call to `fn` inside of another function. - * - * expect(function () { fn(42); }).to.throw(); // Function expression - * expect(() => fn(42)).to.throw(); // ES6 arrow function - * - * Another common mistake is to provide an object method (or any stand-alone - * function that relies on `this`) as the target of the assertion. Doing so is - * problematic because the `this` context will be lost when the function is - * invoked by `.throw`; there's no way for it to know what `this` is supposed - * to be. There are two ways around this problem. One solution is to wrap the - * method or function call inside of another function. Another solution is to - * use `bind`. - * - * expect(function () { cat.meow(); }).to.throw(); // Function expression - * expect(() => cat.meow()).to.throw(); // ES6 arrow function - * expect(cat.meow.bind(cat)).to.throw(); // Bind - * - * Finally, it's worth mentioning that it's a best practice in JavaScript to - * only throw `Error` and derivatives of `Error` such as `ReferenceError`, - * `TypeError`, and user-defined objects that extend `Error`. No other type of - * value will generate a stack trace when initialized. With that said, the - * `throw` assertion does technically support any type of value being thrown, - * not just `Error` and its derivatives. - * - * The aliases `.throws` and `.Throw` can be used interchangeably with - * `.throw`. - * - * @name throw - * @alias throws - * @alias Throw - * @param {Error|ErrorConstructor} errorLike - * @param {String|RegExp} errMsgMatcher error message - * @param {String} msg _optional_ - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @returns error for chaining (null if no error) - * @namespace BDD - * @api public - */ - - function assertThrows (errorLike, errMsgMatcher, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , ssfi = flag(this, 'ssfi') - , flagMsg = flag(this, 'message') - , negate = flag(this, 'negate') || false; - new Assertion(obj, flagMsg, ssfi, true).is.a('function'); - - if (errorLike instanceof RegExp || typeof errorLike === 'string') { - errMsgMatcher = errorLike; - errorLike = null; - } + var caughtErr; + try { + obj(); + } catch (err) { + caughtErr = err; + } - var caughtErr; - try { - obj(); - } catch (err) { - caughtErr = err; + // If we have the negate flag enabled and at least one valid argument it means we do expect an error + // but we want it to match a given set of criteria + var everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined; + + // If we've got the negate flag enabled and both args, we should only fail if both aren't compatible + // See Issue #551 and PR #683@GitHub + var everyArgIsDefined = Boolean(errorLike && errMsgMatcher); + var errorLikeFail = false; + var errMsgMatcherFail = false; + + // Checking if error was thrown + if (everyArgIsUndefined || !everyArgIsUndefined && !negate) { + // We need this to display results correctly according to their types + var errorLikeString = 'an error'; + if (errorLike instanceof Error) { + errorLikeString = '#{exp}'; + } else if (errorLike) { + errorLikeString = _.checkError.getConstructorName(errorLike); } - // If we have the negate flag enabled and at least one valid argument it means we do expect an error - // but we want it to match a given set of criteria - var everyArgIsUndefined = errorLike === undefined && errMsgMatcher === undefined; - - // If we've got the negate flag enabled and both args, we should only fail if both aren't compatible - // See Issue #551 and PR #683@GitHub - var everyArgIsDefined = Boolean(errorLike && errMsgMatcher); - var errorLikeFail = false; - var errMsgMatcherFail = false; - - // Checking if error was thrown - if (everyArgIsUndefined || !everyArgIsUndefined && !negate) { - // We need this to display results correctly according to their types - var errorLikeString = 'an error'; - if (errorLike instanceof Error) { - errorLikeString = '#{exp}'; - } else if (errorLike) { - errorLikeString = _.checkError.getConstructorName(errorLike); - } - - this.assert( - caughtErr - , 'expected #{this} to throw ' + errorLikeString - , 'expected #{this} to not throw an error but #{act} was thrown' - , errorLike && errorLike.toString() - , (caughtErr instanceof Error ? - caughtErr.toString() : (typeof caughtErr === 'string' ? caughtErr : caughtErr && - _.checkError.getConstructorName(caughtErr))) - ); - } + this.assert( + caughtErr + , 'expected #{this} to throw ' + errorLikeString + , 'expected #{this} to not throw an error but #{act} was thrown' + , errorLike && errorLike.toString() + , (caughtErr instanceof Error ? + caughtErr.toString() : (typeof caughtErr === 'string' ? caughtErr : caughtErr && + _.checkError.getConstructorName(caughtErr))) + ); + } - if (errorLike && caughtErr) { - // We should compare instances only if `errorLike` is an instance of `Error` - if (errorLike instanceof Error) { - var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike); - - if (isCompatibleInstance === negate) { - // These checks were created to ensure we won't fail too soon when we've got both args and a negate - // See Issue #551 and PR #683@GitHub - if (everyArgIsDefined && negate) { - errorLikeFail = true; - } else { - this.assert( - negate - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' + (caughtErr && !negate ? ' but #{act} was thrown' : '') - , errorLike.toString() - , caughtErr.toString() - ); - } - } - } + if (errorLike && caughtErr) { + // We should compare instances only if `errorLike` is an instance of `Error` + if (errorLike instanceof Error) { + var isCompatibleInstance = _.checkError.compatibleInstance(caughtErr, errorLike); - var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike); - if (isCompatibleConstructor === negate) { + if (isCompatibleInstance === negate) { + // These checks were created to ensure we won't fail too soon when we've got both args and a negate + // See Issue #551 and PR #683@GitHub if (everyArgIsDefined && negate) { - errorLikeFail = true; + errorLikeFail = true; } else { this.assert( negate , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '') - , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike)) - , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr)) + , 'expected #{this} to not throw #{exp}' + (caughtErr && !negate ? ' but #{act} was thrown' : '') + , errorLike.toString() + , caughtErr.toString() ); } } } - if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) { - // Here we check compatible messages - var placeholder = 'including'; - if (errMsgMatcher instanceof RegExp) { - placeholder = 'matching' - } - - var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher); - if (isCompatibleMessage === negate) { - if (everyArgIsDefined && negate) { - errMsgMatcherFail = true; - } else { - this.assert( + var isCompatibleConstructor = _.checkError.compatibleConstructor(caughtErr, errorLike); + if (isCompatibleConstructor === negate) { + if (everyArgIsDefined && negate) { + errorLikeFail = true; + } else { + this.assert( negate - , 'expected #{this} to throw error ' + placeholder + ' #{exp} but got #{act}' - , 'expected #{this} to throw error not ' + placeholder + ' #{exp}' - , errMsgMatcher - , _.checkError.getMessage(caughtErr) - ); - } + , 'expected #{this} to throw #{exp} but #{act} was thrown' + , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '') + , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike)) + , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr)) + ); } } + } - // If both assertions failed and both should've matched we throw an error - if (errorLikeFail && errMsgMatcherFail) { - this.assert( - negate - , 'expected #{this} to throw #{exp} but #{act} was thrown' - , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '') - , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike)) - , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr)) - ); + if (caughtErr && errMsgMatcher !== undefined && errMsgMatcher !== null) { + // Here we check compatible messages + var placeholder = 'including'; + if (errMsgMatcher instanceof RegExp) { + placeholder = 'matching' } - flag(this, 'object', caughtErr); - }; - - Assertion.addMethod('throw', assertThrows); - Assertion.addMethod('throws', assertThrows); - Assertion.addMethod('Throw', assertThrows); - - /** - * ### .respondTo(method[, msg]) - * - * When the target is a non-function object, `.respondTo` asserts that the - * target has a method with the given name `method`. The method can be own or - * inherited, and it can be enumerable or non-enumerable. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * - * expect(new Cat()).to.respondTo('meow'); - * - * When the target is a function, `.respondTo` asserts that the target's - * `prototype` property has a method with the given name `method`. Again, the - * method can be own or inherited, and it can be enumerable or non-enumerable. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * - * expect(Cat).to.respondTo('meow'); - * - * Add `.itself` earlier in the chain to force `.respondTo` to treat the - * target as a non-function object, even if it's a function. Thus, it asserts - * that the target has a method with the given name `method`, rather than - * asserting that the target's `prototype` property has a method with the - * given name `method`. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * Cat.hiss = function () {}; - * - * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow'); - * - * When not adding `.itself`, it's important to check the target's type before - * using `.respondTo`. See the `.a` doc for info on checking a target's type. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * - * expect(new Cat()).to.be.an('object').that.respondsTo('meow'); - * - * Add `.not` earlier in the chain to negate `.respondTo`. - * - * function Dog () {} - * Dog.prototype.bark = function () {}; - * - * expect(new Dog()).to.not.respondTo('meow'); - * - * `.respondTo` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect({}).to.respondTo('meow', 'nooo why fail??'); - * expect({}, 'nooo why fail??').to.respondTo('meow'); - * - * The alias `.respondsTo` can be used interchangeably with `.respondTo`. - * - * @name respondTo - * @alias respondsTo - * @param {String} method - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function respondTo (method, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , itself = flag(this, 'itself') - , context = ('function' === typeof obj && !itself) - ? obj.prototype[method] - : obj[method]; + var isCompatibleMessage = _.checkError.compatibleMessage(caughtErr, errMsgMatcher); + if (isCompatibleMessage === negate) { + if (everyArgIsDefined && negate) { + errMsgMatcherFail = true; + } else { + this.assert( + negate + , 'expected #{this} to throw error ' + placeholder + ' #{exp} but got #{act}' + , 'expected #{this} to throw error not ' + placeholder + ' #{exp}' + , errMsgMatcher + , _.checkError.getMessage(caughtErr) + ); + } + } + } + // If both assertions failed and both should've matched we throw an error + if (errorLikeFail && errMsgMatcherFail) { this.assert( - 'function' === typeof context - , 'expected #{this} to respond to ' + _.inspect(method) - , 'expected #{this} to not respond to ' + _.inspect(method) + negate + , 'expected #{this} to throw #{exp} but #{act} was thrown' + , 'expected #{this} to not throw #{exp}' + (caughtErr ? ' but #{act} was thrown' : '') + , (errorLike instanceof Error ? errorLike.toString() : errorLike && _.checkError.getConstructorName(errorLike)) + , (caughtErr instanceof Error ? caughtErr.toString() : caughtErr && _.checkError.getConstructorName(caughtErr)) ); } - Assertion.addMethod('respondTo', respondTo); - Assertion.addMethod('respondsTo', respondTo); - - /** - * ### .itself - * - * Forces all `.respondTo` assertions that follow in the chain to behave as if - * the target is a non-function object, even if it's a function. Thus, it - * causes `.respondTo` to assert that the target has a method with the given - * name, rather than asserting that the target's `prototype` property has a - * method with the given name. - * - * function Cat () {} - * Cat.prototype.meow = function () {}; - * Cat.hiss = function () {}; - * - * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow'); - * - * @name itself - * @namespace BDD - * @api public - */ - - Assertion.addProperty('itself', function () { - flag(this, 'itself', true); - }); + flag(this, 'object', caughtErr); +}; - /** - * ### .satisfy(matcher[, msg]) - * - * Invokes the given `matcher` function with the target being passed as the - * first argument, and asserts that the value returned is truthy. - * - * expect(1).to.satisfy(function(num) { - * return num > 0; - * }); - * - * Add `.not` earlier in the chain to negate `.satisfy`. - * - * expect(1).to.not.satisfy(function(num) { - * return num > 2; - * }); - * - * `.satisfy` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(1).to.satisfy(function(num) { - * return num > 2; - * }, 'nooo why fail??'); - * - * expect(1, 'nooo why fail??').to.satisfy(function(num) { - * return num > 2; - * }); - * - * The alias `.satisfies` can be used interchangeably with `.satisfy`. - * - * @name satisfy - * @alias satisfies - * @param {Function} matcher - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function satisfy (matcher, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object'); - var result = matcher(obj); - this.assert( - result - , 'expected #{this} to satisfy ' + _.objDisplay(matcher) - , 'expected #{this} to not satisfy' + _.objDisplay(matcher) - , flag(this, 'negate') ? false : true - , result - ); - } +Assertion.addMethod('throw', assertThrows); +Assertion.addMethod('throws', assertThrows); +Assertion.addMethod('Throw', assertThrows); + +/** + * ### .respondTo(method[, msg]) + * + * When the target is a non-function object, `.respondTo` asserts that the + * target has a method with the given name `method`. The method can be own or + * inherited, and it can be enumerable or non-enumerable. + * + * function Cat () {} + * Cat.prototype.meow = function () {}; + * + * expect(new Cat()).to.respondTo('meow'); + * + * When the target is a function, `.respondTo` asserts that the target's + * `prototype` property has a method with the given name `method`. Again, the + * method can be own or inherited, and it can be enumerable or non-enumerable. + * + * function Cat () {} + * Cat.prototype.meow = function () {}; + * + * expect(Cat).to.respondTo('meow'); + * + * Add `.itself` earlier in the chain to force `.respondTo` to treat the + * target as a non-function object, even if it's a function. Thus, it asserts + * that the target has a method with the given name `method`, rather than + * asserting that the target's `prototype` property has a method with the + * given name `method`. + * + * function Cat () {} + * Cat.prototype.meow = function () {}; + * Cat.hiss = function () {}; + * + * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow'); + * + * When not adding `.itself`, it's important to check the target's type before + * using `.respondTo`. See the `.a` doc for info on checking a target's type. + * + * function Cat () {} + * Cat.prototype.meow = function () {}; + * + * expect(new Cat()).to.be.an('object').that.respondsTo('meow'); + * + * Add `.not` earlier in the chain to negate `.respondTo`. + * + * function Dog () {} + * Dog.prototype.bark = function () {}; + * + * expect(new Dog()).to.not.respondTo('meow'); + * + * `.respondTo` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect({}).to.respondTo('meow', 'nooo why fail??'); + * expect({}, 'nooo why fail??').to.respondTo('meow'); + * + * The alias `.respondsTo` can be used interchangeably with `.respondTo`. + * + * @name respondTo + * @alias respondsTo + * @param {String} method + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - Assertion.addMethod('satisfy', satisfy); - Assertion.addMethod('satisfies', satisfy); - - /** - * ### .closeTo(expected, delta[, msg]) - * - * Asserts that the target is a number that's within a given +/- `delta` range - * of the given number `expected`. However, it's often best to assert that the - * target is equal to its expected value. - * - * // Recommended - * expect(1.5).to.equal(1.5); - * - * // Not recommended - * expect(1.5).to.be.closeTo(1, 0.5); - * expect(1.5).to.be.closeTo(2, 0.5); - * expect(1.5).to.be.closeTo(1, 1); - * - * Add `.not` earlier in the chain to negate `.closeTo`. - * - * expect(1.5).to.equal(1.5); // Recommended - * expect(1.5).to.not.be.closeTo(3, 1); // Not recommended - * - * `.closeTo` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect(1.5).to.be.closeTo(3, 1, 'nooo why fail??'); - * expect(1.5, 'nooo why fail??').to.be.closeTo(3, 1); - * - * The alias `.approximately` can be used interchangeably with `.closeTo`. - * - * @name closeTo - * @alias approximately - * @param {Number} expected - * @param {Number} delta - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function closeTo(expected, delta, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - - new Assertion(obj, flagMsg, ssfi, true).is.a('number'); - if (typeof expected !== 'number' || typeof delta !== 'number') { - flagMsg = flagMsg ? flagMsg + ': ' : ''; - var deltaMessage = delta === undefined ? ", and a delta is required" : ""; - throw new AssertionError( - flagMsg + 'the arguments to closeTo or approximately must be numbers' + deltaMessage, - undefined, - ssfi - ); - } +function respondTo (method, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , itself = flag(this, 'itself') + , context = ('function' === typeof obj && !itself) + ? obj.prototype[method] + : obj[method]; + + this.assert( + 'function' === typeof context + , 'expected #{this} to respond to ' + _.inspect(method) + , 'expected #{this} to not respond to ' + _.inspect(method) + ); +} + +Assertion.addMethod('respondTo', respondTo); +Assertion.addMethod('respondsTo', respondTo); + +/** + * ### .itself + * + * Forces all `.respondTo` assertions that follow in the chain to behave as if + * the target is a non-function object, even if it's a function. Thus, it + * causes `.respondTo` to assert that the target has a method with the given + * name, rather than asserting that the target's `prototype` property has a + * method with the given name. + * + * function Cat () {} + * Cat.prototype.meow = function () {}; + * Cat.hiss = function () {}; + * + * expect(Cat).itself.to.respondTo('hiss').but.not.respondTo('meow'); + * + * @name itself + * @namespace BDD + * @api public + */ - this.assert( - Math.abs(obj - expected) <= delta - , 'expected #{this} to be close to ' + expected + ' +/- ' + delta - , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta +Assertion.addProperty('itself', function () { + flag(this, 'itself', true); +}); + +/** + * ### .satisfy(matcher[, msg]) + * + * Invokes the given `matcher` function with the target being passed as the + * first argument, and asserts that the value returned is truthy. + * + * expect(1).to.satisfy(function(num) { + * return num > 0; + * }); + * + * Add `.not` earlier in the chain to negate `.satisfy`. + * + * expect(1).to.not.satisfy(function(num) { + * return num > 2; + * }); + * + * `.satisfy` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect(1).to.satisfy(function(num) { + * return num > 2; + * }, 'nooo why fail??'); + * + * expect(1, 'nooo why fail??').to.satisfy(function(num) { + * return num > 2; + * }); + * + * The alias `.satisfies` can be used interchangeably with `.satisfy`. + * + * @name satisfy + * @alias satisfies + * @param {Function} matcher + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ + +function satisfy (matcher, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object'); + var result = matcher(obj); + this.assert( + result + , 'expected #{this} to satisfy ' + _.objDisplay(matcher) + , 'expected #{this} to not satisfy' + _.objDisplay(matcher) + , flag(this, 'negate') ? false : true + , result + ); +} + +Assertion.addMethod('satisfy', satisfy); +Assertion.addMethod('satisfies', satisfy); + +/** + * ### .closeTo(expected, delta[, msg]) + * + * Asserts that the target is a number that's within a given +/- `delta` range + * of the given number `expected`. However, it's often best to assert that the + * target is equal to its expected value. + * + * // Recommended + * expect(1.5).to.equal(1.5); + * + * // Not recommended + * expect(1.5).to.be.closeTo(1, 0.5); + * expect(1.5).to.be.closeTo(2, 0.5); + * expect(1.5).to.be.closeTo(1, 1); + * + * Add `.not` earlier in the chain to negate `.closeTo`. + * + * expect(1.5).to.equal(1.5); // Recommended + * expect(1.5).to.not.be.closeTo(3, 1); // Not recommended + * + * `.closeTo` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect(1.5).to.be.closeTo(3, 1, 'nooo why fail??'); + * expect(1.5, 'nooo why fail??').to.be.closeTo(3, 1); + * + * The alias `.approximately` can be used interchangeably with `.closeTo`. + * + * @name closeTo + * @alias approximately + * @param {Number} expected + * @param {Number} delta + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ + +function closeTo(expected, delta, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi'); + + new Assertion(obj, flagMsg, ssfi, true).is.a('number'); + if (typeof expected !== 'number' || typeof delta !== 'number') { + flagMsg = flagMsg ? flagMsg + ': ' : ''; + var deltaMessage = delta === undefined ? ", and a delta is required" : ""; + throw new AssertionError( + flagMsg + 'the arguments to closeTo or approximately must be numbers' + deltaMessage, + undefined, + ssfi ); } - Assertion.addMethod('closeTo', closeTo); - Assertion.addMethod('approximately', closeTo); + this.assert( + Math.abs(obj - expected) <= delta + , 'expected #{this} to be close to ' + expected + ' +/- ' + delta + , 'expected #{this} not to be close to ' + expected + ' +/- ' + delta + ); +} + +Assertion.addMethod('closeTo', closeTo); +Assertion.addMethod('approximately', closeTo); + +// Note: Duplicates are ignored if testing for inclusion instead of sameness. +function isSubsetOf(subset, superset, cmp, contains, ordered) { + if (!contains) { + if (subset.length !== superset.length) return false; + superset = superset.slice(); + } - // Note: Duplicates are ignored if testing for inclusion instead of sameness. - function isSubsetOf(subset, superset, cmp, contains, ordered) { - if (!contains) { - if (subset.length !== superset.length) return false; - superset = superset.slice(); + return subset.every(function(elem, idx) { + if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx]; + + if (!cmp) { + var matchIdx = superset.indexOf(elem); + if (matchIdx === -1) return false; + + // Remove match from superset so not counted twice if duplicate in subset. + if (!contains) superset.splice(matchIdx, 1); + return true; } - return subset.every(function(elem, idx) { - if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx]; + return superset.some(function(elem2, matchIdx) { + if (!cmp(elem, elem2)) return false; - if (!cmp) { - var matchIdx = superset.indexOf(elem); - if (matchIdx === -1) return false; + // Remove match from superset so not counted twice if duplicate in subset. + if (!contains) superset.splice(matchIdx, 1); + return true; + }); + }); +} + +/** + * ### .members(set[, msg]) + * + * Asserts that the target array has the same members as the given array + * `set`. + * + * expect([1, 2, 3]).to.have.members([2, 1, 3]); + * expect([1, 2, 2]).to.have.members([2, 1, 2]); + * + * By default, members are compared using strict (`===`) equality. Add `.deep` + * earlier in the chain to use deep equality instead. See the `deep-eql` + * project page for info on the deep equality algorithm: + * https://github.com/chaijs/deep-eql. + * + * // Target array deeply (but not strictly) has member `{a: 1}` + * expect([{a: 1}]).to.have.deep.members([{a: 1}]); + * expect([{a: 1}]).to.not.have.members([{a: 1}]); + * + * By default, order doesn't matter. Add `.ordered` earlier in the chain to + * require that members appear in the same order. + * + * expect([1, 2, 3]).to.have.ordered.members([1, 2, 3]); + * expect([1, 2, 3]).to.have.members([2, 1, 3]) + * .but.not.ordered.members([2, 1, 3]); + * + * By default, both arrays must be the same size. Add `.include` earlier in + * the chain to require that the target's members be a superset of the + * expected members. Note that duplicates are ignored in the subset when + * `.include` is added. + * + * // Target array is a superset of [1, 2] but not identical + * expect([1, 2, 3]).to.include.members([1, 2]); + * expect([1, 2, 3]).to.not.have.members([1, 2]); + * + * // Duplicates in the subset are ignored + * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]); + * + * `.deep`, `.ordered`, and `.include` can all be combined. However, if + * `.include` and `.ordered` are combined, the ordering begins at the start of + * both arrays. + * + * expect([{a: 1}, {b: 2}, {c: 3}]) + * .to.include.deep.ordered.members([{a: 1}, {b: 2}]) + * .but.not.include.deep.ordered.members([{b: 2}, {c: 3}]); + * + * Add `.not` earlier in the chain to negate `.members`. However, it's + * dangerous to do so. The problem is that it creates uncertain expectations + * by asserting that the target array doesn't have all of the same members as + * the given array `set` but may or may not have some of them. It's often best + * to identify the exact output that's expected, and then write an assertion + * that only accepts that exact output. + * + * expect([1, 2]).to.not.include(3).and.not.include(4); // Recommended + * expect([1, 2]).to.not.have.members([3, 4]); // Not recommended + * + * `.members` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. + * + * expect([1, 2]).to.have.members([1, 2, 3], 'nooo why fail??'); + * expect([1, 2], 'nooo why fail??').to.have.members([1, 2, 3]); + * + * @name members + * @param {Array} set + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - // Remove match from superset so not counted twice if duplicate in subset. - if (!contains) superset.splice(matchIdx, 1); - return true; - } +Assertion.addMethod('members', function (subset, msg) { + if (msg) flag(this, 'message', msg); + var obj = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi'); - return superset.some(function(elem2, matchIdx) { - if (!cmp(elem, elem2)) return false; + new Assertion(obj, flagMsg, ssfi, true).to.be.an('array'); + new Assertion(subset, flagMsg, ssfi, true).to.be.an('array'); - // Remove match from superset so not counted twice if duplicate in subset. - if (!contains) superset.splice(matchIdx, 1); - return true; - }); - }); + var contains = flag(this, 'contains'); + var ordered = flag(this, 'ordered'); + + var subject, failMsg, failNegateMsg; + + if (contains) { + subject = ordered ? 'an ordered superset' : 'a superset'; + failMsg = 'expected #{this} to be ' + subject + ' of #{exp}'; + failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}'; + } else { + subject = ordered ? 'ordered members' : 'members'; + failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}'; + failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}'; } - /** - * ### .members(set[, msg]) - * - * Asserts that the target array has the same members as the given array - * `set`. - * - * expect([1, 2, 3]).to.have.members([2, 1, 3]); - * expect([1, 2, 2]).to.have.members([2, 1, 2]); - * - * By default, members are compared using strict (`===`) equality. Add `.deep` - * earlier in the chain to use deep equality instead. See the `deep-eql` - * project page for info on the deep equality algorithm: - * https://github.com/chaijs/deep-eql. - * - * // Target array deeply (but not strictly) has member `{a: 1}` - * expect([{a: 1}]).to.have.deep.members([{a: 1}]); - * expect([{a: 1}]).to.not.have.members([{a: 1}]); - * - * By default, order doesn't matter. Add `.ordered` earlier in the chain to - * require that members appear in the same order. - * - * expect([1, 2, 3]).to.have.ordered.members([1, 2, 3]); - * expect([1, 2, 3]).to.have.members([2, 1, 3]) - * .but.not.ordered.members([2, 1, 3]); - * - * By default, both arrays must be the same size. Add `.include` earlier in - * the chain to require that the target's members be a superset of the - * expected members. Note that duplicates are ignored in the subset when - * `.include` is added. - * - * // Target array is a superset of [1, 2] but not identical - * expect([1, 2, 3]).to.include.members([1, 2]); - * expect([1, 2, 3]).to.not.have.members([1, 2]); - * - * // Duplicates in the subset are ignored - * expect([1, 2, 3]).to.include.members([1, 2, 2, 2]); - * - * `.deep`, `.ordered`, and `.include` can all be combined. However, if - * `.include` and `.ordered` are combined, the ordering begins at the start of - * both arrays. - * - * expect([{a: 1}, {b: 2}, {c: 3}]) - * .to.include.deep.ordered.members([{a: 1}, {b: 2}]) - * .but.not.include.deep.ordered.members([{b: 2}, {c: 3}]); - * - * Add `.not` earlier in the chain to negate `.members`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the target array doesn't have all of the same members as - * the given array `set` but may or may not have some of them. It's often best - * to identify the exact output that's expected, and then write an assertion - * that only accepts that exact output. - * - * expect([1, 2]).to.not.include(3).and.not.include(4); // Recommended - * expect([1, 2]).to.not.have.members([3, 4]); // Not recommended - * - * `.members` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. - * - * expect([1, 2]).to.have.members([1, 2, 3], 'nooo why fail??'); - * expect([1, 2], 'nooo why fail??').to.have.members([1, 2, 3]); - * - * @name members - * @param {Array} set - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - Assertion.addMethod('members', function (subset, msg) { - if (msg) flag(this, 'message', msg); - var obj = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - - new Assertion(obj, flagMsg, ssfi, true).to.be.an('array'); - new Assertion(subset, flagMsg, ssfi, true).to.be.an('array'); - - var contains = flag(this, 'contains'); - var ordered = flag(this, 'ordered'); - - var subject, failMsg, failNegateMsg; - - if (contains) { - subject = ordered ? 'an ordered superset' : 'a superset'; - failMsg = 'expected #{this} to be ' + subject + ' of #{exp}'; - failNegateMsg = 'expected #{this} to not be ' + subject + ' of #{exp}'; - } else { - subject = ordered ? 'ordered members' : 'members'; - failMsg = 'expected #{this} to have the same ' + subject + ' as #{exp}'; - failNegateMsg = 'expected #{this} to not have the same ' + subject + ' as #{exp}'; - } + var cmp = flag(this, 'deep') ? _.eql : undefined; + + this.assert( + isSubsetOf(subset, obj, cmp, contains, ordered) + , failMsg + , failNegateMsg + , subset + , obj + , true + ); +}); + +/** + * ### .oneOf(list[, msg]) + * + * Asserts that the target is a member of the given array `list`. However, + * it's often best to assert that the target is equal to its expected value. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.be.oneOf([1, 2, 3]); // Not recommended + * + * Comparisons are performed using strict (`===`) equality. + * + * Add `.not` earlier in the chain to negate `.oneOf`. + * + * expect(1).to.equal(1); // Recommended + * expect(1).to.not.be.oneOf([2, 3, 4]); // Not recommended + * + * It can also be chained with `.contain` or `.include`, which will work with + * both arrays and strings: + * + * expect('Today is sunny').to.contain.oneOf(['sunny', 'cloudy']) + * expect('Today is rainy').to.not.contain.oneOf(['sunny', 'cloudy']) + * expect([1,2,3]).to.contain.oneOf([3,4,5]) + * expect([1,2,3]).to.not.contain.oneOf([4,5,6]) + * + * `.oneOf` accepts an optional `msg` argument which is a custom error message + * to show when the assertion fails. The message can also be given as the + * second argument to `expect`. + * + * expect(1).to.be.oneOf([2, 3, 4], 'nooo why fail??'); + * expect(1, 'nooo why fail??').to.be.oneOf([2, 3, 4]); + * + * @name oneOf + * @param {Array<*>} list + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - var cmp = flag(this, 'deep') ? _.eql : undefined; +function oneOf (list, msg) { + if (msg) flag(this, 'message', msg); + var expected = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi') + , contains = flag(this, 'contains') + , isDeep = flag(this, 'deep'); + new Assertion(list, flagMsg, ssfi, true).to.be.an('array'); + if (contains) { this.assert( - isSubsetOf(subset, obj, cmp, contains, ordered) - , failMsg - , failNegateMsg - , subset - , obj - , true + list.some(function(possibility) { return expected.indexOf(possibility) > -1 }) + , 'expected #{this} to contain one of #{exp}' + , 'expected #{this} to not contain one of #{exp}' + , list + , expected ); - }); - - /** - * ### .oneOf(list[, msg]) - * - * Asserts that the target is a member of the given array `list`. However, - * it's often best to assert that the target is equal to its expected value. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.be.oneOf([1, 2, 3]); // Not recommended - * - * Comparisons are performed using strict (`===`) equality. - * - * Add `.not` earlier in the chain to negate `.oneOf`. - * - * expect(1).to.equal(1); // Recommended - * expect(1).to.not.be.oneOf([2, 3, 4]); // Not recommended - * - * It can also be chained with `.contain` or `.include`, which will work with - * both arrays and strings: - * - * expect('Today is sunny').to.contain.oneOf(['sunny', 'cloudy']) - * expect('Today is rainy').to.not.contain.oneOf(['sunny', 'cloudy']) - * expect([1,2,3]).to.contain.oneOf([3,4,5]) - * expect([1,2,3]).to.not.contain.oneOf([4,5,6]) - * - * `.oneOf` accepts an optional `msg` argument which is a custom error message - * to show when the assertion fails. The message can also be given as the - * second argument to `expect`. - * - * expect(1).to.be.oneOf([2, 3, 4], 'nooo why fail??'); - * expect(1, 'nooo why fail??').to.be.oneOf([2, 3, 4]); - * - * @name oneOf - * @param {Array<*>} list - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function oneOf (list, msg) { - if (msg) flag(this, 'message', msg); - var expected = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi') - , contains = flag(this, 'contains') - , isDeep = flag(this, 'deep'); - new Assertion(list, flagMsg, ssfi, true).to.be.an('array'); - - if (contains) { + } else { + if (isDeep) { this.assert( - list.some(function(possibility) { return expected.indexOf(possibility) > -1 }) - , 'expected #{this} to contain one of #{exp}' - , 'expected #{this} to not contain one of #{exp}' + list.some(function(possibility) { return _.eql(expected, possibility) }) + , 'expected #{this} to deeply equal one of #{exp}' + , 'expected #{this} to deeply equal one of #{exp}' , list , expected ); } else { - if (isDeep) { - this.assert( - list.some(possibility => _.eql(expected, possibility)) - , 'expected #{this} to deeply equal one of #{exp}' - , 'expected #{this} to deeply equal one of #{exp}' - , list - , expected - ); - } else { - this.assert( - list.indexOf(expected) > -1 - , 'expected #{this} to be one of #{exp}' - , 'expected #{this} to not be one of #{exp}' - , list - , expected - ); - } + this.assert( + list.indexOf(expected) > -1 + , 'expected #{this} to be one of #{exp}' + , 'expected #{this} to not be one of #{exp}' + , list + , expected + ); } } +} + +Assertion.addMethod('oneOf', oneOf); + +/** + * ### .change(subject[, prop[, msg]]) + * + * When one argument is provided, `.change` asserts that the given function + * `subject` returns a different value when it's invoked before the target + * function compared to when it's invoked afterward. However, it's often best + * to assert that `subject` is equal to its expected value. + * + * var dots = '' + * , addDot = function () { dots += '.'; } + * , getDots = function () { return dots; }; + * + * // Recommended + * expect(getDots()).to.equal(''); + * addDot(); + * expect(getDots()).to.equal('.'); + * + * // Not recommended + * expect(addDot).to.change(getDots); + * + * When two arguments are provided, `.change` asserts that the value of the + * given object `subject`'s `prop` property is different before invoking the + * target function compared to afterward. + * + * var myObj = {dots: ''} + * , addDot = function () { myObj.dots += '.'; }; + * + * // Recommended + * expect(myObj).to.have.property('dots', ''); + * addDot(); + * expect(myObj).to.have.property('dots', '.'); + * + * // Not recommended + * expect(addDot).to.change(myObj, 'dots'); + * + * Strict (`===`) equality is used to compare before and after values. + * + * Add `.not` earlier in the chain to negate `.change`. + * + * var dots = '' + * , noop = function () {} + * , getDots = function () { return dots; }; + * + * expect(noop).to.not.change(getDots); + * + * var myObj = {dots: ''} + * , noop = function () {}; + * + * expect(noop).to.not.change(myObj, 'dots'); + * + * `.change` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. When not providing two arguments, always + * use the second form. + * + * var myObj = {dots: ''} + * , addDot = function () { myObj.dots += '.'; }; + * + * expect(addDot).to.not.change(myObj, 'dots', 'nooo why fail??'); + * + * var dots = '' + * , addDot = function () { dots += '.'; } + * , getDots = function () { return dots; }; + * + * expect(addDot, 'nooo why fail??').to.not.change(getDots); + * + * `.change` also causes all `.by` assertions that follow in the chain to + * assert how much a numeric subject was increased or decreased by. However, + * it's dangerous to use `.change.by`. The problem is that it creates + * uncertain expectations by asserting that the subject either increases by + * the given delta, or that it decreases by the given delta. It's often best + * to identify the exact output that's expected, and then write an assertion + * that only accepts that exact output. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; } + * , subtractTwo = function () { myObj.val -= 2; }; + * + * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended + * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended + * + * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended + * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended + * + * The alias `.changes` can be used interchangeably with `.change`. + * + * @name change + * @alias changes + * @param {String} subject + * @param {String} prop name _optional_ + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - Assertion.addMethod('oneOf', oneOf); - - /** - * ### .change(subject[, prop[, msg]]) - * - * When one argument is provided, `.change` asserts that the given function - * `subject` returns a different value when it's invoked before the target - * function compared to when it's invoked afterward. However, it's often best - * to assert that `subject` is equal to its expected value. - * - * var dots = '' - * , addDot = function () { dots += '.'; } - * , getDots = function () { return dots; }; - * - * // Recommended - * expect(getDots()).to.equal(''); - * addDot(); - * expect(getDots()).to.equal('.'); - * - * // Not recommended - * expect(addDot).to.change(getDots); - * - * When two arguments are provided, `.change` asserts that the value of the - * given object `subject`'s `prop` property is different before invoking the - * target function compared to afterward. - * - * var myObj = {dots: ''} - * , addDot = function () { myObj.dots += '.'; }; - * - * // Recommended - * expect(myObj).to.have.property('dots', ''); - * addDot(); - * expect(myObj).to.have.property('dots', '.'); - * - * // Not recommended - * expect(addDot).to.change(myObj, 'dots'); - * - * Strict (`===`) equality is used to compare before and after values. - * - * Add `.not` earlier in the chain to negate `.change`. - * - * var dots = '' - * , noop = function () {} - * , getDots = function () { return dots; }; - * - * expect(noop).to.not.change(getDots); - * - * var myObj = {dots: ''} - * , noop = function () {}; - * - * expect(noop).to.not.change(myObj, 'dots'); - * - * `.change` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing two arguments, always - * use the second form. - * - * var myObj = {dots: ''} - * , addDot = function () { myObj.dots += '.'; }; - * - * expect(addDot).to.not.change(myObj, 'dots', 'nooo why fail??'); - * - * var dots = '' - * , addDot = function () { dots += '.'; } - * , getDots = function () { return dots; }; - * - * expect(addDot, 'nooo why fail??').to.not.change(getDots); - * - * `.change` also causes all `.by` assertions that follow in the chain to - * assert how much a numeric subject was increased or decreased by. However, - * it's dangerous to use `.change.by`. The problem is that it creates - * uncertain expectations by asserting that the subject either increases by - * the given delta, or that it decreases by the given delta. It's often best - * to identify the exact output that's expected, and then write an assertion - * that only accepts that exact output. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; } - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * The alias `.changes` can be used interchangeably with `.change`. - * - * @name change - * @alias changes - * @param {String} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertChanges (subject, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(fn, flagMsg, ssfi, true).is.a('function'); - - var initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a('function'); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - - fn(); - - var final = prop === undefined || prop === null ? subject() : subject[prop]; - var msgObj = prop === undefined || prop === null ? initial : '.' + prop; - - // This gets flagged because of the .by(delta) assertion - flag(this, 'deltaMsgObj', msgObj); - flag(this, 'initialDeltaValue', initial); - flag(this, 'finalDeltaValue', final); - flag(this, 'deltaBehavior', 'change'); - flag(this, 'realDelta', final !== initial); - - this.assert( - initial !== final - , 'expected ' + msgObj + ' to change' - , 'expected ' + msgObj + ' to not change' - ); +function assertChanges (subject, prop, msg) { + if (msg) flag(this, 'message', msg); + var fn = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi'); + new Assertion(fn, flagMsg, ssfi, true).is.a('function'); + + var initial; + if (!prop) { + new Assertion(subject, flagMsg, ssfi, true).is.a('function'); + initial = subject(); + } else { + new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); + initial = subject[prop]; } - Assertion.addMethod('change', assertChanges); - Assertion.addMethod('changes', assertChanges); - - /** - * ### .increase(subject[, prop[, msg]]) - * - * When one argument is provided, `.increase` asserts that the given function - * `subject` returns a greater number when it's invoked after invoking the - * target function compared to when it's invoked beforehand. `.increase` also - * causes all `.by` assertions that follow in the chain to assert how much - * greater of a number is returned. It's often best to assert that the return - * value increased by the expected amount, rather than asserting it increased - * by any amount. - * - * var val = 1 - * , addTwo = function () { val += 2; } - * , getVal = function () { return val; }; - * - * expect(addTwo).to.increase(getVal).by(2); // Recommended - * expect(addTwo).to.increase(getVal); // Not recommended - * - * When two arguments are provided, `.increase` asserts that the value of the - * given object `subject`'s `prop` property is greater after invoking the - * target function compared to beforehand. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.increase(myObj, 'val'); // Not recommended - * - * Add `.not` earlier in the chain to negate `.increase`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the subject either decreases, or that it stays the same. - * It's often best to identify the exact output that's expected, and then - * write an assertion that only accepts that exact output. - * - * When the subject is expected to decrease, it's often best to assert that it - * decreased by the expected amount. - * - * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended - * - * When the subject is expected to stay the same, it's often best to assert - * exactly that. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.not.change(myObj, 'val'); // Recommended - * expect(noop).to.not.increase(myObj, 'val'); // Not recommended - * - * `.increase` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing two arguments, always - * use the second form. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.increase(myObj, 'val', 'nooo why fail??'); - * - * var val = 1 - * , noop = function () {} - * , getVal = function () { return val; }; - * - * expect(noop, 'nooo why fail??').to.increase(getVal); - * - * The alias `.increases` can be used interchangeably with `.increase`. - * - * @name increase - * @alias increases - * @param {String|Function} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertIncreases (subject, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(fn, flagMsg, ssfi, true).is.a('function'); - - var initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a('function'); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - - // Make sure that the target is a number - new Assertion(initial, flagMsg, ssfi, true).is.a('number'); - - fn(); - - var final = prop === undefined || prop === null ? subject() : subject[prop]; - var msgObj = prop === undefined || prop === null ? initial : '.' + prop; - - flag(this, 'deltaMsgObj', msgObj); - flag(this, 'initialDeltaValue', initial); - flag(this, 'finalDeltaValue', final); - flag(this, 'deltaBehavior', 'increase'); - flag(this, 'realDelta', final - initial); + fn(); + + var final = prop === undefined || prop === null ? subject() : subject[prop]; + var msgObj = prop === undefined || prop === null ? initial : '.' + prop; + + // This gets flagged because of the .by(delta) assertion + flag(this, 'deltaMsgObj', msgObj); + flag(this, 'initialDeltaValue', initial); + flag(this, 'finalDeltaValue', final); + flag(this, 'deltaBehavior', 'change'); + flag(this, 'realDelta', final !== initial); + + this.assert( + initial !== final + , 'expected ' + msgObj + ' to change' + , 'expected ' + msgObj + ' to not change' + ); +} + +Assertion.addMethod('change', assertChanges); +Assertion.addMethod('changes', assertChanges); + +/** + * ### .increase(subject[, prop[, msg]]) + * + * When one argument is provided, `.increase` asserts that the given function + * `subject` returns a greater number when it's invoked after invoking the + * target function compared to when it's invoked beforehand. `.increase` also + * causes all `.by` assertions that follow in the chain to assert how much + * greater of a number is returned. It's often best to assert that the return + * value increased by the expected amount, rather than asserting it increased + * by any amount. + * + * var val = 1 + * , addTwo = function () { val += 2; } + * , getVal = function () { return val; }; + * + * expect(addTwo).to.increase(getVal).by(2); // Recommended + * expect(addTwo).to.increase(getVal); // Not recommended + * + * When two arguments are provided, `.increase` asserts that the value of the + * given object `subject`'s `prop` property is greater after invoking the + * target function compared to beforehand. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; }; + * + * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended + * expect(addTwo).to.increase(myObj, 'val'); // Not recommended + * + * Add `.not` earlier in the chain to negate `.increase`. However, it's + * dangerous to do so. The problem is that it creates uncertain expectations + * by asserting that the subject either decreases, or that it stays the same. + * It's often best to identify the exact output that's expected, and then + * write an assertion that only accepts that exact output. + * + * When the subject is expected to decrease, it's often best to assert that it + * decreased by the expected amount. + * + * var myObj = {val: 1} + * , subtractTwo = function () { myObj.val -= 2; }; + * + * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended + * expect(subtractTwo).to.not.increase(myObj, 'val'); // Not recommended + * + * When the subject is expected to stay the same, it's often best to assert + * exactly that. + * + * var myObj = {val: 1} + * , noop = function () {}; + * + * expect(noop).to.not.change(myObj, 'val'); // Recommended + * expect(noop).to.not.increase(myObj, 'val'); // Not recommended + * + * `.increase` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. When not providing two arguments, always + * use the second form. + * + * var myObj = {val: 1} + * , noop = function () {}; + * + * expect(noop).to.increase(myObj, 'val', 'nooo why fail??'); + * + * var val = 1 + * , noop = function () {} + * , getVal = function () { return val; }; + * + * expect(noop, 'nooo why fail??').to.increase(getVal); + * + * The alias `.increases` can be used interchangeably with `.increase`. + * + * @name increase + * @alias increases + * @param {String|Function} subject + * @param {String} prop name _optional_ + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - this.assert( - final - initial > 0 - , 'expected ' + msgObj + ' to increase' - , 'expected ' + msgObj + ' to not increase' - ); +function assertIncreases (subject, prop, msg) { + if (msg) flag(this, 'message', msg); + var fn = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi'); + new Assertion(fn, flagMsg, ssfi, true).is.a('function'); + + var initial; + if (!prop) { + new Assertion(subject, flagMsg, ssfi, true).is.a('function'); + initial = subject(); + } else { + new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); + initial = subject[prop]; } - Assertion.addMethod('increase', assertIncreases); - Assertion.addMethod('increases', assertIncreases); - - /** - * ### .decrease(subject[, prop[, msg]]) - * - * When one argument is provided, `.decrease` asserts that the given function - * `subject` returns a lesser number when it's invoked after invoking the - * target function compared to when it's invoked beforehand. `.decrease` also - * causes all `.by` assertions that follow in the chain to assert how much - * lesser of a number is returned. It's often best to assert that the return - * value decreased by the expected amount, rather than asserting it decreased - * by any amount. - * - * var val = 1 - * , subtractTwo = function () { val -= 2; } - * , getVal = function () { return val; }; - * - * expect(subtractTwo).to.decrease(getVal).by(2); // Recommended - * expect(subtractTwo).to.decrease(getVal); // Not recommended - * - * When two arguments are provided, `.decrease` asserts that the value of the - * given object `subject`'s `prop` property is lesser after invoking the - * target function compared to beforehand. - * - * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.decrease(myObj, 'val'); // Not recommended - * - * Add `.not` earlier in the chain to negate `.decrease`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the subject either increases, or that it stays the same. - * It's often best to identify the exact output that's expected, and then - * write an assertion that only accepts that exact output. - * - * When the subject is expected to increase, it's often best to assert that it - * increased by the expected amount. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.not.decrease(myObj, 'val'); // Not recommended - * - * When the subject is expected to stay the same, it's often best to assert - * exactly that. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.not.change(myObj, 'val'); // Recommended - * expect(noop).to.not.decrease(myObj, 'val'); // Not recommended - * - * `.decrease` accepts an optional `msg` argument which is a custom error - * message to show when the assertion fails. The message can also be given as - * the second argument to `expect`. When not providing two arguments, always - * use the second form. - * - * var myObj = {val: 1} - * , noop = function () {}; - * - * expect(noop).to.decrease(myObj, 'val', 'nooo why fail??'); - * - * var val = 1 - * , noop = function () {} - * , getVal = function () { return val; }; - * - * expect(noop, 'nooo why fail??').to.decrease(getVal); - * - * The alias `.decreases` can be used interchangeably with `.decrease`. - * - * @name decrease - * @alias decreases - * @param {String|Function} subject - * @param {String} prop name _optional_ - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertDecreases (subject, prop, msg) { - if (msg) flag(this, 'message', msg); - var fn = flag(this, 'object') - , flagMsg = flag(this, 'message') - , ssfi = flag(this, 'ssfi'); - new Assertion(fn, flagMsg, ssfi, true).is.a('function'); - - var initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a('function'); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - - // Make sure that the target is a number - new Assertion(initial, flagMsg, ssfi, true).is.a('number'); - - fn(); - - var final = prop === undefined || prop === null ? subject() : subject[prop]; - var msgObj = prop === undefined || prop === null ? initial : '.' + prop; - - flag(this, 'deltaMsgObj', msgObj); - flag(this, 'initialDeltaValue', initial); - flag(this, 'finalDeltaValue', final); - flag(this, 'deltaBehavior', 'decrease'); - flag(this, 'realDelta', initial - final); + // Make sure that the target is a number + new Assertion(initial, flagMsg, ssfi, true).is.a('number'); + + fn(); + + var final = prop === undefined || prop === null ? subject() : subject[prop]; + var msgObj = prop === undefined || prop === null ? initial : '.' + prop; + + flag(this, 'deltaMsgObj', msgObj); + flag(this, 'initialDeltaValue', initial); + flag(this, 'finalDeltaValue', final); + flag(this, 'deltaBehavior', 'increase'); + flag(this, 'realDelta', final - initial); + + this.assert( + final - initial > 0 + , 'expected ' + msgObj + ' to increase' + , 'expected ' + msgObj + ' to not increase' + ); +} + +Assertion.addMethod('increase', assertIncreases); +Assertion.addMethod('increases', assertIncreases); + +/** + * ### .decrease(subject[, prop[, msg]]) + * + * When one argument is provided, `.decrease` asserts that the given function + * `subject` returns a lesser number when it's invoked after invoking the + * target function compared to when it's invoked beforehand. `.decrease` also + * causes all `.by` assertions that follow in the chain to assert how much + * lesser of a number is returned. It's often best to assert that the return + * value decreased by the expected amount, rather than asserting it decreased + * by any amount. + * + * var val = 1 + * , subtractTwo = function () { val -= 2; } + * , getVal = function () { return val; }; + * + * expect(subtractTwo).to.decrease(getVal).by(2); // Recommended + * expect(subtractTwo).to.decrease(getVal); // Not recommended + * + * When two arguments are provided, `.decrease` asserts that the value of the + * given object `subject`'s `prop` property is lesser after invoking the + * target function compared to beforehand. + * + * var myObj = {val: 1} + * , subtractTwo = function () { myObj.val -= 2; }; + * + * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended + * expect(subtractTwo).to.decrease(myObj, 'val'); // Not recommended + * + * Add `.not` earlier in the chain to negate `.decrease`. However, it's + * dangerous to do so. The problem is that it creates uncertain expectations + * by asserting that the subject either increases, or that it stays the same. + * It's often best to identify the exact output that's expected, and then + * write an assertion that only accepts that exact output. + * + * When the subject is expected to increase, it's often best to assert that it + * increased by the expected amount. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; }; + * + * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended + * expect(addTwo).to.not.decrease(myObj, 'val'); // Not recommended + * + * When the subject is expected to stay the same, it's often best to assert + * exactly that. + * + * var myObj = {val: 1} + * , noop = function () {}; + * + * expect(noop).to.not.change(myObj, 'val'); // Recommended + * expect(noop).to.not.decrease(myObj, 'val'); // Not recommended + * + * `.decrease` accepts an optional `msg` argument which is a custom error + * message to show when the assertion fails. The message can also be given as + * the second argument to `expect`. When not providing two arguments, always + * use the second form. + * + * var myObj = {val: 1} + * , noop = function () {}; + * + * expect(noop).to.decrease(myObj, 'val', 'nooo why fail??'); + * + * var val = 1 + * , noop = function () {} + * , getVal = function () { return val; }; + * + * expect(noop, 'nooo why fail??').to.decrease(getVal); + * + * The alias `.decreases` can be used interchangeably with `.decrease`. + * + * @name decrease + * @alias decreases + * @param {String|Function} subject + * @param {String} prop name _optional_ + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - this.assert( - final - initial < 0 - , 'expected ' + msgObj + ' to decrease' - , 'expected ' + msgObj + ' to not decrease' - ); +function assertDecreases (subject, prop, msg) { + if (msg) flag(this, 'message', msg); + var fn = flag(this, 'object') + , flagMsg = flag(this, 'message') + , ssfi = flag(this, 'ssfi'); + new Assertion(fn, flagMsg, ssfi, true).is.a('function'); + + var initial; + if (!prop) { + new Assertion(subject, flagMsg, ssfi, true).is.a('function'); + initial = subject(); + } else { + new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); + initial = subject[prop]; } - Assertion.addMethod('decrease', assertDecreases); - Assertion.addMethod('decreases', assertDecreases); - - /** - * ### .by(delta[, msg]) - * - * When following an `.increase` assertion in the chain, `.by` asserts that - * the subject of the `.increase` assertion increased by the given `delta`. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); - * - * When following a `.decrease` assertion in the chain, `.by` asserts that the - * subject of the `.decrease` assertion decreased by the given `delta`. - * - * var myObj = {val: 1} - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); - * - * When following a `.change` assertion in the chain, `.by` asserts that the - * subject of the `.change` assertion either increased or decreased by the - * given `delta`. However, it's dangerous to use `.change.by`. The problem is - * that it creates uncertain expectations. It's often best to identify the - * exact output that's expected, and then write an assertion that only accepts - * that exact output. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; } - * , subtractTwo = function () { myObj.val -= 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended - * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended - * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended - * - * Add `.not` earlier in the chain to negate `.by`. However, it's often best - * to assert that the subject changed by its expected delta, rather than - * asserting that it didn't change by one of countless unexpected deltas. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * // Recommended - * expect(addTwo).to.increase(myObj, 'val').by(2); - * - * // Not recommended - * expect(addTwo).to.increase(myObj, 'val').but.not.by(3); - * - * `.by` accepts an optional `msg` argument which is a custom error message to - * show when the assertion fails. The message can also be given as the second - * argument to `expect`. - * - * var myObj = {val: 1} - * , addTwo = function () { myObj.val += 2; }; - * - * expect(addTwo).to.increase(myObj, 'val').by(3, 'nooo why fail??'); - * expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3); - * - * @name by - * @param {Number} delta - * @param {String} msg _optional_ - * @namespace BDD - * @api public - */ - - function assertDelta(delta, msg) { - if (msg) flag(this, 'message', msg); - - var msgObj = flag(this, 'deltaMsgObj'); - var initial = flag(this, 'initialDeltaValue'); - var final = flag(this, 'finalDeltaValue'); - var behavior = flag(this, 'deltaBehavior'); - var realDelta = flag(this, 'realDelta'); - - var expression; - if (behavior === 'change') { - expression = Math.abs(final - initial) === Math.abs(delta); - } else { - expression = realDelta === Math.abs(delta); - } + // Make sure that the target is a number + new Assertion(initial, flagMsg, ssfi, true).is.a('number'); + + fn(); + + var final = prop === undefined || prop === null ? subject() : subject[prop]; + var msgObj = prop === undefined || prop === null ? initial : '.' + prop; + + flag(this, 'deltaMsgObj', msgObj); + flag(this, 'initialDeltaValue', initial); + flag(this, 'finalDeltaValue', final); + flag(this, 'deltaBehavior', 'decrease'); + flag(this, 'realDelta', initial - final); + + this.assert( + final - initial < 0 + , 'expected ' + msgObj + ' to decrease' + , 'expected ' + msgObj + ' to not decrease' + ); +} + +Assertion.addMethod('decrease', assertDecreases); +Assertion.addMethod('decreases', assertDecreases); + +/** + * ### .by(delta[, msg]) + * + * When following an `.increase` assertion in the chain, `.by` asserts that + * the subject of the `.increase` assertion increased by the given `delta`. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; }; + * + * expect(addTwo).to.increase(myObj, 'val').by(2); + * + * When following a `.decrease` assertion in the chain, `.by` asserts that the + * subject of the `.decrease` assertion decreased by the given `delta`. + * + * var myObj = {val: 1} + * , subtractTwo = function () { myObj.val -= 2; }; + * + * expect(subtractTwo).to.decrease(myObj, 'val').by(2); + * + * When following a `.change` assertion in the chain, `.by` asserts that the + * subject of the `.change` assertion either increased or decreased by the + * given `delta`. However, it's dangerous to use `.change.by`. The problem is + * that it creates uncertain expectations. It's often best to identify the + * exact output that's expected, and then write an assertion that only accepts + * that exact output. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; } + * , subtractTwo = function () { myObj.val -= 2; }; + * + * expect(addTwo).to.increase(myObj, 'val').by(2); // Recommended + * expect(addTwo).to.change(myObj, 'val').by(2); // Not recommended + * + * expect(subtractTwo).to.decrease(myObj, 'val').by(2); // Recommended + * expect(subtractTwo).to.change(myObj, 'val').by(2); // Not recommended + * + * Add `.not` earlier in the chain to negate `.by`. However, it's often best + * to assert that the subject changed by its expected delta, rather than + * asserting that it didn't change by one of countless unexpected deltas. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; }; + * + * // Recommended + * expect(addTwo).to.increase(myObj, 'val').by(2); + * + * // Not recommended + * expect(addTwo).to.increase(myObj, 'val').but.not.by(3); + * + * `.by` accepts an optional `msg` argument which is a custom error message to + * show when the assertion fails. The message can also be given as the second + * argument to `expect`. + * + * var myObj = {val: 1} + * , addTwo = function () { myObj.val += 2; }; + * + * expect(addTwo).to.increase(myObj, 'val').by(3, 'nooo why fail??'); + * expect(addTwo, 'nooo why fail??').to.increase(myObj, 'val').by(3); + * + * @name by + * @param {Number} delta + * @param {String} msg _optional_ + * @namespace BDD + * @api public + */ - this.assert( - expression - , 'expected ' + msgObj + ' to ' + behavior + ' by ' + delta - , 'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta - ); - } +function assertDelta(delta, msg) { + if (msg) flag(this, 'message', msg); - Assertion.addMethod('by', assertDelta); - - /** - * ### .extensible - * - * Asserts that the target is extensible, which means that new properties can - * be added to it. Primitives are never extensible. - * - * expect({a: 1}).to.be.extensible; - * - * Add `.not` earlier in the chain to negate `.extensible`. - * - * var nonExtensibleObject = Object.preventExtensions({}) - * , sealedObject = Object.seal({}) - * , frozenObject = Object.freeze({}); - * - * expect(nonExtensibleObject).to.not.be.extensible; - * expect(sealedObject).to.not.be.extensible; - * expect(frozenObject).to.not.be.extensible; - * expect(1).to.not.be.extensible; - * - * A custom error message can be given as the second argument to `expect`. - * - * expect(1, 'nooo why fail??').to.be.extensible; - * - * @name extensible - * @namespace BDD - * @api public - */ - - Assertion.addProperty('extensible', function() { - var obj = flag(this, 'object'); - - // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. - // In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false. - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible - // The following provides ES6 behavior for ES5 environments. - - var isExtensible = obj === Object(obj) && Object.isExtensible(obj); + var msgObj = flag(this, 'deltaMsgObj'); + var initial = flag(this, 'initialDeltaValue'); + var final = flag(this, 'finalDeltaValue'); + var behavior = flag(this, 'deltaBehavior'); + var realDelta = flag(this, 'realDelta'); - this.assert( - isExtensible - , 'expected #{this} to be extensible' - , 'expected #{this} to not be extensible' - ); - }); + var expression; + if (behavior === 'change') { + expression = Math.abs(final - initial) === Math.abs(delta); + } else { + expression = realDelta === Math.abs(delta); + } - /** - * ### .sealed - * - * Asserts that the target is sealed, which means that new properties can't be - * added to it, and its existing properties can't be reconfigured or deleted. - * However, it's possible that its existing properties can still be reassigned - * to different values. Primitives are always sealed. - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * expect(sealedObject).to.be.sealed; - * expect(frozenObject).to.be.sealed; - * expect(1).to.be.sealed; - * - * Add `.not` earlier in the chain to negate `.sealed`. - * - * expect({a: 1}).to.not.be.sealed; - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({a: 1}, 'nooo why fail??').to.be.sealed; - * - * @name sealed - * @namespace BDD - * @api public - */ - - Assertion.addProperty('sealed', function() { - var obj = flag(this, 'object'); - - // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. - // In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true. - // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed - // The following provides ES6 behavior for ES5 environments. - - var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true; + this.assert( + expression + , 'expected ' + msgObj + ' to ' + behavior + ' by ' + delta + , 'expected ' + msgObj + ' to not ' + behavior + ' by ' + delta + ); +} + +Assertion.addMethod('by', assertDelta); + +/** + * ### .extensible + * + * Asserts that the target is extensible, which means that new properties can + * be added to it. Primitives are never extensible. + * + * expect({a: 1}).to.be.extensible; + * + * Add `.not` earlier in the chain to negate `.extensible`. + * + * var nonExtensibleObject = Object.preventExtensions({}) + * , sealedObject = Object.seal({}) + * , frozenObject = Object.freeze({}); + * + * expect(nonExtensibleObject).to.not.be.extensible; + * expect(sealedObject).to.not.be.extensible; + * expect(frozenObject).to.not.be.extensible; + * expect(1).to.not.be.extensible; + * + * A custom error message can be given as the second argument to `expect`. + * + * expect(1, 'nooo why fail??').to.be.extensible; + * + * @name extensible + * @namespace BDD + * @api public + */ - this.assert( - isSealed - , 'expected #{this} to be sealed' - , 'expected #{this} to not be sealed' - ); - }); +Assertion.addProperty('extensible', function() { + var obj = flag(this, 'object'); + + // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. + // In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false. + // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible + // The following provides ES6 behavior for ES5 environments. + + var isExtensible = obj === Object(obj) && Object.isExtensible(obj); + + this.assert( + isExtensible + , 'expected #{this} to be extensible' + , 'expected #{this} to not be extensible' + ); +}); + +/** + * ### .sealed + * + * Asserts that the target is sealed, which means that new properties can't be + * added to it, and its existing properties can't be reconfigured or deleted. + * However, it's possible that its existing properties can still be reassigned + * to different values. Primitives are always sealed. + * + * var sealedObject = Object.seal({}); + * var frozenObject = Object.freeze({}); + * + * expect(sealedObject).to.be.sealed; + * expect(frozenObject).to.be.sealed; + * expect(1).to.be.sealed; + * + * Add `.not` earlier in the chain to negate `.sealed`. + * + * expect({a: 1}).to.not.be.sealed; + * + * A custom error message can be given as the second argument to `expect`. + * + * expect({a: 1}, 'nooo why fail??').to.be.sealed; + * + * @name sealed + * @namespace BDD + * @api public + */ - /** - * ### .frozen - * - * Asserts that the target is frozen, which means that new properties can't be - * added to it, and its existing properties can't be reassigned to different - * values, reconfigured, or deleted. Primitives are always frozen. - * - * var frozenObject = Object.freeze({}); - * - * expect(frozenObject).to.be.frozen; - * expect(1).to.be.frozen; - * - * Add `.not` earlier in the chain to negate `.frozen`. - * - * expect({a: 1}).to.not.be.frozen; - * - * A custom error message can be given as the second argument to `expect`. - * - * expect({a: 1}, 'nooo why fail??').to.be.frozen; - * - * @name frozen - * @namespace BDD - * @api public - */ - - Assertion.addProperty('frozen', function() { - var obj = flag(this, 'object'); - - // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. - // In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true. - // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen - // The following provides ES6 behavior for ES5 environments. - - var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true; +Assertion.addProperty('sealed', function() { + var obj = flag(this, 'object'); + + // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. + // In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true. + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed + // The following provides ES6 behavior for ES5 environments. + + var isSealed = obj === Object(obj) ? Object.isSealed(obj) : true; + + this.assert( + isSealed + , 'expected #{this} to be sealed' + , 'expected #{this} to not be sealed' + ); +}); + +/** + * ### .frozen + * + * Asserts that the target is frozen, which means that new properties can't be + * added to it, and its existing properties can't be reassigned to different + * values, reconfigured, or deleted. Primitives are always frozen. + * + * var frozenObject = Object.freeze({}); + * + * expect(frozenObject).to.be.frozen; + * expect(1).to.be.frozen; + * + * Add `.not` earlier in the chain to negate `.frozen`. + * + * expect({a: 1}).to.not.be.frozen; + * + * A custom error message can be given as the second argument to `expect`. + * + * expect({a: 1}, 'nooo why fail??').to.be.frozen; + * + * @name frozen + * @namespace BDD + * @api public + */ - this.assert( - isFrozen - , 'expected #{this} to be frozen' - , 'expected #{this} to not be frozen' - ); - }); +Assertion.addProperty('frozen', function() { + var obj = flag(this, 'object'); + + // In ES5, if the argument to this method is a primitive, then it will cause a TypeError. + // In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true. + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen + // The following provides ES6 behavior for ES5 environments. + + var isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true; + + this.assert( + isFrozen + , 'expected #{this} to be frozen' + , 'expected #{this} to not be frozen' + ); +}); + +/** + * ### .finite + * + * Asserts that the target is a number, and isn't `NaN` or positive/negative + * `Infinity`. + * + * expect(1).to.be.finite; + * + * Add `.not` earlier in the chain to negate `.finite`. However, it's + * dangerous to do so. The problem is that it creates uncertain expectations + * by asserting that the subject either isn't a number, or that it's `NaN`, or + * that it's positive `Infinity`, or that it's negative `Infinity`. It's often + * best to identify the exact output that's expected, and then write an + * assertion that only accepts that exact output. + * + * When the target isn't expected to be a number, it's often best to assert + * that it's the expected type, rather than asserting that it isn't one of + * many unexpected types. + * + * expect('foo').to.be.a('string'); // Recommended + * expect('foo').to.not.be.finite; // Not recommended + * + * When the target is expected to be `NaN`, it's often best to assert exactly + * that. + * + * expect(NaN).to.be.NaN; // Recommended + * expect(NaN).to.not.be.finite; // Not recommended + * + * When the target is expected to be positive infinity, it's often best to + * assert exactly that. + * + * expect(Infinity).to.equal(Infinity); // Recommended + * expect(Infinity).to.not.be.finite; // Not recommended + * + * When the target is expected to be negative infinity, it's often best to + * assert exactly that. + * + * expect(-Infinity).to.equal(-Infinity); // Recommended + * expect(-Infinity).to.not.be.finite; // Not recommended + * + * A custom error message can be given as the second argument to `expect`. + * + * expect('foo', 'nooo why fail??').to.be.finite; + * + * @name finite + * @namespace BDD + * @api public + */ - /** - * ### .finite - * - * Asserts that the target is a number, and isn't `NaN` or positive/negative - * `Infinity`. - * - * expect(1).to.be.finite; - * - * Add `.not` earlier in the chain to negate `.finite`. However, it's - * dangerous to do so. The problem is that it creates uncertain expectations - * by asserting that the subject either isn't a number, or that it's `NaN`, or - * that it's positive `Infinity`, or that it's negative `Infinity`. It's often - * best to identify the exact output that's expected, and then write an - * assertion that only accepts that exact output. - * - * When the target isn't expected to be a number, it's often best to assert - * that it's the expected type, rather than asserting that it isn't one of - * many unexpected types. - * - * expect('foo').to.be.a('string'); // Recommended - * expect('foo').to.not.be.finite; // Not recommended - * - * When the target is expected to be `NaN`, it's often best to assert exactly - * that. - * - * expect(NaN).to.be.NaN; // Recommended - * expect(NaN).to.not.be.finite; // Not recommended - * - * When the target is expected to be positive infinity, it's often best to - * assert exactly that. - * - * expect(Infinity).to.equal(Infinity); // Recommended - * expect(Infinity).to.not.be.finite; // Not recommended - * - * When the target is expected to be negative infinity, it's often best to - * assert exactly that. - * - * expect(-Infinity).to.equal(-Infinity); // Recommended - * expect(-Infinity).to.not.be.finite; // Not recommended - * - * A custom error message can be given as the second argument to `expect`. - * - * expect('foo', 'nooo why fail??').to.be.finite; - * - * @name finite - * @namespace BDD - * @api public - */ - - Assertion.addProperty('finite', function(msg) { - var obj = flag(this, 'object'); +Assertion.addProperty('finite', function(msg) { + var obj = flag(this, 'object'); - this.assert( - typeof obj === 'number' && isFinite(obj) - , 'expected #{this} to be a finite number' - , 'expected #{this} to not be a finite number' - ); - }); -}; + this.assert( + typeof obj === 'number' && isFinite(obj) + , 'expected #{this} to be a finite number' + , 'expected #{this} to not be a finite number' + ); +}); diff --git a/lib/chai/interface/assert.js b/lib/chai/interface/assert.js index 11b3c25e6..fed7a54a0 100644 --- a/lib/chai/interface/assert.js +++ b/lib/chai/interface/assert.js @@ -4,3110 +4,3103 @@ * MIT Licensed */ -module.exports = function (chai, util) { - /*! - * Chai dependencies. - */ - - var Assertion = chai.Assertion - , flag = util.flag; - - /*! - * Module export. - */ - - /** - * ### assert(expression, message) - * - * Write your own test expressions. - * - * assert('foo' !== 'bar', 'foo is not bar'); - * assert(Array.isArray([]), 'empty arrays are arrays'); - * - * @param {Mixed} expression to test for truthiness - * @param {String} message to display on error - * @name assert - * @namespace Assert - * @api public - */ - - var assert = chai.assert = function (express, errmsg) { - var test = new Assertion(null, null, chai.assert, true); - test.assert( - express - , errmsg - , '[ negation message unavailable ]' - ); - }; - - /** - * ### .fail([message]) - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. Node.js `assert` module-compatible. - * - * assert.fail(); - * assert.fail("custom error message"); - * assert.fail(1, 2); - * assert.fail(1, 2, "custom error message"); - * assert.fail(1, 2, "custom error message", ">"); - * assert.fail(1, 2, undefined, ">"); - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @namespace Assert - * @api public - */ - - assert.fail = function (actual, expected, message, operator) { - if (arguments.length < 2) { - // Comply with Node's fail([message]) interface - - message = actual; - actual = undefined; - } - - message = message || 'assert.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, assert.fail); - }; - - /** - * ### .isOk(object, [message]) - * - * Asserts that `object` is truthy. - * - * assert.isOk('everything', 'everything is ok'); - * assert.isOk(false, 'this will fail'); - * - * @name isOk - * @alias ok - * @param {Mixed} object to test - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isOk = function (val, msg) { - new Assertion(val, msg, assert.isOk, true).is.ok; - }; - - /** - * ### .isNotOk(object, [message]) - * - * Asserts that `object` is falsy. - * - * assert.isNotOk('everything', 'this will fail'); - * assert.isNotOk(false, 'this will pass'); - * - * @name isNotOk - * @alias notOk - * @param {Mixed} object to test - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotOk = function (val, msg) { - new Assertion(val, msg, assert.isNotOk, true).is.not.ok; - }; - - /** - * ### .equal(actual, expected, [message]) - * - * Asserts non-strict equality (`==`) of `actual` and `expected`. - * - * assert.equal(3, '3', '== coerces values to strings'); - * - * @name equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.equal = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.equal, true); - - test.assert( - exp == flag(test, 'object') - , 'expected #{this} to equal #{exp}' - , 'expected #{this} to not equal #{act}' - , exp - , act - , true - ); - }; - - /** - * ### .notEqual(actual, expected, [message]) - * - * Asserts non-strict inequality (`!=`) of `actual` and `expected`. - * - * assert.notEqual(3, 4, 'these numbers are not equal'); - * - * @name notEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notEqual = function (act, exp, msg) { - var test = new Assertion(act, msg, assert.notEqual, true); - - test.assert( - exp != flag(test, 'object') - , 'expected #{this} to not equal #{exp}' - , 'expected #{this} to equal #{act}' - , exp - , act - , true - ); - }; - - /** - * ### .strictEqual(actual, expected, [message]) - * - * Asserts strict equality (`===`) of `actual` and `expected`. - * - * assert.strictEqual(true, true, 'these booleans are strictly equal'); - * - * @name strictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.strictEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.strictEqual, true).to.equal(exp); - }; - - /** - * ### .notStrictEqual(actual, expected, [message]) - * - * Asserts strict inequality (`!==`) of `actual` and `expected`. - * - * assert.notStrictEqual(3, '3', 'no coercion for strict equality'); - * - * @name notStrictEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notStrictEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp); - }; - - /** - * ### .deepEqual(actual, expected, [message]) - * - * Asserts that `actual` is deeply equal to `expected`. - * - * assert.deepEqual({ tea: 'green' }, { tea: 'green' }); - * - * @name deepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @alias deepStrictEqual - * @namespace Assert - * @api public - */ - - assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.deepEqual, true).to.eql(exp); - }; - - /** - * ### .notDeepEqual(actual, expected, [message]) - * - * Assert that `actual` is not deeply equal to `expected`. - * - * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' }); - * - * @name notDeepEqual - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepEqual = function (act, exp, msg) { - new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp); - }; - - /** - * ### .isAbove(valueToCheck, valueToBeAbove, [message]) - * - * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`. - * - * assert.isAbove(5, 2, '5 is strictly greater than 2'); - * - * @name isAbove - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAbove - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isAbove = function (val, abv, msg) { - new Assertion(val, msg, assert.isAbove, true).to.be.above(abv); - }; - - /** - * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message]) - * - * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`. - * - * assert.isAtLeast(5, 2, '5 is greater or equal to 2'); - * assert.isAtLeast(3, 3, '3 is greater or equal to 3'); - * - * @name isAtLeast - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAtLeast - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isAtLeast = function (val, atlst, msg) { - new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst); - }; - - /** - * ### .isBelow(valueToCheck, valueToBeBelow, [message]) - * - * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`. - * - * assert.isBelow(3, 6, '3 is strictly less than 6'); - * - * @name isBelow - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeBelow - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isBelow = function (val, blw, msg) { - new Assertion(val, msg, assert.isBelow, true).to.be.below(blw); - }; - - /** - * ### .isAtMost(valueToCheck, valueToBeAtMost, [message]) - * - * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`. - * - * assert.isAtMost(3, 6, '3 is less than or equal to 6'); - * assert.isAtMost(4, 4, '4 is less than or equal to 4'); - * - * @name isAtMost - * @param {Mixed} valueToCheck - * @param {Mixed} valueToBeAtMost - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isAtMost = function (val, atmst, msg) { - new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst); - }; - - /** - * ### .isTrue(value, [message]) - * - * Asserts that `value` is true. - * - * var teaServed = true; - * assert.isTrue(teaServed, 'the tea has been served'); - * - * @name isTrue - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isTrue = function (val, msg) { - new Assertion(val, msg, assert.isTrue, true).is['true']; - }; - - /** - * ### .isNotTrue(value, [message]) - * - * Asserts that `value` is not true. - * - * var tea = 'tasty chai'; - * assert.isNotTrue(tea, 'great, time for tea!'); - * - * @name isNotTrue - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotTrue = function (val, msg) { - new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true); - }; - - /** - * ### .isFalse(value, [message]) - * - * Asserts that `value` is false. - * - * var teaServed = false; - * assert.isFalse(teaServed, 'no tea yet? hmm...'); - * - * @name isFalse - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isFalse = function (val, msg) { - new Assertion(val, msg, assert.isFalse, true).is['false']; - }; - - /** - * ### .isNotFalse(value, [message]) - * - * Asserts that `value` is not false. - * - * var tea = 'tasty chai'; - * assert.isNotFalse(tea, 'great, time for tea!'); - * - * @name isNotFalse - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotFalse = function (val, msg) { - new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false); - }; - - /** - * ### .isNull(value, [message]) - * - * Asserts that `value` is null. - * - * assert.isNull(err, 'there was no error'); - * - * @name isNull - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNull = function (val, msg) { - new Assertion(val, msg, assert.isNull, true).to.equal(null); - }; - - /** - * ### .isNotNull(value, [message]) - * - * Asserts that `value` is not null. - * - * var tea = 'tasty chai'; - * assert.isNotNull(tea, 'great, time for tea!'); - * - * @name isNotNull - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotNull = function (val, msg) { - new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null); - }; - - /** - * ### .isNaN - * - * Asserts that value is NaN. - * - * assert.isNaN(NaN, 'NaN is NaN'); - * - * @name isNaN - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNaN = function (val, msg) { - new Assertion(val, msg, assert.isNaN, true).to.be.NaN; - }; - - /** - * ### .isNotNaN - * - * Asserts that value is not NaN. - * - * assert.isNotNaN(4, '4 is not NaN'); - * - * @name isNotNaN - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - assert.isNotNaN = function (val, msg) { - new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN; - }; - - /** - * ### .exists - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var foo = 'hi'; - * - * assert.exists(foo, 'foo is neither `null` nor `undefined`'); - * - * @name exists - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.exists = function (val, msg) { - new Assertion(val, msg, assert.exists, true).to.exist; - }; - - /** - * ### .notExists - * - * Asserts that the target is either `null` or `undefined`. - * - * var bar = null - * , baz; - * - * assert.notExists(bar); - * assert.notExists(baz, 'baz is either null or undefined'); - * - * @name notExists - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notExists = function (val, msg) { - new Assertion(val, msg, assert.notExists, true).to.not.exist; - }; - - /** - * ### .isUndefined(value, [message]) - * - * Asserts that `value` is `undefined`. - * - * var tea; - * assert.isUndefined(tea, 'no tea defined'); - * - * @name isUndefined - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isUndefined = function (val, msg) { - new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined); - }; - - /** - * ### .isDefined(value, [message]) - * - * Asserts that `value` is not `undefined`. - * - * var tea = 'cup of chai'; - * assert.isDefined(tea, 'tea has been defined'); - * - * @name isDefined - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isDefined = function (val, msg) { - new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined); - }; - - /** - * ### .isFunction(value, [message]) - * - * Asserts that `value` is a function. - * - * function serveTea() { return 'cup of tea'; }; - * assert.isFunction(serveTea, 'great, we can have tea now'); - * - * @name isFunction - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isFunction = function (val, msg) { - new Assertion(val, msg, assert.isFunction, true).to.be.a('function'); - }; - - /** - * ### .isNotFunction(value, [message]) - * - * Asserts that `value` is _not_ a function. - * - * var serveTea = [ 'heat', 'pour', 'sip' ]; - * assert.isNotFunction(serveTea, 'great, we have listed the steps'); - * - * @name isNotFunction - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotFunction = function (val, msg) { - new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a('function'); - }; - - /** - * ### .isObject(value, [message]) - * - * Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`). - * _The assertion does not match subclassed objects._ - * - * var selection = { name: 'Chai', serve: 'with spices' }; - * assert.isObject(selection, 'tea selection is an object'); - * - * @name isObject - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isObject = function (val, msg) { - new Assertion(val, msg, assert.isObject, true).to.be.a('object'); - }; - - /** - * ### .isNotObject(value, [message]) - * - * Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`). - * - * var selection = 'chai' - * assert.isNotObject(selection, 'tea selection is not an object'); - * assert.isNotObject(null, 'null is not an object'); - * - * @name isNotObject - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotObject = function (val, msg) { - new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object'); - }; - - /** - * ### .isArray(value, [message]) - * - * Asserts that `value` is an array. - * - * var menu = [ 'green', 'chai', 'oolong' ]; - * assert.isArray(menu, 'what kind of tea do we want?'); - * - * @name isArray - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isArray = function (val, msg) { - new Assertion(val, msg, assert.isArray, true).to.be.an('array'); - }; - - /** - * ### .isNotArray(value, [message]) - * - * Asserts that `value` is _not_ an array. - * - * var menu = 'green|chai|oolong'; - * assert.isNotArray(menu, 'what kind of tea do we want?'); - * - * @name isNotArray - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotArray = function (val, msg) { - new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array'); - }; - - /** - * ### .isString(value, [message]) - * - * Asserts that `value` is a string. - * - * var teaOrder = 'chai'; - * assert.isString(teaOrder, 'order placed'); - * - * @name isString - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isString = function (val, msg) { - new Assertion(val, msg, assert.isString, true).to.be.a('string'); - }; - - /** - * ### .isNotString(value, [message]) - * - * Asserts that `value` is _not_ a string. - * - * var teaOrder = 4; - * assert.isNotString(teaOrder, 'order placed'); - * - * @name isNotString - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotString = function (val, msg) { - new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string'); - }; - - /** - * ### .isNumber(value, [message]) - * - * Asserts that `value` is a number. - * - * var cups = 2; - * assert.isNumber(cups, 'how many cups'); - * - * @name isNumber - * @param {Number} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNumber = function (val, msg) { - new Assertion(val, msg, assert.isNumber, true).to.be.a('number'); - }; - - /** - * ### .isNotNumber(value, [message]) - * - * Asserts that `value` is _not_ a number. - * - * var cups = '2 cups please'; - * assert.isNotNumber(cups, 'how many cups'); - * - * @name isNotNumber - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotNumber = function (val, msg) { - new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number'); - }; - - /** - * ### .isFinite(value, [message]) - * - * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. - * - * var cups = 2; - * assert.isFinite(cups, 'how many cups'); - * - * assert.isFinite(NaN); // throws - * - * @name isFinite - * @param {Number} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isFinite = function (val, msg) { - new Assertion(val, msg, assert.isFinite, true).to.be.finite; - }; - - /** - * ### .isBoolean(value, [message]) - * - * Asserts that `value` is a boolean. - * - * var teaReady = true - * , teaServed = false; - * - * assert.isBoolean(teaReady, 'is the tea ready'); - * assert.isBoolean(teaServed, 'has tea been served'); - * - * @name isBoolean - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isBoolean = function (val, msg) { - new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean'); - }; - - /** - * ### .isNotBoolean(value, [message]) - * - * Asserts that `value` is _not_ a boolean. - * - * var teaReady = 'yep' - * , teaServed = 'nope'; - * - * assert.isNotBoolean(teaReady, 'is the tea ready'); - * assert.isNotBoolean(teaServed, 'has tea been served'); - * - * @name isNotBoolean - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.isNotBoolean = function (val, msg) { - new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean'); - }; - - /** - * ### .typeOf(value, name, [message]) - * - * Asserts that `value`'s type is `name`, as determined by - * `Object.prototype.toString`. - * - * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object'); - * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array'); - * assert.typeOf('tea', 'string', 'we have a string'); - * assert.typeOf(/tea/, 'regexp', 'we have a regular expression'); - * assert.typeOf(null, 'null', 'we have a null'); - * assert.typeOf(undefined, 'undefined', 'we have an undefined'); - * - * @name typeOf - * @param {Mixed} value - * @param {String} name - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.typeOf = function (val, type, msg) { - new Assertion(val, msg, assert.typeOf, true).to.be.a(type); - }; - - /** - * ### .notTypeOf(value, name, [message]) - * - * Asserts that `value`'s type is _not_ `name`, as determined by - * `Object.prototype.toString`. - * - * assert.notTypeOf('tea', 'number', 'strings are not numbers'); - * - * @name notTypeOf - * @param {Mixed} value - * @param {String} typeof name - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notTypeOf = function (val, type, msg) { - new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type); - }; - - /** - * ### .instanceOf(object, constructor, [message]) - * - * Asserts that `value` is an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new Tea('chai'); - * - * assert.instanceOf(chai, Tea, 'chai is an instance of tea'); - * - * @name instanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.instanceOf = function (val, type, msg) { - new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type); - }; - - /** - * ### .notInstanceOf(object, constructor, [message]) - * - * Asserts `value` is not an instance of `constructor`. - * - * var Tea = function (name) { this.name = name; } - * , chai = new String('chai'); - * - * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea'); - * - * @name notInstanceOf - * @param {Object} object - * @param {Constructor} constructor - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notInstanceOf = function (val, type, msg) { - new Assertion(val, msg, assert.notInstanceOf, true) - .to.not.be.instanceOf(type); - }; - - /** - * ### .include(haystack, needle, [message]) - * - * Asserts that `haystack` includes `needle`. Can be used to assert the - * inclusion of a value in an array, a substring in a string, or a subset of - * properties in an object. - * - * assert.include([1,2,3], 2, 'array contains value'); - * assert.include('foobar', 'foo', 'string contains substring'); - * assert.include({ foo: 'bar', hello: 'universe' }, { foo: 'bar' }, 'object contains property'); - * - * Strict equality (===) is used. When asserting the inclusion of a value in - * an array, the array is searched for an element that's strictly equal to the - * given value. When asserting a subset of properties in an object, the object - * is searched for the given property keys, checking that each one is present - * and strictly equal to the given property value. For instance: - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.include([obj1, obj2], obj1); - * assert.include({foo: obj1, bar: obj2}, {foo: obj1}); - * assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2}); - * - * @name include - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.include = function (exp, inc, msg) { - new Assertion(exp, msg, assert.include, true).include(inc); - }; - - /** - * ### .notInclude(haystack, needle, [message]) - * - * Asserts that `haystack` does not include `needle`. Can be used to assert - * the absence of a value in an array, a substring in a string, or a subset of - * properties in an object. - * - * assert.notInclude([1,2,3], 4, "array doesn't contain value"); - * assert.notInclude('foobar', 'baz', "string doesn't contain substring"); - * assert.notInclude({ foo: 'bar', hello: 'universe' }, { foo: 'baz' }, 'object doesn't contain property'); - * - * Strict equality (===) is used. When asserting the absence of a value in an - * array, the array is searched to confirm the absence of an element that's - * strictly equal to the given value. When asserting a subset of properties in - * an object, the object is searched to confirm that at least one of the given - * property keys is either not present or not strictly equal to the given - * property value. For instance: - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.notInclude([obj1, obj2], {a: 1}); - * assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); - * assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}}); - * - * @name notInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notInclude, true).not.include(inc); - }; - - /** - * ### .deepInclude(haystack, needle, [message]) - * - * Asserts that `haystack` includes `needle`. Can be used to assert the - * inclusion of a value in an array or a subset of properties in an object. - * Deep equality is used. - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.deepInclude([obj1, obj2], {a: 1}); - * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); - * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}}); - * - * @name deepInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc); - }; - - /** - * ### .notDeepInclude(haystack, needle, [message]) - * - * Asserts that `haystack` does not include `needle`. Can be used to assert - * the absence of a value in an array or a subset of properties in an object. - * Deep equality is used. - * - * var obj1 = {a: 1} - * , obj2 = {b: 2}; - * assert.notDeepInclude([obj1, obj2], {a: 9}); - * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}}); - * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}}); - * - * @name notDeepInclude - * @param {Array|String} haystack - * @param {Mixed} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc); - }; - - /** - * ### .nestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'}); - * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); - * - * @name nestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.nestedInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc); - }; - - /** - * ### .notNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' does not include 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'}); - * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); - * - * @name notNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notNestedInclude = function (exp, inc, msg) { - new Assertion(exp, msg, assert.notNestedInclude, true) - .not.nested.include(inc); - }; - - /** - * ### .deepNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object while checking for deep equality. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}}); - * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); - * - * @name deepNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepNestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepNestedInclude, true) - .deep.nested.include(inc); - }; - - /** - * ### .notDeepNestedInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' does not include 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object while checking for deep equality. - * Enables the use of dot- and bracket-notation for referencing nested - * properties. - * '[]' and '.' in property names can be escaped using double backslashes. - * - * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}}) - * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); - * - * @name notDeepNestedInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepNestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepNestedInclude, true) - .not.deep.nested.include(inc); - }; - - /** - * ### .ownInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object while ignoring inherited properties. - * - * assert.ownInclude({ a: 1 }, { a: 1 }); - * - * @name ownInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.ownInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.ownInclude, true).own.include(inc); - }; - - /** - * ### .notOwnInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object while ignoring inherited properties. - * - * Object.prototype.b = 2; - * - * assert.notOwnInclude({ a: 1 }, { b: 2 }); - * - * @name notOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc); - }; - - /** - * ### .deepOwnInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the inclusion of a subset of properties in an - * object while ignoring inherited properties and checking for deep equality. - * - * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); - * - * @name deepOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepOwnInclude, true) - .deep.own.include(inc); - }; - - /** - * ### .notDeepOwnInclude(haystack, needle, [message]) - * - * Asserts that 'haystack' includes 'needle'. - * Can be used to assert the absence of a subset of properties in an - * object while ignoring inherited properties and checking for deep equality. - * - * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); - * - * @name notDeepOwnInclude - * @param {Object} haystack - * @param {Object} needle - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepOwnInclude, true) - .not.deep.own.include(inc); - }; - - /** - * ### .match(value, regexp, [message]) - * - * Asserts that `value` matches the regular expression `regexp`. - * - * assert.match('foobar', /^foo/, 'regexp matches'); - * - * @name match - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.match = function (exp, re, msg) { - new Assertion(exp, msg, assert.match, true).to.match(re); - }; - - /** - * ### .notMatch(value, regexp, [message]) - * - * Asserts that `value` does not match the regular expression `regexp`. - * - * assert.notMatch('foobar', /^foo/, 'regexp does not match'); - * - * @name notMatch - * @param {Mixed} value - * @param {RegExp} regexp - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notMatch = function (exp, re, msg) { - new Assertion(exp, msg, assert.notMatch, true).to.not.match(re); - }; - - /** - * ### .property(object, property, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property`. - * - * assert.property({ tea: { green: 'matcha' }}, 'tea'); - * assert.property({ tea: { green: 'matcha' }}, 'toString'); - * - * @name property - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.property = function (obj, prop, msg) { - new Assertion(obj, msg, assert.property, true).to.have.property(prop); - }; - - /** - * ### .notProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a direct or inherited property named - * by `property`. - * - * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee'); - * - * @name notProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.notProperty, true) - .to.not.have.property(prop); - }; - - /** - * ### .propertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property` with a value given by `value`. Uses a strict equality check - * (===). - * - * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good'); - * - * @name propertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.propertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.propertyVal, true) - .to.have.property(prop, val); - }; - - /** - * ### .notPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct or inherited property named - * by `property` with value given by `value`. Uses a strict equality check - * (===). - * - * assert.notPropertyVal({ tea: 'is good' }, 'tea', 'is bad'); - * assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good'); - * - * @name notPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notPropertyVal, true) - .to.not.have.property(prop, val); - }; - - /** - * ### .deepPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property` with a value given by `value`. Uses a deep equality check. - * - * assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); - * - * @name deepPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.deepPropertyVal, true) - .to.have.deep.property(prop, val); - }; - - /** - * ### .notDeepPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct or inherited property named - * by `property` with value given by `value`. Uses a deep equality check. - * - * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' }); - * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' }); - * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); - * - * @name notDeepPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notDeepPropertyVal, true) - .to.not.have.deep.property(prop, val); - }; - - /** - * ### .ownProperty(object, property, [message]) - * - * Asserts that `object` has a direct property named by `property`. Inherited - * properties aren't checked. - * - * assert.ownProperty({ tea: { green: 'matcha' }}, 'tea'); - * - * @name ownProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.ownProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.ownProperty, true) - .to.have.own.property(prop); - }; - - /** - * ### .notOwnProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a direct property named by - * `property`. Inherited properties aren't checked. - * - * assert.notOwnProperty({ tea: { green: 'matcha' }}, 'coffee'); - * assert.notOwnProperty({}, 'toString'); - * - * @name notOwnProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @api public - */ - - assert.notOwnProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.notOwnProperty, true) - .to.not.have.own.property(prop); - }; - - /** - * ### .ownPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct property named by `property` and a value - * equal to the provided `value`. Uses a strict equality check (===). - * Inherited properties aren't checked. - * - * assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good'); - * - * @name ownPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.ownPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.ownPropertyVal, true) - .to.have.own.property(prop, value); - }; - - /** - * ### .notOwnPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct property named by `property` - * with a value equal to the provided `value`. Uses a strict equality check - * (===). Inherited properties aren't checked. - * - * assert.notOwnPropertyVal({ tea: 'is better'}, 'tea', 'is worse'); - * assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString); - * - * @name notOwnPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.notOwnPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.notOwnPropertyVal, true) - .to.not.have.own.property(prop, value); - }; - - /** - * ### .deepOwnPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a direct property named by `property` and a value - * equal to the provided `value`. Uses a deep equality check. Inherited - * properties aren't checked. - * - * assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); - * - * @name deepOwnPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.deepOwnPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.deepOwnPropertyVal, true) - .to.have.deep.own.property(prop, value); - }; - - /** - * ### .notDeepOwnPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a direct property named by `property` - * with a value equal to the provided `value`. Uses a deep equality check. - * Inherited properties aren't checked. - * - * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' }); - * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' }); - * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); - * assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString); - * - * @name notDeepOwnPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @api public - */ - - assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) { - new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true) - .to.not.have.deep.own.property(prop, value); - }; - - /** - * ### .nestedProperty(object, property, [message]) - * - * Asserts that `object` has a direct or inherited property named by - * `property`, which can be a string using dot- and bracket-notation for - * nested reference. - * - * assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green'); - * - * @name nestedProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.nestedProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.nestedProperty, true) - .to.have.nested.property(prop); - }; - - /** - * ### .notNestedProperty(object, property, [message]) - * - * Asserts that `object` does _not_ have a property named by `property`, which - * can be a string using dot- and bracket-notation for nested reference. The - * property cannot exist on the object nor anywhere in its prototype chain. - * - * assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong'); - * - * @name notNestedProperty - * @param {Object} object - * @param {String} property - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notNestedProperty = function (obj, prop, msg) { - new Assertion(obj, msg, assert.notNestedProperty, true) - .to.not.have.nested.property(prop); - }; - - /** - * ### .nestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with value given - * by `value`. `property` can use dot- and bracket-notation for nested - * reference. Uses a strict equality check (===). - * - * assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha'); - * - * @name nestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.nestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.nestedPropertyVal, true) - .to.have.nested.property(prop, val); - }; - - /** - * ### .notNestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a property named by `property` with - * value given by `value`. `property` can use dot- and bracket-notation for - * nested reference. Uses a strict equality check (===). - * - * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha'); - * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha'); - * - * @name notNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notNestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notNestedPropertyVal, true) - .to.not.have.nested.property(prop, val); - }; - - /** - * ### .deepNestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` has a property named by `property` with a value given - * by `value`. `property` can use dot- and bracket-notation for nested - * reference. Uses a deep equality check. - * - * assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' }); - * - * @name deepNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.deepNestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.deepNestedPropertyVal, true) - .to.have.deep.nested.property(prop, val); - }; - - /** - * ### .notDeepNestedPropertyVal(object, property, value, [message]) - * - * Asserts that `object` does _not_ have a property named by `property` with - * value given by `value`. `property` can use dot- and bracket-notation for - * nested reference. Uses a deep equality check. - * - * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { oolong: 'yum' }); - * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yuck' }); - * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' }); - * - * @name notDeepNestedPropertyVal - * @param {Object} object - * @param {String} property - * @param {Mixed} value - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) { - new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true) - .to.not.have.deep.nested.property(prop, val); - } +import {Assertion} from '../assertion.js'; +import {flag, inspect} from '../utils/index.js'; +import AssertionError from 'assertion-error'; + +/** + * ### assert(expression, message) + * + * Write your own test expressions. + * + * assert('foo' !== 'bar', 'foo is not bar'); + * assert(Array.isArray([]), 'empty arrays are arrays'); + * + * @param {Mixed} expression to test for truthiness + * @param {String} message to display on error + * @name assert + * @namespace Assert + * @api public + */ - /** - * ### .lengthOf(object, length, [message]) - * - * Asserts that `object` has a `length` or `size` with the expected value. - * - * assert.lengthOf([1,2,3], 3, 'array has length of 3'); - * assert.lengthOf('foobar', 6, 'string has length of 6'); - * assert.lengthOf(new Set([1,2,3]), 3, 'set has size of 3'); - * assert.lengthOf(new Map([['a',1],['b',2],['c',3]]), 3, 'map has size of 3'); - * - * @name lengthOf - * @param {Mixed} object - * @param {Number} length - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.lengthOf = function (exp, len, msg) { - new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len); - }; - - /** - * ### .hasAnyKeys(object, [keys], [message]) - * - * Asserts that `object` has at least one of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'iDontExist', 'baz']); - * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, iDontExist: 99, baz: 1337}); - * assert.hasAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); - * assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']); - * - * @name hasAnyKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAnyKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys); - } +function assert(express, errmsg) { + var test = new Assertion(null, null, chai.assert, true); + test.assert( + express + , errmsg + , '[ negation message unavailable ]' + ); +} + +export {assert}; + +/** + * ### .fail([message]) + * ### .fail(actual, expected, [message], [operator]) + * + * Throw a failure. Node.js `assert` module-compatible. + * + * assert.fail(); + * assert.fail("custom error message"); + * assert.fail(1, 2); + * assert.fail(1, 2, "custom error message"); + * assert.fail(1, 2, "custom error message", ">"); + * assert.fail(1, 2, undefined, ">"); + * + * @name fail + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @param {String} operator + * @namespace Assert + * @api public + */ - /** - * ### .hasAllKeys(object, [keys], [message]) - * - * Asserts that `object` has all and only all of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']); - * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337]); - * assert.hasAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); - * assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']); - * - * @name hasAllKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAllKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys); - } +assert.fail = function (actual, expected, message, operator) { + if (arguments.length < 2) { + // Comply with Node's fail([message]) interface - /** - * ### .containsAllKeys(object, [keys], [message]) - * - * Asserts that `object` has all of the `keys` provided but may have more keys not listed. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'baz']); - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']); - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337}); - * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337}); - * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]); - * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); - * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}]); - * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']); - * - * @name containsAllKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.containsAllKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.containsAllKeys, true) - .to.contain.all.keys(keys); + message = actual; + actual = undefined; } - /** - * ### .doesNotHaveAnyKeys(object, [keys], [message]) - * - * Asserts that `object` has none of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']); - * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'}); - * assert.doesNotHaveAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']); - * assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']); - * - * @name doesNotHaveAnyKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAnyKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true) - .to.not.have.any.keys(keys); - } + message = message || 'assert.fail()'; + throw new AssertionError(message, { + actual: actual + , expected: expected + , operator: operator + }, assert.fail); +}; - /** - * ### .doesNotHaveAllKeys(object, [keys], [message]) - * - * Asserts that `object` does not have at least one of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']); - * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'}); - * assert.doesNotHaveAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']); - * assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']); - * - * @name doesNotHaveAllKeys - * @param {Mixed} object - * @param {String[]} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAllKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAllKeys, true) - .to.not.have.all.keys(keys); - } +/** + * ### .isOk(object, [message]) + * + * Asserts that `object` is truthy. + * + * assert.isOk('everything', 'everything is ok'); + * assert.isOk(false, 'this will fail'); + * + * @name isOk + * @alias ok + * @param {Mixed} object to test + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .hasAnyDeepKeys(object, [keys], [message]) - * - * Asserts that `object` has at least one of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'}); - * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]); - * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); - * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'}); - * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]); - * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); - * - * @name hasAnyDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAnyDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAnyDeepKeys, true) - .to.have.any.deep.keys(keys); - } +assert.isOk = function (val, msg) { + new Assertion(val, msg, assert.isOk, true).is.ok; +}; + +/** + * ### .isNotOk(object, [message]) + * + * Asserts that `object` is falsy. + * + * assert.isNotOk('everything', 'this will fail'); + * assert.isNotOk(false, 'this will pass'); + * + * @name isNotOk + * @alias notOk + * @param {Mixed} object to test + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotOk = function (val, msg) { + new Assertion(val, msg, assert.isNotOk, true).is.not.ok; +}; + +/** + * ### .equal(actual, expected, [message]) + * + * Asserts non-strict equality (`==`) of `actual` and `expected`. + * + * assert.equal(3, '3', '== coerces values to strings'); + * + * @name equal + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.equal = function (act, exp, msg) { + var test = new Assertion(act, msg, assert.equal, true); + + test.assert( + exp == flag(test, 'object') + , 'expected #{this} to equal #{exp}' + , 'expected #{this} to not equal #{act}' + , exp + , act + , true + ); +}; + +/** + * ### .notEqual(actual, expected, [message]) + * + * Asserts non-strict inequality (`!=`) of `actual` and `expected`. + * + * assert.notEqual(3, 4, 'these numbers are not equal'); + * + * @name notEqual + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notEqual = function (act, exp, msg) { + var test = new Assertion(act, msg, assert.notEqual, true); + + test.assert( + exp != flag(test, 'object') + , 'expected #{this} to not equal #{exp}' + , 'expected #{this} to equal #{act}' + , exp + , act + , true + ); +}; + +/** + * ### .strictEqual(actual, expected, [message]) + * + * Asserts strict equality (`===`) of `actual` and `expected`. + * + * assert.strictEqual(true, true, 'these booleans are strictly equal'); + * + * @name strictEqual + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.strictEqual = function (act, exp, msg) { + new Assertion(act, msg, assert.strictEqual, true).to.equal(exp); +}; + +/** + * ### .notStrictEqual(actual, expected, [message]) + * + * Asserts strict inequality (`!==`) of `actual` and `expected`. + * + * assert.notStrictEqual(3, '3', 'no coercion for strict equality'); + * + * @name notStrictEqual + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notStrictEqual = function (act, exp, msg) { + new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp); +}; + +/** + * ### .deepEqual(actual, expected, [message]) + * + * Asserts that `actual` is deeply equal to `expected`. + * + * assert.deepEqual({ tea: 'green' }, { tea: 'green' }); + * + * @name deepEqual + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @alias deepStrictEqual + * @namespace Assert + * @api public + */ + +assert.deepEqual = assert.deepStrictEqual = function (act, exp, msg) { + new Assertion(act, msg, assert.deepEqual, true).to.eql(exp); +}; + +/** + * ### .notDeepEqual(actual, expected, [message]) + * + * Assert that `actual` is not deeply equal to `expected`. + * + * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' }); + * + * @name notDeepEqual + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notDeepEqual = function (act, exp, msg) { + new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp); +}; /** - * ### .hasAllDeepKeys(object, [keys], [message]) - * - * Asserts that `object` has all and only all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'}); - * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); - * assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'}); - * assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); - * - * @name hasAllDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.hasAllDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.hasAllDeepKeys, true) - .to.have.all.deep.keys(keys); - } + * ### .isAbove(valueToCheck, valueToBeAbove, [message]) + * + * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`. + * + * assert.isAbove(5, 2, '5 is strictly greater than 2'); + * + * @name isAbove + * @param {Mixed} valueToCheck + * @param {Mixed} valueToBeAbove + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isAbove = function (val, abv, msg) { + new Assertion(val, msg, assert.isAbove, true).to.be.above(abv); +}; /** - * ### .containsAllDeepKeys(object, [keys], [message]) - * - * Asserts that `object` contains all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'}); - * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); - * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'}); - * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); - * - * @name containsAllDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.containsAllDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.containsAllDeepKeys, true) - .to.contain.all.deep.keys(keys); - } + * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message]) + * + * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`. + * + * assert.isAtLeast(5, 2, '5 is greater or equal to 2'); + * assert.isAtLeast(3, 3, '3 is greater or equal to 3'); + * + * @name isAtLeast + * @param {Mixed} valueToCheck + * @param {Mixed} valueToBeAtLeast + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isAtLeast = function (val, atlst, msg) { + new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst); +}; /** - * ### .doesNotHaveAnyDeepKeys(object, [keys], [message]) - * - * Asserts that `object` has none of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'}); - * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); - * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'}); - * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); - * - * @name doesNotHaveAnyDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true) - .to.not.have.any.deep.keys(keys); - } + * ### .isBelow(valueToCheck, valueToBeBelow, [message]) + * + * Asserts `valueToCheck` is strictly less than (<) `valueToBeBelow`. + * + * assert.isBelow(3, 6, '3 is strictly less than 6'); + * + * @name isBelow + * @param {Mixed} valueToCheck + * @param {Mixed} valueToBeBelow + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isBelow = function (val, blw, msg) { + new Assertion(val, msg, assert.isBelow, true).to.be.below(blw); +}; /** - * ### .doesNotHaveAllDeepKeys(object, [keys], [message]) - * - * Asserts that `object` does not have at least one of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'}); - * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]); - * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'}); - * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]); - * - * @name doesNotHaveAllDeepKeys - * @param {Mixed} object - * @param {Array|Object} keys - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true) - .to.not.have.all.deep.keys(keys); - } + * ### .isAtMost(valueToCheck, valueToBeAtMost, [message]) + * + * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`. + * + * assert.isAtMost(3, 6, '3 is less than or equal to 6'); + * assert.isAtMost(4, 4, '4 is less than or equal to 4'); + * + * @name isAtMost + * @param {Mixed} valueToCheck + * @param {Mixed} valueToBeAtMost + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isAtMost = function (val, atmst, msg) { + new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst); +}; + +/** + * ### .isTrue(value, [message]) + * + * Asserts that `value` is true. + * + * var teaServed = true; + * assert.isTrue(teaServed, 'the tea has been served'); + * + * @name isTrue + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isTrue = function (val, msg) { + new Assertion(val, msg, assert.isTrue, true).is['true']; +}; + +/** + * ### .isNotTrue(value, [message]) + * + * Asserts that `value` is not true. + * + * var tea = 'tasty chai'; + * assert.isNotTrue(tea, 'great, time for tea!'); + * + * @name isNotTrue + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotTrue = function (val, msg) { + new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true); +}; + +/** + * ### .isFalse(value, [message]) + * + * Asserts that `value` is false. + * + * var teaServed = false; + * assert.isFalse(teaServed, 'no tea yet? hmm...'); + * + * @name isFalse + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isFalse = function (val, msg) { + new Assertion(val, msg, assert.isFalse, true).is['false']; +}; + +/** + * ### .isNotFalse(value, [message]) + * + * Asserts that `value` is not false. + * + * var tea = 'tasty chai'; + * assert.isNotFalse(tea, 'great, time for tea!'); + * + * @name isNotFalse + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotFalse = function (val, msg) { + new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false); +}; + +/** + * ### .isNull(value, [message]) + * + * Asserts that `value` is null. + * + * assert.isNull(err, 'there was no error'); + * + * @name isNull + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNull = function (val, msg) { + new Assertion(val, msg, assert.isNull, true).to.equal(null); +}; + +/** + * ### .isNotNull(value, [message]) + * + * Asserts that `value` is not null. + * + * var tea = 'tasty chai'; + * assert.isNotNull(tea, 'great, time for tea!'); + * + * @name isNotNull + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotNull = function (val, msg) { + new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null); +}; + +/** + * ### .isNaN + * + * Asserts that value is NaN. + * + * assert.isNaN(NaN, 'NaN is NaN'); + * + * @name isNaN + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNaN = function (val, msg) { + new Assertion(val, msg, assert.isNaN, true).to.be.NaN; +}; + +/** + * ### .isNotNaN + * + * Asserts that value is not NaN. + * + * assert.isNotNaN(4, '4 is not NaN'); + * + * @name isNotNaN + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ +assert.isNotNaN = function (val, msg) { + new Assertion(val, msg, assert.isNotNaN, true).not.to.be.NaN; +}; + +/** + * ### .exists + * + * Asserts that the target is neither `null` nor `undefined`. + * + * var foo = 'hi'; + * + * assert.exists(foo, 'foo is neither `null` nor `undefined`'); + * + * @name exists + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.exists = function (val, msg) { + new Assertion(val, msg, assert.exists, true).to.exist; +}; + +/** + * ### .notExists + * + * Asserts that the target is either `null` or `undefined`. + * + * var bar = null + * , baz; + * + * assert.notExists(bar); + * assert.notExists(baz, 'baz is either null or undefined'); + * + * @name notExists + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notExists = function (val, msg) { + new Assertion(val, msg, assert.notExists, true).to.not.exist; +}; + +/** + * ### .isUndefined(value, [message]) + * + * Asserts that `value` is `undefined`. + * + * var tea; + * assert.isUndefined(tea, 'no tea defined'); + * + * @name isUndefined + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isUndefined = function (val, msg) { + new Assertion(val, msg, assert.isUndefined, true).to.equal(undefined); +}; + +/** + * ### .isDefined(value, [message]) + * + * Asserts that `value` is not `undefined`. + * + * var tea = 'cup of chai'; + * assert.isDefined(tea, 'tea has been defined'); + * + * @name isDefined + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isDefined = function (val, msg) { + new Assertion(val, msg, assert.isDefined, true).to.not.equal(undefined); +}; + +/** + * ### .isFunction(value, [message]) + * + * Asserts that `value` is a function. + * + * function serveTea() { return 'cup of tea'; }; + * assert.isFunction(serveTea, 'great, we can have tea now'); + * + * @name isFunction + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isFunction = function (val, msg) { + new Assertion(val, msg, assert.isFunction, true).to.be.a('function'); +}; + +/** + * ### .isNotFunction(value, [message]) + * + * Asserts that `value` is _not_ a function. + * + * var serveTea = [ 'heat', 'pour', 'sip' ]; + * assert.isNotFunction(serveTea, 'great, we have listed the steps'); + * + * @name isNotFunction + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotFunction = function (val, msg) { + new Assertion(val, msg, assert.isNotFunction, true).to.not.be.a('function'); +}; + +/** + * ### .isObject(value, [message]) + * + * Asserts that `value` is an object of type 'Object' (as revealed by `Object.prototype.toString`). + * _The assertion does not match subclassed objects._ + * + * var selection = { name: 'Chai', serve: 'with spices' }; + * assert.isObject(selection, 'tea selection is an object'); + * + * @name isObject + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isObject = function (val, msg) { + new Assertion(val, msg, assert.isObject, true).to.be.a('object'); +}; + +/** + * ### .isNotObject(value, [message]) + * + * Asserts that `value` is _not_ an object of type 'Object' (as revealed by `Object.prototype.toString`). + * + * var selection = 'chai' + * assert.isNotObject(selection, 'tea selection is not an object'); + * assert.isNotObject(null, 'null is not an object'); + * + * @name isNotObject + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotObject = function (val, msg) { + new Assertion(val, msg, assert.isNotObject, true).to.not.be.a('object'); +}; + +/** + * ### .isArray(value, [message]) + * + * Asserts that `value` is an array. + * + * var menu = [ 'green', 'chai', 'oolong' ]; + * assert.isArray(menu, 'what kind of tea do we want?'); + * + * @name isArray + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isArray = function (val, msg) { + new Assertion(val, msg, assert.isArray, true).to.be.an('array'); +}; + +/** + * ### .isNotArray(value, [message]) + * + * Asserts that `value` is _not_ an array. + * + * var menu = 'green|chai|oolong'; + * assert.isNotArray(menu, 'what kind of tea do we want?'); + * + * @name isNotArray + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotArray = function (val, msg) { + new Assertion(val, msg, assert.isNotArray, true).to.not.be.an('array'); +}; + +/** + * ### .isString(value, [message]) + * + * Asserts that `value` is a string. + * + * var teaOrder = 'chai'; + * assert.isString(teaOrder, 'order placed'); + * + * @name isString + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isString = function (val, msg) { + new Assertion(val, msg, assert.isString, true).to.be.a('string'); +}; + +/** + * ### .isNotString(value, [message]) + * + * Asserts that `value` is _not_ a string. + * + * var teaOrder = 4; + * assert.isNotString(teaOrder, 'order placed'); + * + * @name isNotString + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotString = function (val, msg) { + new Assertion(val, msg, assert.isNotString, true).to.not.be.a('string'); +}; + +/** + * ### .isNumber(value, [message]) + * + * Asserts that `value` is a number. + * + * var cups = 2; + * assert.isNumber(cups, 'how many cups'); + * + * @name isNumber + * @param {Number} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNumber = function (val, msg) { + new Assertion(val, msg, assert.isNumber, true).to.be.a('number'); +}; + +/** + * ### .isNotNumber(value, [message]) + * + * Asserts that `value` is _not_ a number. + * + * var cups = '2 cups please'; + * assert.isNotNumber(cups, 'how many cups'); + * + * @name isNotNumber + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.isNotNumber = function (val, msg) { + new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a('number'); +}; /** - * ### .throws(fn, [errorLike/string/regexp], [string/regexp], [message]) - * - * If `errorLike` is an `Error` constructor, asserts that `fn` will throw an error that is an - * instance of `errorLike`. - * If `errorLike` is an `Error` instance, asserts that the error thrown is the same - * instance as `errorLike`. - * If `errMsgMatcher` is provided, it also asserts that the error thrown will have a - * message matching `errMsgMatcher`. - * - * assert.throws(fn, 'Error thrown must have this msg'); - * assert.throws(fn, /Error thrown must have a msg that matches this/); - * assert.throws(fn, ReferenceError); - * assert.throws(fn, errorInstance); - * assert.throws(fn, ReferenceError, 'Error thrown must be a ReferenceError and have this msg'); - * assert.throws(fn, errorInstance, 'Error thrown must be the same errorInstance and have this msg'); - * assert.throws(fn, ReferenceError, /Error thrown must be a ReferenceError and match this/); - * assert.throws(fn, errorInstance, /Error thrown must be the same errorInstance and match this/); - * - * @name throws - * @alias throw - * @alias Throw - * @param {Function} fn - * @param {ErrorConstructor|Error} errorLike - * @param {RegExp|String} errMsgMatcher - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Assert - * @api public - */ - - assert.throws = function (fn, errorLike, errMsgMatcher, msg) { - if ('string' === typeof errorLike || errorLike instanceof RegExp) { - errMsgMatcher = errorLike; - errorLike = null; - } - - var assertErr = new Assertion(fn, msg, assert.throws, true) - .to.throw(errorLike, errMsgMatcher); - return flag(assertErr, 'object'); - }; - - /** - * ### .doesNotThrow(fn, [errorLike/string/regexp], [string/regexp], [message]) - * - * If `errorLike` is an `Error` constructor, asserts that `fn` will _not_ throw an error that is an - * instance of `errorLike`. - * If `errorLike` is an `Error` instance, asserts that the error thrown is _not_ the same - * instance as `errorLike`. - * If `errMsgMatcher` is provided, it also asserts that the error thrown will _not_ have a - * message matching `errMsgMatcher`. - * - * assert.doesNotThrow(fn, 'Any Error thrown must not have this message'); - * assert.doesNotThrow(fn, /Any Error thrown must not match this/); - * assert.doesNotThrow(fn, Error); - * assert.doesNotThrow(fn, errorInstance); - * assert.doesNotThrow(fn, Error, 'Error must not have this message'); - * assert.doesNotThrow(fn, errorInstance, 'Error must not have this message'); - * assert.doesNotThrow(fn, Error, /Error must not match this/); - * assert.doesNotThrow(fn, errorInstance, /Error must not match this/); - * - * @name doesNotThrow - * @param {Function} fn - * @param {ErrorConstructor} errorLike - * @param {RegExp|String} errMsgMatcher - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Assert - * @api public - */ - - assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) { - if ('string' === typeof errorLike || errorLike instanceof RegExp) { - errMsgMatcher = errorLike; - errorLike = null; - } - - new Assertion(fn, msg, assert.doesNotThrow, true) - .to.not.throw(errorLike, errMsgMatcher); - }; - - /** - * ### .operator(val1, operator, val2, [message]) - * - * Compares two values using `operator`. - * - * assert.operator(1, '<', 2, 'everything is ok'); - * assert.operator(1, '>', 2, 'this will fail'); - * - * @name operator - * @param {Mixed} val1 - * @param {String} operator - * @param {Mixed} val2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.operator = function (val, operator, val2, msg) { - var ok; - switch(operator) { - case '==': - ok = val == val2; - break; - case '===': - ok = val === val2; - break; - case '>': - ok = val > val2; - break; - case '>=': - ok = val >= val2; - break; - case '<': - ok = val < val2; - break; - case '<=': - ok = val <= val2; - break; - case '!=': - ok = val != val2; - break; - case '!==': - ok = val !== val2; - break; - default: - msg = msg ? msg + ': ' : msg; - throw new chai.AssertionError( - msg + 'Invalid operator "' + operator + '"', - undefined, - assert.operator - ); - } - var test = new Assertion(ok, msg, assert.operator, true); - test.assert( - true === flag(test, 'object') - , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2) - , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) ); - }; - - /** - * ### .closeTo(actual, expected, delta, [message]) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * assert.closeTo(1.5, 1, 0.5, 'numbers are close'); - * - * @name closeTo - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.closeTo = function (act, exp, delta, msg) { - new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta); - }; - - /** - * ### .approximately(actual, expected, delta, [message]) - * - * Asserts that the target is equal `expected`, to within a +/- `delta` range. - * - * assert.approximately(1.5, 1, 0.5, 'numbers are close'); - * - * @name approximately - * @param {Number} actual - * @param {Number} expected - * @param {Number} delta - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.approximately = function (act, exp, delta, msg) { - new Assertion(act, msg, assert.approximately, true) - .to.be.approximately(exp, delta); - }; - - /** - * ### .sameMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in any order. Uses a - * strict equality check (===). - * - * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); - * - * @name sameMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameMembers, true) - .to.have.same.members(set2); - } + * ### .isFinite(value, [message]) + * + * Asserts that `value` is a finite number. Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. + * + * var cups = 2; + * assert.isFinite(cups, 'how many cups'); + * + * assert.isFinite(NaN); // throws + * + * @name isFinite + * @param {Number} value + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notSameMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in any order. - * Uses a strict equality check (===). - * - * assert.notSameMembers([ 1, 2, 3 ], [ 5, 1, 3 ], 'not same members'); - * - * @name notSameMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameMembers, true) - .to.not.have.same.members(set2); - } +assert.isFinite = function (val, msg) { + new Assertion(val, msg, assert.isFinite, true).to.be.finite; +}; - /** - * ### .sameDeepMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in any order. Uses a - * deep equality check. - * - * assert.sameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { c: 3 }], 'same deep members'); - * - * @name sameDeepMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameDeepMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameDeepMembers, true) - .to.have.same.deep.members(set2); - } +/** + * ### .isBoolean(value, [message]) + * + * Asserts that `value` is a boolean. + * + * var teaReady = true + * , teaServed = false; + * + * assert.isBoolean(teaReady, 'is the tea ready'); + * assert.isBoolean(teaServed, 'has tea been served'); + * + * @name isBoolean + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notSameDeepMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in any order. - * Uses a deep equality check. - * - * assert.notSameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { f: 5 }], 'not same deep members'); - * - * @name notSameDeepMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameDeepMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameDeepMembers, true) - .to.not.have.same.deep.members(set2); - } +assert.isBoolean = function (val, msg) { + new Assertion(val, msg, assert.isBoolean, true).to.be.a('boolean'); +}; - /** - * ### .sameOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in the same order. - * Uses a strict equality check (===). - * - * assert.sameOrderedMembers([ 1, 2, 3 ], [ 1, 2, 3 ], 'same ordered members'); - * - * @name sameOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameOrderedMembers, true) - .to.have.same.ordered.members(set2); - } +/** + * ### .isNotBoolean(value, [message]) + * + * Asserts that `value` is _not_ a boolean. + * + * var teaReady = 'yep' + * , teaServed = 'nope'; + * + * assert.isNotBoolean(teaReady, 'is the tea ready'); + * assert.isNotBoolean(teaServed, 'has tea been served'); + * + * @name isNotBoolean + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notSameOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in the same - * order. Uses a strict equality check (===). - * - * assert.notSameOrderedMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'not same ordered members'); - * - * @name notSameOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameOrderedMembers, true) - .to.not.have.same.ordered.members(set2); - } +assert.isNotBoolean = function (val, msg) { + new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a('boolean'); +}; - /** - * ### .sameDeepOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` have the same members in the same order. - * Uses a deep equality check. - * - * assert.sameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { c: 3 } ], 'same deep ordered members'); - * - * @name sameDeepOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.sameDeepOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.sameDeepOrderedMembers, true) - .to.have.same.deep.ordered.members(set2); - } +/** + * ### .typeOf(value, name, [message]) + * + * Asserts that `value`'s type is `name`, as determined by + * `Object.prototype.toString`. + * + * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object'); + * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array'); + * assert.typeOf('tea', 'string', 'we have a string'); + * assert.typeOf(/tea/, 'regexp', 'we have a regular expression'); + * assert.typeOf(null, 'null', 'we have a null'); + * assert.typeOf(undefined, 'undefined', 'we have an undefined'); + * + * @name typeOf + * @param {Mixed} value + * @param {String} name + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notSameDeepOrderedMembers(set1, set2, [message]) - * - * Asserts that `set1` and `set2` don't have the same members in the same - * order. Uses a deep equality check. - * - * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { z: 5 } ], 'not same deep ordered members'); - * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { c: 3 } ], 'not same deep ordered members'); - * - * @name notSameDeepOrderedMembers - * @param {Array} set1 - * @param {Array} set2 - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notSameDeepOrderedMembers = function (set1, set2, msg) { - new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true) - .to.not.have.same.deep.ordered.members(set2); - } +assert.typeOf = function (val, type, msg) { + new Assertion(val, msg, assert.typeOf, true).to.be.a(type); +}; - /** - * ### .includeMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in any order. Uses a - * strict equality check (===). Duplicates are ignored. - * - * assert.includeMembers([ 1, 2, 3 ], [ 2, 1, 2 ], 'include members'); - * - * @name includeMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeMembers, true) - .to.include.members(subset); - } +/** + * ### .notTypeOf(value, name, [message]) + * + * Asserts that `value`'s type is _not_ `name`, as determined by + * `Object.prototype.toString`. + * + * assert.notTypeOf('tea', 'number', 'strings are not numbers'); + * + * @name notTypeOf + * @param {Mixed} value + * @param {String} typeof name + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notIncludeMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in any order. Uses a - * strict equality check (===). Duplicates are ignored. - * - * assert.notIncludeMembers([ 1, 2, 3 ], [ 5, 1 ], 'not include members'); - * - * @name notIncludeMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeMembers, true) - .to.not.include.members(subset); - } +assert.notTypeOf = function (val, type, msg) { + new Assertion(val, msg, assert.notTypeOf, true).to.not.be.a(type); +}; - /** - * ### .includeDeepMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in any order. Uses a deep - * equality check. Duplicates are ignored. - * - * assert.includeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { b: 2 } ], 'include deep members'); - * - * @name includeDeepMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeDeepMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeDeepMembers, true) - .to.include.deep.members(subset); - } +/** + * ### .instanceOf(object, constructor, [message]) + * + * Asserts that `value` is an instance of `constructor`. + * + * var Tea = function (name) { this.name = name; } + * , chai = new Tea('chai'); + * + * assert.instanceOf(chai, Tea, 'chai is an instance of tea'); + * + * @name instanceOf + * @param {Object} object + * @param {Constructor} constructor + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notIncludeDeepMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in any order. Uses a - * deep equality check. Duplicates are ignored. - * - * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members'); - * - * @name notIncludeDeepMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeDeepMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeDeepMembers, true) - .to.not.include.deep.members(subset); - } +assert.instanceOf = function (val, type, msg) { + new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type); +}; - /** - * ### .includeOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in the same order - * beginning with the first element in `superset`. Uses a strict equality - * check (===). - * - * assert.includeOrderedMembers([ 1, 2, 3 ], [ 1, 2 ], 'include ordered members'); - * - * @name includeOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeOrderedMembers, true) - .to.include.ordered.members(subset); - } +/** + * ### .notInstanceOf(object, constructor, [message]) + * + * Asserts `value` is not an instance of `constructor`. + * + * var Tea = function (name) { this.name = name; } + * , chai = new String('chai'); + * + * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea'); + * + * @name notInstanceOf + * @param {Object} object + * @param {Constructor} constructor + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notInstanceOf = function (val, type, msg) { + new Assertion(val, msg, assert.notInstanceOf, true) + .to.not.be.instanceOf(type); +}; + +/** + * ### .include(haystack, needle, [message]) + * + * Asserts that `haystack` includes `needle`. Can be used to assert the + * inclusion of a value in an array, a substring in a string, or a subset of + * properties in an object. + * + * assert.include([1,2,3], 2, 'array contains value'); + * assert.include('foobar', 'foo', 'string contains substring'); + * assert.include({ foo: 'bar', hello: 'universe' }, { foo: 'bar' }, 'object contains property'); + * + * Strict equality (===) is used. When asserting the inclusion of a value in + * an array, the array is searched for an element that's strictly equal to the + * given value. When asserting a subset of properties in an object, the object + * is searched for the given property keys, checking that each one is present + * and strictly equal to the given property value. For instance: + * + * var obj1 = {a: 1} + * , obj2 = {b: 2}; + * assert.include([obj1, obj2], obj1); + * assert.include({foo: obj1, bar: obj2}, {foo: obj1}); + * assert.include({foo: obj1, bar: obj2}, {foo: obj1, bar: obj2}); + * + * @name include + * @param {Array|String} haystack + * @param {Mixed} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.include = function (exp, inc, msg) { + new Assertion(exp, msg, assert.include, true).include(inc); +}; + +/** + * ### .notInclude(haystack, needle, [message]) + * + * Asserts that `haystack` does not include `needle`. Can be used to assert + * the absence of a value in an array, a substring in a string, or a subset of + * properties in an object. + * + * assert.notInclude([1,2,3], 4, "array doesn't contain value"); + * assert.notInclude('foobar', 'baz', "string doesn't contain substring"); + * assert.notInclude({ foo: 'bar', hello: 'universe' }, { foo: 'baz' }, 'object doesn't contain property'); + * + * Strict equality (===) is used. When asserting the absence of a value in an + * array, the array is searched to confirm the absence of an element that's + * strictly equal to the given value. When asserting a subset of properties in + * an object, the object is searched to confirm that at least one of the given + * property keys is either not present or not strictly equal to the given + * property value. For instance: + * + * var obj1 = {a: 1} + * , obj2 = {b: 2}; + * assert.notInclude([obj1, obj2], {a: 1}); + * assert.notInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); + * assert.notInclude({foo: obj1, bar: obj2}, {foo: obj1, bar: {b: 2}}); + * + * @name notInclude + * @param {Array|String} haystack + * @param {Mixed} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notInclude = function (exp, inc, msg) { + new Assertion(exp, msg, assert.notInclude, true).not.include(inc); +}; + +/** + * ### .deepInclude(haystack, needle, [message]) + * + * Asserts that `haystack` includes `needle`. Can be used to assert the + * inclusion of a value in an array or a subset of properties in an object. + * Deep equality is used. + * + * var obj1 = {a: 1} + * , obj2 = {b: 2}; + * assert.deepInclude([obj1, obj2], {a: 1}); + * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}}); + * assert.deepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 2}}); + * + * @name deepInclude + * @param {Array|String} haystack + * @param {Mixed} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.deepInclude = function (exp, inc, msg) { + new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc); +}; + +/** + * ### .notDeepInclude(haystack, needle, [message]) + * + * Asserts that `haystack` does not include `needle`. Can be used to assert + * the absence of a value in an array or a subset of properties in an object. + * Deep equality is used. + * + * var obj1 = {a: 1} + * , obj2 = {b: 2}; + * assert.notDeepInclude([obj1, obj2], {a: 9}); + * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 9}}); + * assert.notDeepInclude({foo: obj1, bar: obj2}, {foo: {a: 1}, bar: {b: 9}}); + * + * @name notDeepInclude + * @param {Array|String} haystack + * @param {Mixed} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notDeepInclude = function (exp, inc, msg) { + new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc); +}; + +/** + * ### .nestedInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the inclusion of a subset of properties in an + * object. + * Enables the use of dot- and bracket-notation for referencing nested + * properties. + * '[]' and '.' in property names can be escaped using double backslashes. + * + * assert.nestedInclude({'.a': {'b': 'x'}}, {'\\.a.[b]': 'x'}); + * assert.nestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'x'}); + * + * @name nestedInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ - /** - * ### .notIncludeOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in the same order - * beginning with the first element in `superset`. Uses a strict equality - * check (===). - * - * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 1 ], 'not include ordered members'); - * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 3 ], 'not include ordered members'); - * - * @name notIncludeOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeOrderedMembers, true) - .to.not.include.ordered.members(subset); +assert.nestedInclude = function (exp, inc, msg) { + new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc); +}; + +/** + * ### .notNestedInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' does not include 'needle'. + * Can be used to assert the absence of a subset of properties in an + * object. + * Enables the use of dot- and bracket-notation for referencing nested + * properties. + * '[]' and '.' in property names can be escaped using double backslashes. + * + * assert.notNestedInclude({'.a': {'b': 'x'}}, {'\\.a.b': 'y'}); + * assert.notNestedInclude({'a': {'[b]': 'x'}}, {'a.\\[b\\]': 'y'}); + * + * @name notNestedInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notNestedInclude = function (exp, inc, msg) { + new Assertion(exp, msg, assert.notNestedInclude, true) + .not.nested.include(inc); +}; + +/** + * ### .deepNestedInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the inclusion of a subset of properties in an + * object while checking for deep equality. + * Enables the use of dot- and bracket-notation for referencing nested + * properties. + * '[]' and '.' in property names can be escaped using double backslashes. + * + * assert.deepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {x: 1}}); + * assert.deepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {x: 1}}); + * + * @name deepNestedInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.deepNestedInclude = function(exp, inc, msg) { + new Assertion(exp, msg, assert.deepNestedInclude, true) + .deep.nested.include(inc); +}; + +/** + * ### .notDeepNestedInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' does not include 'needle'. + * Can be used to assert the absence of a subset of properties in an + * object while checking for deep equality. + * Enables the use of dot- and bracket-notation for referencing nested + * properties. + * '[]' and '.' in property names can be escaped using double backslashes. + * + * assert.notDeepNestedInclude({a: {b: [{x: 1}]}}, {'a.b[0]': {y: 1}}) + * assert.notDeepNestedInclude({'.a': {'[b]': {x: 1}}}, {'\\.a.\\[b\\]': {y: 2}}); + * + * @name notDeepNestedInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notDeepNestedInclude = function(exp, inc, msg) { + new Assertion(exp, msg, assert.notDeepNestedInclude, true) + .not.deep.nested.include(inc); +}; + +/** + * ### .ownInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the inclusion of a subset of properties in an + * object while ignoring inherited properties. + * + * assert.ownInclude({ a: 1 }, { a: 1 }); + * + * @name ownInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.ownInclude = function(exp, inc, msg) { + new Assertion(exp, msg, assert.ownInclude, true).own.include(inc); +}; + +/** + * ### .notOwnInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the absence of a subset of properties in an + * object while ignoring inherited properties. + * + * Object.prototype.b = 2; + * + * assert.notOwnInclude({ a: 1 }, { b: 2 }); + * + * @name notOwnInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notOwnInclude = function(exp, inc, msg) { + new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc); +}; + +/** + * ### .deepOwnInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the inclusion of a subset of properties in an + * object while ignoring inherited properties and checking for deep equality. + * + * assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}}); + * + * @name deepOwnInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.deepOwnInclude = function(exp, inc, msg) { + new Assertion(exp, msg, assert.deepOwnInclude, true) + .deep.own.include(inc); +}; + + /** + * ### .notDeepOwnInclude(haystack, needle, [message]) + * + * Asserts that 'haystack' includes 'needle'. + * Can be used to assert the absence of a subset of properties in an + * object while ignoring inherited properties and checking for deep equality. + * + * assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}}); + * + * @name notDeepOwnInclude + * @param {Object} haystack + * @param {Object} needle + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notDeepOwnInclude = function(exp, inc, msg) { + new Assertion(exp, msg, assert.notDeepOwnInclude, true) + .not.deep.own.include(inc); +}; + +/** + * ### .match(value, regexp, [message]) + * + * Asserts that `value` matches the regular expression `regexp`. + * + * assert.match('foobar', /^foo/, 'regexp matches'); + * + * @name match + * @param {Mixed} value + * @param {RegExp} regexp + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.match = function (exp, re, msg) { + new Assertion(exp, msg, assert.match, true).to.match(re); +}; + +/** + * ### .notMatch(value, regexp, [message]) + * + * Asserts that `value` does not match the regular expression `regexp`. + * + * assert.notMatch('foobar', /^foo/, 'regexp does not match'); + * + * @name notMatch + * @param {Mixed} value + * @param {RegExp} regexp + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notMatch = function (exp, re, msg) { + new Assertion(exp, msg, assert.notMatch, true).to.not.match(re); +}; + +/** + * ### .property(object, property, [message]) + * + * Asserts that `object` has a direct or inherited property named by + * `property`. + * + * assert.property({ tea: { green: 'matcha' }}, 'tea'); + * assert.property({ tea: { green: 'matcha' }}, 'toString'); + * + * @name property + * @param {Object} object + * @param {String} property + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.property = function (obj, prop, msg) { + new Assertion(obj, msg, assert.property, true).to.have.property(prop); +}; + +/** + * ### .notProperty(object, property, [message]) + * + * Asserts that `object` does _not_ have a direct or inherited property named + * by `property`. + * + * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee'); + * + * @name notProperty + * @param {Object} object + * @param {String} property + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notProperty = function (obj, prop, msg) { + new Assertion(obj, msg, assert.notProperty, true) + .to.not.have.property(prop); +}; + +/** + * ### .propertyVal(object, property, value, [message]) + * + * Asserts that `object` has a direct or inherited property named by + * `property` with a value given by `value`. Uses a strict equality check + * (===). + * + * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good'); + * + * @name propertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.propertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.propertyVal, true) + .to.have.property(prop, val); +}; + +/** + * ### .notPropertyVal(object, property, value, [message]) + * + * Asserts that `object` does _not_ have a direct or inherited property named + * by `property` with value given by `value`. Uses a strict equality check + * (===). + * + * assert.notPropertyVal({ tea: 'is good' }, 'tea', 'is bad'); + * assert.notPropertyVal({ tea: 'is good' }, 'coffee', 'is good'); + * + * @name notPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.notPropertyVal, true) + .to.not.have.property(prop, val); +}; + +/** + * ### .deepPropertyVal(object, property, value, [message]) + * + * Asserts that `object` has a direct or inherited property named by + * `property` with a value given by `value`. Uses a deep equality check. + * + * assert.deepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); + * + * @name deepPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.deepPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.deepPropertyVal, true) + .to.have.deep.property(prop, val); +}; + +/** + * ### .notDeepPropertyVal(object, property, value, [message]) + * + * Asserts that `object` does _not_ have a direct or inherited property named + * by `property` with value given by `value`. Uses a deep equality check. + * + * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' }); + * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' }); + * assert.notDeepPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); + * + * @name notDeepPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notDeepPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.notDeepPropertyVal, true) + .to.not.have.deep.property(prop, val); +}; + +/** + * ### .ownProperty(object, property, [message]) + * + * Asserts that `object` has a direct property named by `property`. Inherited + * properties aren't checked. + * + * assert.ownProperty({ tea: { green: 'matcha' }}, 'tea'); + * + * @name ownProperty + * @param {Object} object + * @param {String} property + * @param {String} message + * @api public + */ + +assert.ownProperty = function (obj, prop, msg) { + new Assertion(obj, msg, assert.ownProperty, true) + .to.have.own.property(prop); +}; + +/** + * ### .notOwnProperty(object, property, [message]) + * + * Asserts that `object` does _not_ have a direct property named by + * `property`. Inherited properties aren't checked. + * + * assert.notOwnProperty({ tea: { green: 'matcha' }}, 'coffee'); + * assert.notOwnProperty({}, 'toString'); + * + * @name notOwnProperty + * @param {Object} object + * @param {String} property + * @param {String} message + * @api public + */ + +assert.notOwnProperty = function (obj, prop, msg) { + new Assertion(obj, msg, assert.notOwnProperty, true) + .to.not.have.own.property(prop); +}; + +/** + * ### .ownPropertyVal(object, property, value, [message]) + * + * Asserts that `object` has a direct property named by `property` and a value + * equal to the provided `value`. Uses a strict equality check (===). + * Inherited properties aren't checked. + * + * assert.ownPropertyVal({ coffee: 'is good'}, 'coffee', 'is good'); + * + * @name ownPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @api public + */ + +assert.ownPropertyVal = function (obj, prop, value, msg) { + new Assertion(obj, msg, assert.ownPropertyVal, true) + .to.have.own.property(prop, value); +}; + +/** + * ### .notOwnPropertyVal(object, property, value, [message]) + * + * Asserts that `object` does _not_ have a direct property named by `property` + * with a value equal to the provided `value`. Uses a strict equality check + * (===). Inherited properties aren't checked. + * + * assert.notOwnPropertyVal({ tea: 'is better'}, 'tea', 'is worse'); + * assert.notOwnPropertyVal({}, 'toString', Object.prototype.toString); + * + * @name notOwnPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @api public + */ + +assert.notOwnPropertyVal = function (obj, prop, value, msg) { + new Assertion(obj, msg, assert.notOwnPropertyVal, true) + .to.not.have.own.property(prop, value); +}; + +/** + * ### .deepOwnPropertyVal(object, property, value, [message]) + * + * Asserts that `object` has a direct property named by `property` and a value + * equal to the provided `value`. Uses a deep equality check. Inherited + * properties aren't checked. + * + * assert.deepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'matcha' }); + * + * @name deepOwnPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @api public + */ + +assert.deepOwnPropertyVal = function (obj, prop, value, msg) { + new Assertion(obj, msg, assert.deepOwnPropertyVal, true) + .to.have.deep.own.property(prop, value); +}; + +/** + * ### .notDeepOwnPropertyVal(object, property, value, [message]) + * + * Asserts that `object` does _not_ have a direct property named by `property` + * with a value equal to the provided `value`. Uses a deep equality check. + * Inherited properties aren't checked. + * + * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { black: 'matcha' }); + * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'tea', { green: 'oolong' }); + * assert.notDeepOwnPropertyVal({ tea: { green: 'matcha' } }, 'coffee', { green: 'matcha' }); + * assert.notDeepOwnPropertyVal({}, 'toString', Object.prototype.toString); + * + * @name notDeepOwnPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @api public + */ + +assert.notDeepOwnPropertyVal = function (obj, prop, value, msg) { + new Assertion(obj, msg, assert.notDeepOwnPropertyVal, true) + .to.not.have.deep.own.property(prop, value); +}; + +/** + * ### .nestedProperty(object, property, [message]) + * + * Asserts that `object` has a direct or inherited property named by + * `property`, which can be a string using dot- and bracket-notation for + * nested reference. + * + * assert.nestedProperty({ tea: { green: 'matcha' }}, 'tea.green'); + * + * @name nestedProperty + * @param {Object} object + * @param {String} property + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.nestedProperty = function (obj, prop, msg) { + new Assertion(obj, msg, assert.nestedProperty, true) + .to.have.nested.property(prop); +}; + +/** + * ### .notNestedProperty(object, property, [message]) + * + * Asserts that `object` does _not_ have a property named by `property`, which + * can be a string using dot- and bracket-notation for nested reference. The + * property cannot exist on the object nor anywhere in its prototype chain. + * + * assert.notNestedProperty({ tea: { green: 'matcha' }}, 'tea.oolong'); + * + * @name notNestedProperty + * @param {Object} object + * @param {String} property + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notNestedProperty = function (obj, prop, msg) { + new Assertion(obj, msg, assert.notNestedProperty, true) + .to.not.have.nested.property(prop); +}; + +/** + * ### .nestedPropertyVal(object, property, value, [message]) + * + * Asserts that `object` has a property named by `property` with value given + * by `value`. `property` can use dot- and bracket-notation for nested + * reference. Uses a strict equality check (===). + * + * assert.nestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha'); + * + * @name nestedPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.nestedPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.nestedPropertyVal, true) + .to.have.nested.property(prop, val); +}; + +/** + * ### .notNestedPropertyVal(object, property, value, [message]) + * + * Asserts that `object` does _not_ have a property named by `property` with + * value given by `value`. `property` can use dot- and bracket-notation for + * nested reference. Uses a strict equality check (===). + * + * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha'); + * assert.notNestedPropertyVal({ tea: { green: 'matcha' }}, 'coffee.green', 'matcha'); + * + * @name notNestedPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notNestedPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.notNestedPropertyVal, true) + .to.not.have.nested.property(prop, val); +}; + +/** + * ### .deepNestedPropertyVal(object, property, value, [message]) + * + * Asserts that `object` has a property named by `property` with a value given + * by `value`. `property` can use dot- and bracket-notation for nested + * reference. Uses a deep equality check. + * + * assert.deepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yum' }); + * + * @name deepNestedPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.deepNestedPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.deepNestedPropertyVal, true) + .to.have.deep.nested.property(prop, val); +}; + +/** + * ### .notDeepNestedPropertyVal(object, property, value, [message]) + * + * Asserts that `object` does _not_ have a property named by `property` with + * value given by `value`. `property` can use dot- and bracket-notation for + * nested reference. Uses a deep equality check. + * + * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { oolong: 'yum' }); + * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.green', { matcha: 'yuck' }); + * assert.notDeepNestedPropertyVal({ tea: { green: { matcha: 'yum' } } }, 'tea.black', { matcha: 'yum' }); + * + * @name notDeepNestedPropertyVal + * @param {Object} object + * @param {String} property + * @param {Mixed} value + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notDeepNestedPropertyVal = function (obj, prop, val, msg) { + new Assertion(obj, msg, assert.notDeepNestedPropertyVal, true) + .to.not.have.deep.nested.property(prop, val); +} + +/** + * ### .lengthOf(object, length, [message]) + * + * Asserts that `object` has a `length` or `size` with the expected value. + * + * assert.lengthOf([1,2,3], 3, 'array has length of 3'); + * assert.lengthOf('foobar', 6, 'string has length of 6'); + * assert.lengthOf(new Set([1,2,3]), 3, 'set has size of 3'); + * assert.lengthOf(new Map([['a',1],['b',2],['c',3]]), 3, 'map has size of 3'); + * + * @name lengthOf + * @param {Mixed} object + * @param {Number} length + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.lengthOf = function (exp, len, msg) { + new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len); +}; + +/** + * ### .hasAnyKeys(object, [keys], [message]) + * + * Asserts that `object` has at least one of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'iDontExist', 'baz']); + * assert.hasAnyKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, iDontExist: 99, baz: 1337}); + * assert.hasAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); + * assert.hasAnyKeys(new Set([{foo: 'bar'}, 'anotherKey']), [{foo: 'bar'}, 'anotherKey']); + * + * @name hasAnyKeys + * @param {Mixed} object + * @param {Array|Object} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.hasAnyKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys); +} + +/** + * ### .hasAllKeys(object, [keys], [message]) + * + * Asserts that `object` has all and only all of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']); + * assert.hasAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337]); + * assert.hasAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); + * assert.hasAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']); + * + * @name hasAllKeys + * @param {Mixed} object + * @param {String[]} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.hasAllKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys); +} + +/** + * ### .containsAllKeys(object, [keys], [message]) + * + * Asserts that `object` has all of the `keys` provided but may have more keys not listed. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'baz']); + * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, ['foo', 'bar', 'baz']); + * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, baz: 1337}); + * assert.containsAllKeys({foo: 1, bar: 2, baz: 3}, {foo: 30, bar: 99, baz: 1337}); + * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}]); + * assert.containsAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{foo: 1}, 'key']); + * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}]); + * assert.containsAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{foo: 'bar'}, 'anotherKey']); + * + * @name containsAllKeys + * @param {Mixed} object + * @param {String[]} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.containsAllKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.containsAllKeys, true) + .to.contain.all.keys(keys); +} + +/** + * ### .doesNotHaveAnyKeys(object, [keys], [message]) + * + * Asserts that `object` has none of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']); + * assert.doesNotHaveAnyKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'}); + * assert.doesNotHaveAnyKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']); + * assert.doesNotHaveAnyKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']); + * + * @name doesNotHaveAnyKeys + * @param {Mixed} object + * @param {String[]} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.doesNotHaveAnyKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true) + .to.not.have.any.keys(keys); +} + +/** + * ### .doesNotHaveAllKeys(object, [keys], [message]) + * + * Asserts that `object` does not have at least one of the `keys` provided. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, ['one', 'two', 'example']); + * assert.doesNotHaveAllKeys({foo: 1, bar: 2, baz: 3}, {one: 1, two: 2, example: 'foo'}); + * assert.doesNotHaveAllKeys(new Map([[{foo: 1}, 'bar'], ['key', 'value']]), [{one: 'two'}, 'example']); + * assert.doesNotHaveAllKeys(new Set([{foo: 'bar'}, 'anotherKey'], [{one: 'two'}, 'example']); + * + * @name doesNotHaveAllKeys + * @param {Mixed} object + * @param {String[]} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.doesNotHaveAllKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.doesNotHaveAllKeys, true) + .to.not.have.all.keys(keys); +} + +/** + * ### .hasAnyDeepKeys(object, [keys], [message]) + * + * Asserts that `object` has at least one of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'}); + * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), [{one: 'one'}, {two: 'two'}]); + * assert.hasAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); + * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'}); + * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {three: 'three'}]); + * assert.hasAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); + * + * @name hasAnyDeepKeys + * @param {Mixed} object + * @param {Array|Object} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.hasAnyDeepKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.hasAnyDeepKeys, true) + .to.have.any.deep.keys(keys); +} + +/** + * ### .hasAllDeepKeys(object, [keys], [message]) + * + * Asserts that `object` has all and only all of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne']]), {one: 'one'}); + * assert.hasAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); + * assert.hasAllDeepKeys(new Set([{one: 'one'}]), {one: 'one'}); + * assert.hasAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); + * + * @name hasAllDeepKeys + * @param {Mixed} object + * @param {Array|Object} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.hasAllDeepKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.hasAllDeepKeys, true) + .to.have.all.deep.keys(keys); +} + +/** + * ### .containsAllDeepKeys(object, [keys], [message]) + * + * Asserts that `object` contains all of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {one: 'one'}); + * assert.containsAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{one: 'one'}, {two: 'two'}]); + * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {one: 'one'}); + * assert.containsAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {two: 'two'}]); + * + * @name containsAllDeepKeys + * @param {Mixed} object + * @param {Array|Object} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.containsAllDeepKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.containsAllDeepKeys, true) + .to.contain.all.deep.keys(keys); +} + +/** + * ### .doesNotHaveAnyDeepKeys(object, [keys], [message]) + * + * Asserts that `object` has none of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'}); + * assert.doesNotHaveAnyDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); + * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'}); + * assert.doesNotHaveAnyDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{twenty: 'twenty'}, {fifty: 'fifty'}]); + * + * @name doesNotHaveAnyDeepKeys + * @param {Mixed} object + * @param {Array|Object} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.doesNotHaveAnyDeepKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.doesNotHaveAnyDeepKeys, true) + .to.not.have.any.deep.keys(keys); +} + +/** + * ### .doesNotHaveAllDeepKeys(object, [keys], [message]) + * + * Asserts that `object` does not have at least one of the `keys` provided. + * Since Sets and Maps can have objects as keys you can use this assertion to perform + * a deep comparison. + * You can also provide a single object instead of a `keys` array and its keys + * will be used as the expected set of keys. + * + * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [1, 2]]), {thisDoesNot: 'exist'}); + * assert.doesNotHaveAllDeepKeys(new Map([[{one: 'one'}, 'valueOne'], [{two: 'two'}, 'valueTwo']]), [{twenty: 'twenty'}, {one: 'one'}]); + * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), {twenty: 'twenty'}); + * assert.doesNotHaveAllDeepKeys(new Set([{one: 'one'}, {two: 'two'}]), [{one: 'one'}, {fifty: 'fifty'}]); + * + * @name doesNotHaveAllDeepKeys + * @param {Mixed} object + * @param {Array|Object} keys + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.doesNotHaveAllDeepKeys = function (obj, keys, msg) { + new Assertion(obj, msg, assert.doesNotHaveAllDeepKeys, true) + .to.not.have.all.deep.keys(keys); +} + +/** + * ### .throws(fn, [errorLike/string/regexp], [string/regexp], [message]) + * + * If `errorLike` is an `Error` constructor, asserts that `fn` will throw an error that is an + * instance of `errorLike`. + * If `errorLike` is an `Error` instance, asserts that the error thrown is the same + * instance as `errorLike`. + * If `errMsgMatcher` is provided, it also asserts that the error thrown will have a + * message matching `errMsgMatcher`. + * + * assert.throws(fn, 'Error thrown must have this msg'); + * assert.throws(fn, /Error thrown must have a msg that matches this/); + * assert.throws(fn, ReferenceError); + * assert.throws(fn, errorInstance); + * assert.throws(fn, ReferenceError, 'Error thrown must be a ReferenceError and have this msg'); + * assert.throws(fn, errorInstance, 'Error thrown must be the same errorInstance and have this msg'); + * assert.throws(fn, ReferenceError, /Error thrown must be a ReferenceError and match this/); + * assert.throws(fn, errorInstance, /Error thrown must be the same errorInstance and match this/); + * + * @name throws + * @alias throw + * @alias Throw + * @param {Function} fn + * @param {ErrorConstructor|Error} errorLike + * @param {RegExp|String} errMsgMatcher + * @param {String} message + * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types + * @namespace Assert + * @api public + */ + +assert.throws = function (fn, errorLike, errMsgMatcher, msg) { + if ('string' === typeof errorLike || errorLike instanceof RegExp) { + errMsgMatcher = errorLike; + errorLike = null; } - /** - * ### .includeDeepOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` is included in `superset` in the same order - * beginning with the first element in `superset`. Uses a deep equality - * check. - * - * assert.includeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 } ], 'include deep ordered members'); - * - * @name includeDeepOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.includeDeepOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.includeDeepOrderedMembers, true) - .to.include.deep.ordered.members(subset); + var assertErr = new Assertion(fn, msg, assert.throws, true) + .to.throw(errorLike, errMsgMatcher); + return flag(assertErr, 'object'); +}; + +/** + * ### .doesNotThrow(fn, [errorLike/string/regexp], [string/regexp], [message]) + * + * If `errorLike` is an `Error` constructor, asserts that `fn` will _not_ throw an error that is an + * instance of `errorLike`. + * If `errorLike` is an `Error` instance, asserts that the error thrown is _not_ the same + * instance as `errorLike`. + * If `errMsgMatcher` is provided, it also asserts that the error thrown will _not_ have a + * message matching `errMsgMatcher`. + * + * assert.doesNotThrow(fn, 'Any Error thrown must not have this message'); + * assert.doesNotThrow(fn, /Any Error thrown must not match this/); + * assert.doesNotThrow(fn, Error); + * assert.doesNotThrow(fn, errorInstance); + * assert.doesNotThrow(fn, Error, 'Error must not have this message'); + * assert.doesNotThrow(fn, errorInstance, 'Error must not have this message'); + * assert.doesNotThrow(fn, Error, /Error must not match this/); + * assert.doesNotThrow(fn, errorInstance, /Error must not match this/); + * + * @name doesNotThrow + * @param {Function} fn + * @param {ErrorConstructor} errorLike + * @param {RegExp|String} errMsgMatcher + * @param {String} message + * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types + * @namespace Assert + * @api public + */ + +assert.doesNotThrow = function (fn, errorLike, errMsgMatcher, msg) { + if ('string' === typeof errorLike || errorLike instanceof RegExp) { + errMsgMatcher = errorLike; + errorLike = null; } - /** - * ### .notIncludeDeepOrderedMembers(superset, subset, [message]) - * - * Asserts that `subset` isn't included in `superset` in the same order - * beginning with the first element in `superset`. Uses a deep equality - * check. - * - * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { f: 5 } ], 'not include deep ordered members'); - * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 } ], 'not include deep ordered members'); - * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { c: 3 } ], 'not include deep ordered members'); - * - * @name notIncludeDeepOrderedMembers - * @param {Array} superset - * @param {Array} subset - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) { - new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true) - .to.not.include.deep.ordered.members(subset); + new Assertion(fn, msg, assert.doesNotThrow, true) + .to.not.throw(errorLike, errMsgMatcher); +}; + +/** + * ### .operator(val1, operator, val2, [message]) + * + * Compares two values using `operator`. + * + * assert.operator(1, '<', 2, 'everything is ok'); + * assert.operator(1, '>', 2, 'this will fail'); + * + * @name operator + * @param {Mixed} val1 + * @param {String} operator + * @param {Mixed} val2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.operator = function (val, operator, val2, msg) { + var ok; + switch(operator) { + case '==': + ok = val == val2; + break; + case '===': + ok = val === val2; + break; + case '>': + ok = val > val2; + break; + case '>=': + ok = val >= val2; + break; + case '<': + ok = val < val2; + break; + case '<=': + ok = val <= val2; + break; + case '!=': + ok = val != val2; + break; + case '!==': + ok = val !== val2; + break; + default: + msg = msg ? msg + ': ' : msg; + throw new AssertionError( + msg + 'Invalid operator "' + operator + '"', + undefined, + assert.operator + ); } + var test = new Assertion(ok, msg, assert.operator, true); + test.assert( + true === flag(test, 'object') + , 'expected ' + inspect(val) + ' to be ' + operator + ' ' + inspect(val2) + , 'expected ' + inspect(val) + ' to not be ' + operator + ' ' + inspect(val2) ); +}; - /** - * ### .oneOf(inList, list, [message]) - * - * Asserts that non-object, non-array value `inList` appears in the flat array `list`. - * - * assert.oneOf(1, [ 2, 1 ], 'Not found in list'); - * - * @name oneOf - * @param {*} inList - * @param {Array<*>} list - * @param {String} message - * @namespace Assert - * @api public - */ - - assert.oneOf = function (inList, list, msg) { - new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list); +/** + * ### .closeTo(actual, expected, delta, [message]) + * + * Asserts that the target is equal `expected`, to within a +/- `delta` range. + * + * assert.closeTo(1.5, 1, 0.5, 'numbers are close'); + * + * @name closeTo + * @param {Number} actual + * @param {Number} expected + * @param {Number} delta + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.closeTo = function (act, exp, delta, msg) { + new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta); +}; + +/** + * ### .approximately(actual, expected, delta, [message]) + * + * Asserts that the target is equal `expected`, to within a +/- `delta` range. + * + * assert.approximately(1.5, 1, 0.5, 'numbers are close'); + * + * @name approximately + * @param {Number} actual + * @param {Number} expected + * @param {Number} delta + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.approximately = function (act, exp, delta, msg) { + new Assertion(act, msg, assert.approximately, true) + .to.be.approximately(exp, delta); +}; + +/** + * ### .sameMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` have the same members in any order. Uses a + * strict equality check (===). + * + * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members'); + * + * @name sameMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.sameMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.sameMembers, true) + .to.have.same.members(set2); +} + +/** + * ### .notSameMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` don't have the same members in any order. + * Uses a strict equality check (===). + * + * assert.notSameMembers([ 1, 2, 3 ], [ 5, 1, 3 ], 'not same members'); + * + * @name notSameMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notSameMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.notSameMembers, true) + .to.not.have.same.members(set2); +} + +/** + * ### .sameDeepMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` have the same members in any order. Uses a + * deep equality check. + * + * assert.sameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { c: 3 }], 'same deep members'); + * + * @name sameDeepMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.sameDeepMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.sameDeepMembers, true) + .to.have.same.deep.members(set2); +} + +/** + * ### .notSameDeepMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` don't have the same members in any order. + * Uses a deep equality check. + * + * assert.notSameDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [{ b: 2 }, { a: 1 }, { f: 5 }], 'not same deep members'); + * + * @name notSameDeepMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notSameDeepMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.notSameDeepMembers, true) + .to.not.have.same.deep.members(set2); +} + +/** + * ### .sameOrderedMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` have the same members in the same order. + * Uses a strict equality check (===). + * + * assert.sameOrderedMembers([ 1, 2, 3 ], [ 1, 2, 3 ], 'same ordered members'); + * + * @name sameOrderedMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.sameOrderedMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.sameOrderedMembers, true) + .to.have.same.ordered.members(set2); +} + +/** + * ### .notSameOrderedMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` don't have the same members in the same + * order. Uses a strict equality check (===). + * + * assert.notSameOrderedMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'not same ordered members'); + * + * @name notSameOrderedMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notSameOrderedMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.notSameOrderedMembers, true) + .to.not.have.same.ordered.members(set2); +} + +/** + * ### .sameDeepOrderedMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` have the same members in the same order. + * Uses a deep equality check. + * + * assert.sameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { c: 3 } ], 'same deep ordered members'); + * + * @name sameDeepOrderedMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.sameDeepOrderedMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.sameDeepOrderedMembers, true) + .to.have.same.deep.ordered.members(set2); +} + +/** + * ### .notSameDeepOrderedMembers(set1, set2, [message]) + * + * Asserts that `set1` and `set2` don't have the same members in the same + * order. Uses a deep equality check. + * + * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 }, { z: 5 } ], 'not same deep ordered members'); + * assert.notSameDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { c: 3 } ], 'not same deep ordered members'); + * + * @name notSameDeepOrderedMembers + * @param {Array} set1 + * @param {Array} set2 + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notSameDeepOrderedMembers = function (set1, set2, msg) { + new Assertion(set1, msg, assert.notSameDeepOrderedMembers, true) + .to.not.have.same.deep.ordered.members(set2); +} + +/** + * ### .includeMembers(superset, subset, [message]) + * + * Asserts that `subset` is included in `superset` in any order. Uses a + * strict equality check (===). Duplicates are ignored. + * + * assert.includeMembers([ 1, 2, 3 ], [ 2, 1, 2 ], 'include members'); + * + * @name includeMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.includeMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.includeMembers, true) + .to.include.members(subset); +} + +/** + * ### .notIncludeMembers(superset, subset, [message]) + * + * Asserts that `subset` isn't included in `superset` in any order. Uses a + * strict equality check (===). Duplicates are ignored. + * + * assert.notIncludeMembers([ 1, 2, 3 ], [ 5, 1 ], 'not include members'); + * + * @name notIncludeMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notIncludeMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.notIncludeMembers, true) + .to.not.include.members(subset); +} + +/** + * ### .includeDeepMembers(superset, subset, [message]) + * + * Asserts that `subset` is included in `superset` in any order. Uses a deep + * equality check. Duplicates are ignored. + * + * assert.includeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 }, { b: 2 } ], 'include deep members'); + * + * @name includeDeepMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.includeDeepMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.includeDeepMembers, true) + .to.include.deep.members(subset); +} + +/** + * ### .notIncludeDeepMembers(superset, subset, [message]) + * + * Asserts that `subset` isn't included in `superset` in any order. Uses a + * deep equality check. Duplicates are ignored. + * + * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members'); + * + * @name notIncludeDeepMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notIncludeDeepMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.notIncludeDeepMembers, true) + .to.not.include.deep.members(subset); +} + +/** + * ### .includeOrderedMembers(superset, subset, [message]) + * + * Asserts that `subset` is included in `superset` in the same order + * beginning with the first element in `superset`. Uses a strict equality + * check (===). + * + * assert.includeOrderedMembers([ 1, 2, 3 ], [ 1, 2 ], 'include ordered members'); + * + * @name includeOrderedMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.includeOrderedMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.includeOrderedMembers, true) + .to.include.ordered.members(subset); +} + +/** + * ### .notIncludeOrderedMembers(superset, subset, [message]) + * + * Asserts that `subset` isn't included in `superset` in the same order + * beginning with the first element in `superset`. Uses a strict equality + * check (===). + * + * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 1 ], 'not include ordered members'); + * assert.notIncludeOrderedMembers([ 1, 2, 3 ], [ 2, 3 ], 'not include ordered members'); + * + * @name notIncludeOrderedMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notIncludeOrderedMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.notIncludeOrderedMembers, true) + .to.not.include.ordered.members(subset); +} + +/** + * ### .includeDeepOrderedMembers(superset, subset, [message]) + * + * Asserts that `subset` is included in `superset` in the same order + * beginning with the first element in `superset`. Uses a deep equality + * check. + * + * assert.includeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { b: 2 } ], 'include deep ordered members'); + * + * @name includeDeepOrderedMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.includeDeepOrderedMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.includeDeepOrderedMembers, true) + .to.include.deep.ordered.members(subset); +} + +/** + * ### .notIncludeDeepOrderedMembers(superset, subset, [message]) + * + * Asserts that `subset` isn't included in `superset` in the same order + * beginning with the first element in `superset`. Uses a deep equality + * check. + * + * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { a: 1 }, { f: 5 } ], 'not include deep ordered members'); + * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { a: 1 } ], 'not include deep ordered members'); + * assert.notIncludeDeepOrderedMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { c: 3 } ], 'not include deep ordered members'); + * + * @name notIncludeDeepOrderedMembers + * @param {Array} superset + * @param {Array} subset + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.notIncludeDeepOrderedMembers = function (superset, subset, msg) { + new Assertion(superset, msg, assert.notIncludeDeepOrderedMembers, true) + .to.not.include.deep.ordered.members(subset); +} + +/** + * ### .oneOf(inList, list, [message]) + * + * Asserts that non-object, non-array value `inList` appears in the flat array `list`. + * + * assert.oneOf(1, [ 2, 1 ], 'Not found in list'); + * + * @name oneOf + * @param {*} inList + * @param {Array<*>} list + * @param {String} message + * @namespace Assert + * @api public + */ + +assert.oneOf = function (inList, list, msg) { + new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list); +} + +/** + * ### .changes(function, object, property, [message]) + * + * Asserts that a function changes the value of a property. + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 22 }; + * assert.changes(fn, obj, 'val'); + * + * @name changes + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.changes = function (fn, obj, prop, msg) { + if (arguments.length === 3 && typeof obj === 'function') { + msg = prop; + prop = null; } - /** - * ### .changes(function, object, property, [message]) - * - * Asserts that a function changes the value of a property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 22 }; - * assert.changes(fn, obj, 'val'); - * - * @name changes - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.changes = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - new Assertion(fn, msg, assert.changes, true).to.change(obj, prop); + new Assertion(fn, msg, assert.changes, true).to.change(obj, prop); +} + + /** + * ### .changesBy(function, object, property, delta, [message]) + * + * Asserts that a function changes the value of a property by an amount (delta). + * + * var obj = { val: 10 }; + * var fn = function() { obj.val += 2 }; + * assert.changesBy(fn, obj, 'val', 2); + * + * @name changesBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.changesBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .changesBy(function, object, property, delta, [message]) - * - * Asserts that a function changes the value of a property by an amount (delta). - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 2 }; - * assert.changesBy(fn, obj, 'val', 2); - * - * @name changesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.changesBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.changesBy, true) - .to.change(obj, prop).by(delta); + new Assertion(fn, msg, assert.changesBy, true) + .to.change(obj, prop).by(delta); +} + + /** + * ### .doesNotChange(function, object, property, [message]) + * + * Asserts that a function does not change the value of a property. + * + * var obj = { val: 10 }; + * var fn = function() { console.log('foo'); }; + * assert.doesNotChange(fn, obj, 'val'); + * + * @name doesNotChange + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.doesNotChange = function (fn, obj, prop, msg) { + if (arguments.length === 3 && typeof obj === 'function') { + msg = prop; + prop = null; } - /** - * ### .doesNotChange(function, object, property, [message]) - * - * Asserts that a function does not change the value of a property. - * - * var obj = { val: 10 }; - * var fn = function() { console.log('foo'); }; - * assert.doesNotChange(fn, obj, 'val'); - * - * @name doesNotChange - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotChange = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotChange, true) - .to.not.change(obj, prop); + return new Assertion(fn, msg, assert.doesNotChange, true) + .to.not.change(obj, prop); +} + +/** + * ### .changesButNotBy(function, object, property, delta, [message]) + * + * Asserts that a function does not change the value of a property or of a function's return value by an amount (delta) + * + * var obj = { val: 10 }; + * var fn = function() { obj.val += 10 }; + * assert.changesButNotBy(fn, obj, 'val', 5); + * + * @name changesButNotBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.changesButNotBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .changesButNotBy(function, object, property, delta, [message]) - * - * Asserts that a function does not change the value of a property or of a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 10 }; - * assert.changesButNotBy(fn, obj, 'val', 5); - * - * @name changesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.changesButNotBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.changesButNotBy, true) - .to.change(obj, prop).but.not.by(delta); + new Assertion(fn, msg, assert.changesButNotBy, true) + .to.change(obj, prop).but.not.by(delta); +} + +/** + * ### .increases(function, object, property, [message]) + * + * Asserts that a function increases a numeric object property. + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 13 }; + * assert.increases(fn, obj, 'val'); + * + * @name increases + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.increases = function (fn, obj, prop, msg) { + if (arguments.length === 3 && typeof obj === 'function') { + msg = prop; + prop = null; } - /** - * ### .increases(function, object, property, [message]) - * - * Asserts that a function increases a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 13 }; - * assert.increases(fn, obj, 'val'); - * - * @name increases - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.increases = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.increases, true) - .to.increase(obj, prop); + return new Assertion(fn, msg, assert.increases, true) + .to.increase(obj, prop); +} + +/** + * ### .increasesBy(function, object, property, delta, [message]) + * + * Asserts that a function increases a numeric object property or a function's return value by an amount (delta). + * + * var obj = { val: 10 }; + * var fn = function() { obj.val += 10 }; + * assert.increasesBy(fn, obj, 'val', 10); + * + * @name increasesBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.increasesBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .increasesBy(function, object, property, delta, [message]) - * - * Asserts that a function increases a numeric object property or a function's return value by an amount (delta). - * - * var obj = { val: 10 }; - * var fn = function() { obj.val += 10 }; - * assert.increasesBy(fn, obj, 'val', 10); - * - * @name increasesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.increasesBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.increasesBy, true) - .to.increase(obj, prop).by(delta); + new Assertion(fn, msg, assert.increasesBy, true) + .to.increase(obj, prop).by(delta); +} + +/** + * ### .doesNotIncrease(function, object, property, [message]) + * + * Asserts that a function does not increase a numeric object property. + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 8 }; + * assert.doesNotIncrease(fn, obj, 'val'); + * + * @name doesNotIncrease + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.doesNotIncrease = function (fn, obj, prop, msg) { + if (arguments.length === 3 && typeof obj === 'function') { + msg = prop; + prop = null; } - /** - * ### .doesNotIncrease(function, object, property, [message]) - * - * Asserts that a function does not increase a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 8 }; - * assert.doesNotIncrease(fn, obj, 'val'); - * - * @name doesNotIncrease - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotIncrease = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotIncrease, true) - .to.not.increase(obj, prop); + return new Assertion(fn, msg, assert.doesNotIncrease, true) + .to.not.increase(obj, prop); +} + +/** + * ### .increasesButNotBy(function, object, property, delta, [message]) + * + * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta). + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 15 }; + * assert.increasesButNotBy(fn, obj, 'val', 10); + * + * @name increasesButNotBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.increasesButNotBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .increasesButNotBy(function, object, property, delta, [message]) - * - * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta). - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * assert.increasesButNotBy(fn, obj, 'val', 10); - * - * @name increasesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.increasesButNotBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.increasesButNotBy, true) - .to.increase(obj, prop).but.not.by(delta); + new Assertion(fn, msg, assert.increasesButNotBy, true) + .to.increase(obj, prop).but.not.by(delta); +} + +/** + * ### .decreases(function, object, property, [message]) + * + * Asserts that a function decreases a numeric object property. + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 5 }; + * assert.decreases(fn, obj, 'val'); + * + * @name decreases + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.decreases = function (fn, obj, prop, msg) { + if (arguments.length === 3 && typeof obj === 'function') { + msg = prop; + prop = null; } - /** - * ### .decreases(function, object, property, [message]) - * - * Asserts that a function decreases a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.decreases(fn, obj, 'val'); - * - * @name decreases - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.decreases = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.decreases, true) - .to.decrease(obj, prop); + return new Assertion(fn, msg, assert.decreases, true) + .to.decrease(obj, prop); +} + +/** + * ### .decreasesBy(function, object, property, delta, [message]) + * + * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta) + * + * var obj = { val: 10 }; + * var fn = function() { obj.val -= 5 }; + * assert.decreasesBy(fn, obj, 'val', 5); + * + * @name decreasesBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.decreasesBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .decreasesBy(function, object, property, delta, [message]) - * - * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val -= 5 }; - * assert.decreasesBy(fn, obj, 'val', 5); - * - * @name decreasesBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.decreasesBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.decreasesBy, true) - .to.decrease(obj, prop).by(delta); + new Assertion(fn, msg, assert.decreasesBy, true) + .to.decrease(obj, prop).by(delta); +} + +/** + * ### .doesNotDecrease(function, object, property, [message]) + * + * Asserts that a function does not decreases a numeric object property. + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 15 }; + * assert.doesNotDecrease(fn, obj, 'val'); + * + * @name doesNotDecrease + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.doesNotDecrease = function (fn, obj, prop, msg) { + if (arguments.length === 3 && typeof obj === 'function') { + msg = prop; + prop = null; } - /** - * ### .doesNotDecrease(function, object, property, [message]) - * - * Asserts that a function does not decreases a numeric object property. - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 15 }; - * assert.doesNotDecrease(fn, obj, 'val'); - * - * @name doesNotDecrease - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotDecrease = function (fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === 'function') { - msg = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotDecrease, true) - .to.not.decrease(obj, prop); + return new Assertion(fn, msg, assert.doesNotDecrease, true) + .to.not.decrease(obj, prop); +} + +/** + * ### .doesNotDecreaseBy(function, object, property, delta, [message]) + * + * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 5 }; + * assert.doesNotDecreaseBy(fn, obj, 'val', 1); + * + * @name doesNotDecreaseBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .doesNotDecreaseBy(function, object, property, delta, [message]) - * - * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.doesNotDecreaseBy(fn, obj, 'val', 1); - * - * @name doesNotDecreaseBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.doesNotDecreaseBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - return new Assertion(fn, msg, assert.doesNotDecreaseBy, true) - .to.not.decrease(obj, prop).by(delta); + return new Assertion(fn, msg, assert.doesNotDecreaseBy, true) + .to.not.decrease(obj, prop).by(delta); +} + +/** + * ### .decreasesButNotBy(function, object, property, delta, [message]) + * + * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) + * + * var obj = { val: 10 }; + * var fn = function() { obj.val = 5 }; + * assert.decreasesButNotBy(fn, obj, 'val', 1); + * + * @name decreasesButNotBy + * @param {Function} modifier function + * @param {Object} object or getter function + * @param {String} property name _optional_ + * @param {Number} change amount (delta) + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) { + if (arguments.length === 4 && typeof obj === 'function') { + var tmpMsg = delta; + delta = prop; + msg = tmpMsg; + } else if (arguments.length === 3) { + delta = prop; + prop = null; } - /** - * ### .decreasesButNotBy(function, object, property, delta, [message]) - * - * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) - * - * var obj = { val: 10 }; - * var fn = function() { obj.val = 5 }; - * assert.decreasesButNotBy(fn, obj, 'val', 1); - * - * @name decreasesButNotBy - * @param {Function} modifier function - * @param {Object} object or getter function - * @param {String} property name _optional_ - * @param {Number} change amount (delta) - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.decreasesButNotBy = function (fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === 'function') { - var tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - - new Assertion(fn, msg, assert.decreasesButNotBy, true) - .to.decrease(obj, prop).but.not.by(delta); + new Assertion(fn, msg, assert.decreasesButNotBy, true) + .to.decrease(obj, prop).but.not.by(delta); +} + +/*! + * ### .ifError(object) + * + * Asserts if value is not a false value, and throws if it is a true value. + * This is added to allow for chai to be a drop-in replacement for Node's + * assert class. + * + * var err = new Error('I am a custom error'); + * assert.ifError(err); // Rethrows err! + * + * @name ifError + * @param {Object} object + * @namespace Assert + * @api public + */ + +assert.ifError = function (val) { + if (val) { + throw(val); } +}; - /*! - * ### .ifError(object) - * - * Asserts if value is not a false value, and throws if it is a true value. - * This is added to allow for chai to be a drop-in replacement for Node's - * assert class. - * - * var err = new Error('I am a custom error'); - * assert.ifError(err); // Rethrows err! - * - * @name ifError - * @param {Object} object - * @namespace Assert - * @api public - */ - - assert.ifError = function (val) { - if (val) { - throw(val); - } - }; - - /** - * ### .isExtensible(object) - * - * Asserts that `object` is extensible (can have new properties added to it). - * - * assert.isExtensible({}); - * - * @name isExtensible - * @alias extensible - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isExtensible = function (obj, msg) { - new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible; - }; - - /** - * ### .isNotExtensible(object) - * - * Asserts that `object` is _not_ extensible. - * - * var nonExtensibleObject = Object.preventExtensions({}); - * var sealedObject = Object.seal({}); - * var frozenObject = Object.freeze({}); - * - * assert.isNotExtensible(nonExtensibleObject); - * assert.isNotExtensible(sealedObject); - * assert.isNotExtensible(frozenObject); - * - * @name isNotExtensible - * @alias notExtensible - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotExtensible = function (obj, msg) { - new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible; - }; - - /** - * ### .isSealed(object) - * - * Asserts that `object` is sealed (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * var sealedObject = Object.seal({}); - * var frozenObject = Object.seal({}); - * - * assert.isSealed(sealedObject); - * assert.isSealed(frozenObject); - * - * @name isSealed - * @alias sealed - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isSealed = function (obj, msg) { - new Assertion(obj, msg, assert.isSealed, true).to.be.sealed; - }; - - /** - * ### .isNotSealed(object) - * - * Asserts that `object` is _not_ sealed. - * - * assert.isNotSealed({}); - * - * @name isNotSealed - * @alias notSealed - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotSealed = function (obj, msg) { - new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed; - }; - - /** - * ### .isFrozen(object) - * - * Asserts that `object` is frozen (cannot have new properties added to it - * and its existing properties cannot be modified). - * - * var frozenObject = Object.freeze({}); - * assert.frozen(frozenObject); - * - * @name isFrozen - * @alias frozen - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isFrozen = function (obj, msg) { - new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen; - }; - - /** - * ### .isNotFrozen(object) - * - * Asserts that `object` is _not_ frozen. - * - * assert.isNotFrozen({}); - * - * @name isNotFrozen - * @alias notFrozen - * @param {Object} object - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotFrozen = function (obj, msg) { - new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen; - }; - - /** - * ### .isEmpty(target) - * - * Asserts that the target does not contain any values. - * For arrays and strings, it checks the `length` property. - * For `Map` and `Set` instances, it checks the `size` property. - * For non-function objects, it gets the count of own - * enumerable string keys. - * - * assert.isEmpty([]); - * assert.isEmpty(''); - * assert.isEmpty(new Map); - * assert.isEmpty({}); - * - * @name isEmpty - * @alias empty - * @param {Object|Array|String|Map|Set} target - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isEmpty = function(val, msg) { - new Assertion(val, msg, assert.isEmpty, true).to.be.empty; - }; - - /** - * ### .isNotEmpty(target) - * - * Asserts that the target contains values. - * For arrays and strings, it checks the `length` property. - * For `Map` and `Set` instances, it checks the `size` property. - * For non-function objects, it gets the count of own - * enumerable string keys. - * - * assert.isNotEmpty([1, 2]); - * assert.isNotEmpty('34'); - * assert.isNotEmpty(new Set([5, 6])); - * assert.isNotEmpty({ key: 7 }); - * - * @name isNotEmpty - * @alias notEmpty - * @param {Object|Array|String|Map|Set} target - * @param {String} message _optional_ - * @namespace Assert - * @api public - */ - - assert.isNotEmpty = function(val, msg) { - new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty; - }; - - /*! - * Aliases. - */ - - (function alias(name, as){ - assert[as] = assert[name]; - return alias; - }) - ('isOk', 'ok') - ('isNotOk', 'notOk') - ('throws', 'throw') - ('throws', 'Throw') - ('isExtensible', 'extensible') - ('isNotExtensible', 'notExtensible') - ('isSealed', 'sealed') - ('isNotSealed', 'notSealed') - ('isFrozen', 'frozen') - ('isNotFrozen', 'notFrozen') - ('isEmpty', 'empty') - ('isNotEmpty', 'notEmpty'); +/** + * ### .isExtensible(object) + * + * Asserts that `object` is extensible (can have new properties added to it). + * + * assert.isExtensible({}); + * + * @name isExtensible + * @alias extensible + * @param {Object} object + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isExtensible = function (obj, msg) { + new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible; }; + +/** + * ### .isNotExtensible(object) + * + * Asserts that `object` is _not_ extensible. + * + * var nonExtensibleObject = Object.preventExtensions({}); + * var sealedObject = Object.seal({}); + * var frozenObject = Object.freeze({}); + * + * assert.isNotExtensible(nonExtensibleObject); + * assert.isNotExtensible(sealedObject); + * assert.isNotExtensible(frozenObject); + * + * @name isNotExtensible + * @alias notExtensible + * @param {Object} object + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isNotExtensible = function (obj, msg) { + new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible; +}; + +/** + * ### .isSealed(object) + * + * Asserts that `object` is sealed (cannot have new properties added to it + * and its existing properties cannot be removed). + * + * var sealedObject = Object.seal({}); + * var frozenObject = Object.seal({}); + * + * assert.isSealed(sealedObject); + * assert.isSealed(frozenObject); + * + * @name isSealed + * @alias sealed + * @param {Object} object + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isSealed = function (obj, msg) { + new Assertion(obj, msg, assert.isSealed, true).to.be.sealed; +}; + +/** + * ### .isNotSealed(object) + * + * Asserts that `object` is _not_ sealed. + * + * assert.isNotSealed({}); + * + * @name isNotSealed + * @alias notSealed + * @param {Object} object + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isNotSealed = function (obj, msg) { + new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed; +}; + +/** + * ### .isFrozen(object) + * + * Asserts that `object` is frozen (cannot have new properties added to it + * and its existing properties cannot be modified). + * + * var frozenObject = Object.freeze({}); + * assert.frozen(frozenObject); + * + * @name isFrozen + * @alias frozen + * @param {Object} object + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isFrozen = function (obj, msg) { + new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen; +}; + +/** + * ### .isNotFrozen(object) + * + * Asserts that `object` is _not_ frozen. + * + * assert.isNotFrozen({}); + * + * @name isNotFrozen + * @alias notFrozen + * @param {Object} object + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isNotFrozen = function (obj, msg) { + new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen; +}; + +/** + * ### .isEmpty(target) + * + * Asserts that the target does not contain any values. + * For arrays and strings, it checks the `length` property. + * For `Map` and `Set` instances, it checks the `size` property. + * For non-function objects, it gets the count of own + * enumerable string keys. + * + * assert.isEmpty([]); + * assert.isEmpty(''); + * assert.isEmpty(new Map); + * assert.isEmpty({}); + * + * @name isEmpty + * @alias empty + * @param {Object|Array|String|Map|Set} target + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isEmpty = function(val, msg) { + new Assertion(val, msg, assert.isEmpty, true).to.be.empty; +}; + +/** + * ### .isNotEmpty(target) + * + * Asserts that the target contains values. + * For arrays and strings, it checks the `length` property. + * For `Map` and `Set` instances, it checks the `size` property. + * For non-function objects, it gets the count of own + * enumerable string keys. + * + * assert.isNotEmpty([1, 2]); + * assert.isNotEmpty('34'); + * assert.isNotEmpty(new Set([5, 6])); + * assert.isNotEmpty({ key: 7 }); + * + * @name isNotEmpty + * @alias notEmpty + * @param {Object|Array|String|Map|Set} target + * @param {String} message _optional_ + * @namespace Assert + * @api public + */ + +assert.isNotEmpty = function(val, msg) { + new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty; +}; + +/*! + * Aliases. + */ + +(function alias(name, as){ + assert[as] = assert[name]; + return alias; +}) +('isOk', 'ok') +('isNotOk', 'notOk') +('throws', 'throw') +('throws', 'Throw') +('isExtensible', 'extensible') +('isNotExtensible', 'notExtensible') +('isSealed', 'sealed') +('isNotSealed', 'notSealed') +('isFrozen', 'frozen') +('isNotFrozen', 'notFrozen') +('isEmpty', 'empty') +('isNotEmpty', 'notEmpty'); diff --git a/lib/chai/interface/expect.js b/lib/chai/interface/expect.js index 6867e2a93..20caf3b6a 100644 --- a/lib/chai/interface/expect.js +++ b/lib/chai/interface/expect.js @@ -4,44 +4,46 @@ * MIT Licensed */ -module.exports = function (chai, util) { - chai.expect = function (val, message) { - return new chai.Assertion(val, message); - }; +import {Assertion} from '../assertion.js'; +import AssertionError from 'assertion-error'; - /** - * ### .fail([message]) - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * expect.fail(); - * expect.fail("custom error message"); - * expect.fail(1, 2); - * expect.fail(1, 2, "custom error message"); - * expect.fail(1, 2, "custom error message", ">"); - * expect.fail(1, 2, undefined, ">"); - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @namespace BDD - * @api public - */ +function expect(val, message) { + return new Assertion(val, message); +} - chai.expect.fail = function (actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = undefined; - } +export {expect}; +/** + * ### .fail([message]) + * ### .fail(actual, expected, [message], [operator]) + * + * Throw a failure. + * + * expect.fail(); + * expect.fail("custom error message"); + * expect.fail(1, 2); + * expect.fail(1, 2, "custom error message"); + * expect.fail(1, 2, "custom error message", ">"); + * expect.fail(1, 2, undefined, ">"); + * + * @name fail + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @param {String} operator + * @namespace BDD + * @api public + */ + +expect.fail = function (actual, expected, message, operator) { + if (arguments.length < 2) { + message = actual; + actual = undefined; + } - message = message || 'expect.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, chai.expect.fail); - }; + message = message || 'expect.fail()'; + throw new AssertionError(message, { + actual: actual + , expected: expected + , operator: operator + }, chai.expect.fail); }; diff --git a/lib/chai/interface/should.js b/lib/chai/interface/should.js index 17902af7d..841788fd8 100644 --- a/lib/chai/interface/should.js +++ b/lib/chai/interface/should.js @@ -4,216 +4,215 @@ * MIT Licensed */ -module.exports = function (chai, util) { - var Assertion = chai.Assertion; - - function loadShould () { - // explicitly define this method as function as to have it's name to include as `ssfi` - function shouldGetter() { - if (this instanceof String - || this instanceof Number - || this instanceof Boolean - || typeof Symbol === 'function' && this instanceof Symbol - || typeof BigInt === 'function' && this instanceof BigInt) { - return new Assertion(this.valueOf(), null, shouldGetter); - } - return new Assertion(this, null, shouldGetter); +import {Assertion} from '../assertion.js'; +import AssertionError from 'assertion-error'; + +function loadShould () { + // explicitly define this method as function as to have it's name to include as `ssfi` + function shouldGetter() { + if (this instanceof String + || this instanceof Number + || this instanceof Boolean + || typeof Symbol === 'function' && this instanceof Symbol + || typeof BigInt === 'function' && this instanceof BigInt) { + return new Assertion(this.valueOf(), null, shouldGetter); } - function shouldSetter(value) { - // See https://github.com/chaijs/chai/issues/86: this makes - // `whatever.should = someValue` actually set `someValue`, which is - // especially useful for `global.should = require('chai').should()`. - // - // Note that we have to use [[DefineProperty]] instead of [[Put]] - // since otherwise we would trigger this very setter! - Object.defineProperty(this, 'should', { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } - // modify Object.prototype to have `should` - Object.defineProperty(Object.prototype, 'should', { - set: shouldSetter - , get: shouldGetter - , configurable: true + return new Assertion(this, null, shouldGetter); + } + function shouldSetter(value) { + // See https://github.com/chaijs/chai/issues/86: this makes + // `whatever.should = someValue` actually set `someValue`, which is + // especially useful for `global.should = require('chai').should()`. + // + // Note that we have to use [[DefineProperty]] instead of [[Put]] + // since otherwise we would trigger this very setter! + Object.defineProperty(this, 'should', { + value: value, + enumerable: true, + configurable: true, + writable: true }); - - var should = {}; - - /** - * ### .fail([message]) - * ### .fail(actual, expected, [message], [operator]) - * - * Throw a failure. - * - * should.fail(); - * should.fail("custom error message"); - * should.fail(1, 2); - * should.fail(1, 2, "custom error message"); - * should.fail(1, 2, "custom error message", ">"); - * should.fail(1, 2, undefined, ">"); - * - * - * @name fail - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @param {String} operator - * @namespace BDD - * @api public - */ - - should.fail = function (actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = undefined; - } - - message = message || 'should.fail()'; - throw new chai.AssertionError(message, { - actual: actual - , expected: expected - , operator: operator - }, should.fail); - }; - - /** - * ### .equal(actual, expected, [message]) - * - * Asserts non-strict equality (`==`) of `actual` and `expected`. - * - * should.equal(3, '3', '== coerces values to strings'); - * - * @name equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Should - * @api public - */ - - should.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.equal(val2); - }; - - /** - * ### .throw(function, [constructor/string/regexp], [string/regexp], [message]) - * - * Asserts that `function` will throw an error that is an instance of - * `constructor`, or alternately that it will throw an error with message - * matching `regexp`. - * - * should.throw(fn, 'function throws a reference error'); - * should.throw(fn, /function throws a reference error/); - * should.throw(fn, ReferenceError); - * should.throw(fn, ReferenceError, 'function throws a reference error'); - * should.throw(fn, ReferenceError, /function throws a reference error/); - * - * @name throw - * @alias Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Should - * @api public - */ - - should.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.Throw(errt, errs); - }; - - /** - * ### .exist - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var foo = 'hi'; - * - * should.exist(foo, 'foo exists'); - * - * @name exist - * @namespace Should - * @api public - */ - - should.exist = function (val, msg) { - new Assertion(val, msg).to.exist; + } + // modify Object.prototype to have `should` + Object.defineProperty(Object.prototype, 'should', { + set: shouldSetter + , get: shouldGetter + , configurable: true + }); + + var should = {}; + + /** + * ### .fail([message]) + * ### .fail(actual, expected, [message], [operator]) + * + * Throw a failure. + * + * should.fail(); + * should.fail("custom error message"); + * should.fail(1, 2); + * should.fail(1, 2, "custom error message"); + * should.fail(1, 2, "custom error message", ">"); + * should.fail(1, 2, undefined, ">"); + * + * + * @name fail + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @param {String} operator + * @namespace BDD + * @api public + */ + + should.fail = function (actual, expected, message, operator) { + if (arguments.length < 2) { + message = actual; + actual = undefined; } - // negation - should.not = {} - - /** - * ### .not.equal(actual, expected, [message]) - * - * Asserts non-strict inequality (`!=`) of `actual` and `expected`. - * - * should.not.equal(3, 4, 'these numbers are not equal'); - * - * @name not.equal - * @param {Mixed} actual - * @param {Mixed} expected - * @param {String} message - * @namespace Should - * @api public - */ - - should.not.equal = function (val1, val2, msg) { - new Assertion(val1, msg).to.not.equal(val2); - }; - - /** - * ### .throw(function, [constructor/regexp], [message]) - * - * Asserts that `function` will _not_ throw an error that is an instance of - * `constructor`, or alternately that it will not throw an error with message - * matching `regexp`. - * - * should.not.throw(fn, Error, 'function does not throw'); - * - * @name not.throw - * @alias not.Throw - * @param {Function} function - * @param {ErrorConstructor} constructor - * @param {RegExp} regexp - * @param {String} message - * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types - * @namespace Should - * @api public - */ - - should.not.Throw = function (fn, errt, errs, msg) { - new Assertion(fn, msg).to.not.Throw(errt, errs); - }; - - /** - * ### .not.exist - * - * Asserts that the target is neither `null` nor `undefined`. - * - * var bar = null; - * - * should.not.exist(bar, 'bar does not exist'); - * - * @name not.exist - * @namespace Should - * @api public - */ - - should.not.exist = function (val, msg) { - new Assertion(val, msg).to.not.exist; - } + message = message || 'should.fail()'; + throw new AssertionError(message, { + actual: actual + , expected: expected + , operator: operator + }, should.fail); + }; + + /** + * ### .equal(actual, expected, [message]) + * + * Asserts non-strict equality (`==`) of `actual` and `expected`. + * + * should.equal(3, '3', '== coerces values to strings'); + * + * @name equal + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Should + * @api public + */ + + should.equal = function (val1, val2, msg) { + new Assertion(val1, msg).to.equal(val2); + }; - should['throw'] = should['Throw']; - should.not['throw'] = should.not['Throw']; + /** + * ### .throw(function, [constructor/string/regexp], [string/regexp], [message]) + * + * Asserts that `function` will throw an error that is an instance of + * `constructor`, or alternately that it will throw an error with message + * matching `regexp`. + * + * should.throw(fn, 'function throws a reference error'); + * should.throw(fn, /function throws a reference error/); + * should.throw(fn, ReferenceError); + * should.throw(fn, ReferenceError, 'function throws a reference error'); + * should.throw(fn, ReferenceError, /function throws a reference error/); + * + * @name throw + * @alias Throw + * @param {Function} function + * @param {ErrorConstructor} constructor + * @param {RegExp} regexp + * @param {String} message + * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types + * @namespace Should + * @api public + */ + + should.Throw = function (fn, errt, errs, msg) { + new Assertion(fn, msg).to.Throw(errt, errs); + }; - return should; + /** + * ### .exist + * + * Asserts that the target is neither `null` nor `undefined`. + * + * var foo = 'hi'; + * + * should.exist(foo, 'foo exists'); + * + * @name exist + * @namespace Should + * @api public + */ + + should.exist = function (val, msg) { + new Assertion(val, msg).to.exist; + } + + // negation + should.not = {} + + /** + * ### .not.equal(actual, expected, [message]) + * + * Asserts non-strict inequality (`!=`) of `actual` and `expected`. + * + * should.not.equal(3, 4, 'these numbers are not equal'); + * + * @name not.equal + * @param {Mixed} actual + * @param {Mixed} expected + * @param {String} message + * @namespace Should + * @api public + */ + + should.not.equal = function (val1, val2, msg) { + new Assertion(val1, msg).to.not.equal(val2); }; - chai.should = loadShould; - chai.Should = loadShould; + /** + * ### .throw(function, [constructor/regexp], [message]) + * + * Asserts that `function` will _not_ throw an error that is an instance of + * `constructor`, or alternately that it will not throw an error with message + * matching `regexp`. + * + * should.not.throw(fn, Error, 'function does not throw'); + * + * @name not.throw + * @alias not.Throw + * @param {Function} function + * @param {ErrorConstructor} constructor + * @param {RegExp} regexp + * @param {String} message + * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types + * @namespace Should + * @api public + */ + + should.not.Throw = function (fn, errt, errs, msg) { + new Assertion(fn, msg).to.not.Throw(errt, errs); + }; + + /** + * ### .not.exist + * + * Asserts that the target is neither `null` nor `undefined`. + * + * var bar = null; + * + * should.not.exist(bar, 'bar does not exist'); + * + * @name not.exist + * @namespace Should + * @api public + */ + + should.not.exist = function (val, msg) { + new Assertion(val, msg).to.not.exist; + } + + should['throw'] = should['Throw']; + should.not['throw'] = should.not['Throw']; + + return should; }; + +export const should = loadShould; +export const Should = loadShould; diff --git a/lib/chai/utils/addChainableMethod.js b/lib/chai/utils/addChainableMethod.js index a713f6ac8..aaf8baaa2 100644 --- a/lib/chai/utils/addChainableMethod.js +++ b/lib/chai/utils/addChainableMethod.js @@ -8,11 +8,11 @@ * Module dependencies */ -var addLengthGuard = require('./addLengthGuard'); -var chai = require('../../chai'); -var flag = require('./flag'); -var proxify = require('./proxify'); -var transferFlags = require('./transferFlags'); +import {Assertion} from '../assertion.js'; +import {addLengthGuard} from './addLengthGuard.js'; +import {flag} from './flag.js'; +import {proxify} from './proxify.js'; +import {transferFlags} from './transferFlags.js'; /*! * Module variables @@ -70,7 +70,7 @@ var call = Function.prototype.call, * @api public */ -module.exports = function addChainableMethod(ctx, name, method, chainingBehavior) { +export function addChainableMethod(ctx, name, method, chainingBehavior) { if (typeof chainingBehavior !== 'function') { chainingBehavior = function () { }; } @@ -115,7 +115,7 @@ module.exports = function addChainableMethod(ctx, name, method, chainingBehavior return result; } - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }; @@ -149,4 +149,4 @@ module.exports = function addChainableMethod(ctx, name, method, chainingBehavior } , configurable: true }); -}; +} diff --git a/lib/chai/utils/addLengthGuard.js b/lib/chai/utils/addLengthGuard.js index e51ce80e8..630b64ae5 100644 --- a/lib/chai/utils/addLengthGuard.js +++ b/lib/chai/utils/addLengthGuard.js @@ -1,4 +1,4 @@ -var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length'); +const fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length'); /*! * Chai - addLengthGuard utility @@ -40,7 +40,7 @@ var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length'); * @name addLengthGuard */ -module.exports = function addLengthGuard (fn, assertionName, isChainable) { +export function addLengthGuard(fn, assertionName, isChainable) { if (!fnLengthDesc.configurable) return fn; Object.defineProperty(fn, 'length', { @@ -57,4 +57,4 @@ module.exports = function addLengthGuard (fn, assertionName, isChainable) { }); return fn; -}; +} diff --git a/lib/chai/utils/addMethod.js b/lib/chai/utils/addMethod.js index 021f08042..02fc7bdb1 100644 --- a/lib/chai/utils/addMethod.js +++ b/lib/chai/utils/addMethod.js @@ -4,11 +4,11 @@ * MIT Licensed */ -var addLengthGuard = require('./addLengthGuard'); -var chai = require('../../chai'); -var flag = require('./flag'); -var proxify = require('./proxify'); -var transferFlags = require('./transferFlags'); +import {addLengthGuard} from './addLengthGuard.js'; +import {flag} from './flag.js'; +import {proxify} from './proxify.js'; +import {transferFlags} from './transferFlags.js'; +import {Assertion} from '../assertion.js'; /** * ### .addMethod(ctx, name, method) @@ -36,7 +36,7 @@ var transferFlags = require('./transferFlags'); * @api public */ -module.exports = function addMethod(ctx, name, method) { +export function addMethod(ctx, name, method) { var methodWrapper = function () { // Setting the `ssfi` flag to `methodWrapper` causes this function to be the // starting point for removing implementation frames from the stack trace of @@ -58,11 +58,11 @@ module.exports = function addMethod(ctx, name, method) { if (result !== undefined) return result; - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }; addLengthGuard(methodWrapper, name, false); ctx[name] = proxify(methodWrapper, name); -}; +} diff --git a/lib/chai/utils/addProperty.js b/lib/chai/utils/addProperty.js index 872a8cd7e..7bdfb520a 100644 --- a/lib/chai/utils/addProperty.js +++ b/lib/chai/utils/addProperty.js @@ -4,10 +4,10 @@ * MIT Licensed */ -var chai = require('../../chai'); -var flag = require('./flag'); -var isProxyEnabled = require('./isProxyEnabled'); -var transferFlags = require('./transferFlags'); +import {Assertion} from '../assertion.js'; +import {flag} from './flag.js'; +import {isProxyEnabled} from './isProxyEnabled.js'; +import {transferFlags} from './transferFlags.js'; /** * ### .addProperty(ctx, name, getter) @@ -35,7 +35,7 @@ var transferFlags = require('./transferFlags'); * @api public */ -module.exports = function addProperty(ctx, name, getter) { +export function addProperty(ctx, name, getter) { getter = getter === undefined ? function () {} : getter; Object.defineProperty(ctx, name, @@ -63,10 +63,10 @@ module.exports = function addProperty(ctx, name, getter) { if (result !== undefined) return result; - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; } , configurable: true }); -}; +} diff --git a/lib/chai/utils/compareByInspect.js b/lib/chai/utils/compareByInspect.js index c8cd5e197..ff9f98177 100644 --- a/lib/chai/utils/compareByInspect.js +++ b/lib/chai/utils/compareByInspect.js @@ -8,7 +8,7 @@ * Module dependencies */ -var inspect = require('./inspect'); +import {inspect} from './inspect.js'; /** * ### .compareByInspect(mixed, mixed) @@ -26,6 +26,6 @@ var inspect = require('./inspect'); * @api public */ -module.exports = function compareByInspect(a, b) { +export function compareByInspect(a, b) { return inspect(a) < inspect(b) ? -1 : 1; -}; +} diff --git a/lib/chai/utils/expectTypes.js b/lib/chai/utils/expectTypes.js index 6293db748..4b2b54df2 100644 --- a/lib/chai/utils/expectTypes.js +++ b/lib/chai/utils/expectTypes.js @@ -18,11 +18,11 @@ * @api public */ -var AssertionError = require('assertion-error'); -var flag = require('./flag'); -var type = require('type-detect'); +import AssertionError from 'assertion-error'; +import {flag} from './flag.js'; +import {default as type} from 'type-detect'; -module.exports = function expectTypes(obj, types) { +export function expectTypes(obj, types) { var flagMsg = flag(obj, 'message'); var ssfi = flag(obj, 'ssfi'); @@ -48,4 +48,4 @@ module.exports = function expectTypes(obj, types) { ssfi ); } -}; +} diff --git a/lib/chai/utils/flag.js b/lib/chai/utils/flag.js index dd53bfbf8..79637ad3c 100644 --- a/lib/chai/utils/flag.js +++ b/lib/chai/utils/flag.js @@ -23,11 +23,11 @@ * @api private */ -module.exports = function flag(obj, key, value) { +export function flag(obj, key, value) { var flags = obj.__flags || (obj.__flags = Object.create(null)); if (arguments.length === 3) { flags[key] = value; } else { return flags[key]; } -}; +} diff --git a/lib/chai/utils/getActual.js b/lib/chai/utils/getActual.js index 976e11259..e96046798 100644 --- a/lib/chai/utils/getActual.js +++ b/lib/chai/utils/getActual.js @@ -15,6 +15,6 @@ * @name getActual */ -module.exports = function getActual(obj, args) { +export function getActual(obj, args) { return args.length > 4 ? args[4] : obj._obj; -}; +} diff --git a/lib/chai/utils/getMessage.js b/lib/chai/utils/getMessage.js index bb8371668..97c4826e5 100644 --- a/lib/chai/utils/getMessage.js +++ b/lib/chai/utils/getMessage.js @@ -8,9 +8,9 @@ * Module dependencies */ -var flag = require('./flag') - , getActual = require('./getActual') - , objDisplay = require('./objDisplay'); +import {flag} from './flag.js'; +import {getActual} from './getActual.js'; +import {objDisplay} from './objDisplay.js'; /** * ### .getMessage(object, message, negateMessage) @@ -31,7 +31,7 @@ var flag = require('./flag') * @api public */ -module.exports = function getMessage(obj, args) { +export function getMessage(obj, args) { var negate = flag(obj, 'negate') , val = flag(obj, 'object') , expected = args[3] @@ -47,4 +47,4 @@ module.exports = function getMessage(obj, args) { .replace(/#\{exp\}/g, function () { return objDisplay(expected); }); return flagMsg ? flagMsg + ': ' + msg : msg; -}; +} diff --git a/lib/chai/utils/getOperator.js b/lib/chai/utils/getOperator.js index f7d10ef17..50bd1bf96 100644 --- a/lib/chai/utils/getOperator.js +++ b/lib/chai/utils/getOperator.js @@ -1,6 +1,6 @@ -var type = require('type-detect'); +import {flag} from './flag.js'; +import type from 'type-detect'; -var flag = require('./flag'); function isObjectType(obj) { var objectType = type(obj); @@ -25,7 +25,7 @@ function isObjectType(obj) { * @api public */ -module.exports = function getOperator(obj, args) { +export function getOperator(obj, args) { var operator = flag(obj, 'operator'); var negate = flag(obj, 'negate'); var expected = args[3]; @@ -52,4 +52,4 @@ module.exports = function getOperator(obj, args) { } return isObject ? 'deepStrictEqual' : 'strictEqual'; -}; +} diff --git a/lib/chai/utils/getOwnEnumerableProperties.js b/lib/chai/utils/getOwnEnumerableProperties.js index a4aa83a4c..a54b11000 100644 --- a/lib/chai/utils/getOwnEnumerableProperties.js +++ b/lib/chai/utils/getOwnEnumerableProperties.js @@ -8,7 +8,7 @@ * Module dependencies */ -var getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols'); +import {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols.js'; /** * ### .getOwnEnumerableProperties(object) @@ -24,6 +24,6 @@ var getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols * @api public */ -module.exports = function getOwnEnumerableProperties(obj) { +export function getOwnEnumerableProperties(obj) { return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj)); -}; +} diff --git a/lib/chai/utils/getOwnEnumerablePropertySymbols.js b/lib/chai/utils/getOwnEnumerablePropertySymbols.js index 823c6b7aa..99571c647 100644 --- a/lib/chai/utils/getOwnEnumerablePropertySymbols.js +++ b/lib/chai/utils/getOwnEnumerablePropertySymbols.js @@ -18,10 +18,10 @@ * @api public */ -module.exports = function getOwnEnumerablePropertySymbols(obj) { +export function getOwnEnumerablePropertySymbols(obj) { if (typeof Object.getOwnPropertySymbols !== 'function') return []; return Object.getOwnPropertySymbols(obj).filter(function (sym) { return Object.getOwnPropertyDescriptor(obj, sym).enumerable; }); -}; +} diff --git a/lib/chai/utils/getProperties.js b/lib/chai/utils/getProperties.js index ccf9631ab..99f40a447 100644 --- a/lib/chai/utils/getProperties.js +++ b/lib/chai/utils/getProperties.js @@ -17,7 +17,7 @@ * @api public */ -module.exports = function getProperties(object) { +export function getProperties(object) { var result = Object.getOwnPropertyNames(object); function addProperty(property) { @@ -33,4 +33,4 @@ module.exports = function getProperties(object) { } return result; -}; +} diff --git a/lib/chai/utils/index.js b/lib/chai/utils/index.js index ab6558de0..08c0b0e4e 100644 --- a/lib/chai/utils/index.js +++ b/lib/chai/utils/index.js @@ -8,84 +8,78 @@ * Dependencies that are used for multiple exports are required here only once */ -var pathval = require('pathval'); +import * as checkError from 'check-error'; /*! * test utility */ -exports.test = require('./test'); +export {test} from './test.js'; /*! * type utility */ -exports.type = require('type-detect'); +export {default as type} from 'type-detect'; /*! * expectTypes utility */ -exports.expectTypes = require('./expectTypes'); +export {expectTypes} from './expectTypes.js'; /*! * message utility */ -exports.getMessage = require('./getMessage'); +export {getMessage} from './getMessage.js'; /*! * actual utility */ -exports.getActual = require('./getActual'); +export {getActual} from './getActual.js'; /*! * Inspect util */ -exports.inspect = require('./inspect'); +export {inspect} from './inspect.js'; /*! * Object Display util */ -exports.objDisplay = require('./objDisplay'); +export {objDisplay} from './objDisplay.js'; /*! * Flag utility */ -exports.flag = require('./flag'); +export {flag} from './flag.js'; /*! * Flag transferring utility */ -exports.transferFlags = require('./transferFlags'); +export {transferFlags} from './transferFlags.js'; /*! * Deep equal utility */ -exports.eql = require('deep-eql'); +export {default as eql} from 'deep-eql'; /*! * Deep path info */ -exports.getPathInfo = pathval.getPathInfo; - -/*! - * Check if a property exists - */ - -exports.hasProperty = pathval.hasProperty; +export {getPathInfo, hasProperty} from 'pathval'; /*! * Function name */ -exports.getName = function(fn) { +export function getName(fn) { return fn.name } @@ -93,88 +87,88 @@ exports.getName = function(fn) { * add Property */ -exports.addProperty = require('./addProperty'); +export {addProperty} from './addProperty.js'; /*! * add Method */ -exports.addMethod = require('./addMethod'); +export {addMethod} from './addMethod.js'; /*! * overwrite Property */ -exports.overwriteProperty = require('./overwriteProperty'); +export {overwriteProperty} from './overwriteProperty.js'; /*! * overwrite Method */ -exports.overwriteMethod = require('./overwriteMethod'); +export {overwriteMethod} from './overwriteMethod.js'; /*! * Add a chainable method */ -exports.addChainableMethod = require('./addChainableMethod'); +export {addChainableMethod} from './addChainableMethod.js'; /*! * Overwrite chainable method */ -exports.overwriteChainableMethod = require('./overwriteChainableMethod'); +export {overwriteChainableMethod} from './overwriteChainableMethod.js'; /*! * Compare by inspect method */ -exports.compareByInspect = require('./compareByInspect'); +export {compareByInspect} from './compareByInspect.js'; /*! * Get own enumerable property symbols method */ -exports.getOwnEnumerablePropertySymbols = require('./getOwnEnumerablePropertySymbols'); +export {getOwnEnumerablePropertySymbols} from './getOwnEnumerablePropertySymbols.js'; /*! * Get own enumerable properties method */ -exports.getOwnEnumerableProperties = require('./getOwnEnumerableProperties'); +export {getOwnEnumerableProperties} from './getOwnEnumerableProperties.js'; /*! * Checks error against a given set of criteria */ -exports.checkError = require('check-error'); +export {checkError}; /*! * Proxify util */ -exports.proxify = require('./proxify'); +export {proxify} from './proxify.js'; /*! * addLengthGuard util */ -exports.addLengthGuard = require('./addLengthGuard'); +export {addLengthGuard} from './addLengthGuard.js'; /*! * isProxyEnabled helper */ -exports.isProxyEnabled = require('./isProxyEnabled'); +export {isProxyEnabled} from './isProxyEnabled.js'; /*! * isNaN method */ -exports.isNaN = require('./isNaN'); +export {isNaN} from './isNaN.js'; /*! * getOperator method */ -exports.getOperator = require('./getOperator'); +export {getOperator} from './getOperator.js'; diff --git a/lib/chai/utils/inspect.js b/lib/chai/utils/inspect.js index 1e9f1f9d9..3100c1aa6 100644 --- a/lib/chai/utils/inspect.js +++ b/lib/chai/utils/inspect.js @@ -1,10 +1,8 @@ // This is (almost) directly from Node.js utils // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js -var loupe = require('loupe'); -var config = require('../config'); - -module.exports = inspect; +import {inspect as _inspect} from 'loupe'; +import {config} from '../config.js'; /** * ### .inspect(obj, [showHidden], [depth], [colors]) @@ -21,12 +19,12 @@ module.exports = inspect; * @namespace Utils * @name inspect */ -function inspect(obj, showHidden, depth, colors) { +export function inspect(obj, showHidden, depth, colors) { var options = { colors: colors, depth: (typeof depth === 'undefined' ? 2 : depth), showHidden: showHidden, truncate: config.truncateThreshold ? config.truncateThreshold : Infinity, }; - return loupe.inspect(obj, options); + return _inspect(obj, options); } diff --git a/lib/chai/utils/isNaN.js b/lib/chai/utils/isNaN.js index d64f7f4aa..7b1e0f069 100644 --- a/lib/chai/utils/isNaN.js +++ b/lib/chai/utils/isNaN.js @@ -16,11 +16,11 @@ * @api private */ -function isNaN(value) { +function _isNaN(value) { // Refer http://www.ecma-international.org/ecma-262/6.0/#sec-isnan-number // section's NOTE. return value !== value; } // If ECMAScript 6's Number.isNaN is present, prefer that. -module.exports = Number.isNaN || isNaN; +export const isNaN = Number.isNaN || _isNaN; diff --git a/lib/chai/utils/isProxyEnabled.js b/lib/chai/utils/isProxyEnabled.js index 11e58edfe..780c2a272 100644 --- a/lib/chai/utils/isProxyEnabled.js +++ b/lib/chai/utils/isProxyEnabled.js @@ -1,4 +1,4 @@ -var config = require('../config'); +import {config} from '../config.js'; /*! * Chai - isProxyEnabled helper @@ -17,8 +17,8 @@ var config = require('../config'); * @name isProxyEnabled */ -module.exports = function isProxyEnabled() { +export function isProxyEnabled() { return config.useProxy && typeof Proxy !== 'undefined' && typeof Reflect !== 'undefined'; -}; +} diff --git a/lib/chai/utils/objDisplay.js b/lib/chai/utils/objDisplay.js index 3010f46df..5a8383c05 100644 --- a/lib/chai/utils/objDisplay.js +++ b/lib/chai/utils/objDisplay.js @@ -8,8 +8,8 @@ * Module dependencies */ -var inspect = require('./inspect'); -var config = require('../config'); +import {inspect} from './inspect.js'; +import {config} from '../config.js'; /** * ### .objDisplay(object) @@ -19,12 +19,13 @@ var config = require('../config'); * messages or should be truncated. * * @param {Mixed} javascript object to inspect + * @returns {string} stringified object * @name objDisplay * @namespace Utils * @api public */ -module.exports = function objDisplay(obj) { +export function objDisplay(obj) { var str = inspect(obj) , type = Object.prototype.toString.call(obj); @@ -47,4 +48,4 @@ module.exports = function objDisplay(obj) { } else { return str; } -}; +} diff --git a/lib/chai/utils/overwriteChainableMethod.js b/lib/chai/utils/overwriteChainableMethod.js index 4b38569e4..a7f3f6a15 100644 --- a/lib/chai/utils/overwriteChainableMethod.js +++ b/lib/chai/utils/overwriteChainableMethod.js @@ -4,8 +4,8 @@ * MIT Licensed */ -var chai = require('../../chai'); -var transferFlags = require('./transferFlags'); +import {Assertion} from '../assertion.js'; +import {transferFlags} from './transferFlags.js'; /** * ### .overwriteChainableMethod(ctx, name, method, chainingBehavior) @@ -40,7 +40,7 @@ var transferFlags = require('./transferFlags'); * @api public */ -module.exports = function overwriteChainableMethod(ctx, name, method, chainingBehavior) { +export function overwriteChainableMethod(ctx, name, method, chainingBehavior) { var chainableBehavior = ctx.__methods[name]; var _chainingBehavior = chainableBehavior.chainingBehavior; @@ -50,7 +50,7 @@ module.exports = function overwriteChainableMethod(ctx, name, method, chainingBe return result; } - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }; @@ -62,8 +62,8 @@ module.exports = function overwriteChainableMethod(ctx, name, method, chainingBe return result; } - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; }; -}; +} diff --git a/lib/chai/utils/overwriteMethod.js b/lib/chai/utils/overwriteMethod.js index 7925e05ff..17cb0d916 100644 --- a/lib/chai/utils/overwriteMethod.js +++ b/lib/chai/utils/overwriteMethod.js @@ -4,11 +4,11 @@ * MIT Licensed */ -var addLengthGuard = require('./addLengthGuard'); -var chai = require('../../chai'); -var flag = require('./flag'); -var proxify = require('./proxify'); -var transferFlags = require('./transferFlags'); +import {Assertion} from '../assertion.js'; +import {addLengthGuard} from './addLengthGuard.js'; +import {flag} from './flag.js'; +import {proxify} from './proxify.js'; +import {transferFlags} from './transferFlags.js'; /** * ### .overwriteMethod(ctx, name, fn) @@ -44,7 +44,7 @@ var transferFlags = require('./transferFlags'); * @api public */ -module.exports = function overwriteMethod(ctx, name, method) { +export function overwriteMethod(ctx, name, method) { var _method = ctx[name] , _super = function () { throw new Error(name + ' is not a function'); @@ -82,11 +82,11 @@ module.exports = function overwriteMethod(ctx, name, method) { return result; } - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; } addLengthGuard(overwritingMethodWrapper, name, false); ctx[name] = proxify(overwritingMethodWrapper, name); -}; +} diff --git a/lib/chai/utils/overwriteProperty.js b/lib/chai/utils/overwriteProperty.js index 5f870b02a..defeee257 100644 --- a/lib/chai/utils/overwriteProperty.js +++ b/lib/chai/utils/overwriteProperty.js @@ -4,10 +4,10 @@ * MIT Licensed */ -var chai = require('../../chai'); -var flag = require('./flag'); -var isProxyEnabled = require('./isProxyEnabled'); -var transferFlags = require('./transferFlags'); +import {Assertion} from '../assertion.js'; +import {flag} from './flag.js'; +import {isProxyEnabled} from './isProxyEnabled.js'; +import {transferFlags} from './transferFlags.js'; /** * ### .overwriteProperty(ctx, name, fn) @@ -43,7 +43,7 @@ var transferFlags = require('./transferFlags'); * @api public */ -module.exports = function overwriteProperty(ctx, name, getter) { +export function overwriteProperty(ctx, name, getter) { var _get = Object.getOwnPropertyDescriptor(ctx, name) , _super = function () {}; @@ -83,10 +83,10 @@ module.exports = function overwriteProperty(ctx, name, getter) { return result; } - var newAssertion = new chai.Assertion(); + var newAssertion = new Assertion(); transferFlags(this, newAssertion); return newAssertion; } , configurable: true }); -}; +} diff --git a/lib/chai/utils/proxify.js b/lib/chai/utils/proxify.js index 4bbbee38c..ca1a2c2b1 100644 --- a/lib/chai/utils/proxify.js +++ b/lib/chai/utils/proxify.js @@ -1,7 +1,7 @@ -var config = require('../config'); -var flag = require('./flag'); -var getProperties = require('./getProperties'); -var isProxyEnabled = require('./isProxyEnabled'); +import {config} from '../config.js'; +import {flag} from './flag.js'; +import {getProperties} from './getProperties.js'; +import {isProxyEnabled} from './isProxyEnabled.js'; /*! * Chai - proxify utility @@ -28,9 +28,9 @@ var isProxyEnabled = require('./isProxyEnabled'); * @name proxify */ -var builtins = ['__flags', '__methods', '_obj', 'assert']; +const builtins = ['__flags', '__methods', '_obj', 'assert']; -module.exports = function proxify(obj, nonChainableMethodName) { +export function proxify(obj ,nonChainableMethodName) { if (!isProxyEnabled()) return obj; return new Proxy(obj, { @@ -98,7 +98,7 @@ module.exports = function proxify(obj, nonChainableMethodName) { return Reflect.get(target, property); } }); -}; +} /** * # stringDistanceCapped(strA, strB, cap) diff --git a/lib/chai/utils/test.js b/lib/chai/utils/test.js index 09886d443..19a47dbe8 100644 --- a/lib/chai/utils/test.js +++ b/lib/chai/utils/test.js @@ -8,12 +8,12 @@ * Module dependencies */ -var flag = require('./flag'); +import {flag} from './flag.js'; /** * ### .test(object, expression) * - * Test and object for expression. + * Test an object for expression. * * @param {Object} object (constructed Assertion) * @param {Arguments} chai.Assertion.prototype.assert arguments @@ -21,8 +21,8 @@ var flag = require('./flag'); * @name test */ -module.exports = function test(obj, args) { +export function test(obj, args) { var negate = flag(obj, 'negate') , expr = args[0]; return negate ? !expr : expr; -}; +} diff --git a/lib/chai/utils/transferFlags.js b/lib/chai/utils/transferFlags.js index 7b501900d..a1a7d3ef4 100644 --- a/lib/chai/utils/transferFlags.js +++ b/lib/chai/utils/transferFlags.js @@ -27,7 +27,7 @@ * @api private */ -module.exports = function transferFlags(assertion, object, includeAll) { +export function transferFlags(assertion, object, includeAll) { var flags = assertion.__flags || (assertion.__flags = Object.create(null)); if (!object.__flags) { @@ -42,4 +42,4 @@ module.exports = function transferFlags(assertion, object, includeAll) { object.__flags[flag] = flags[flag]; } } -}; +} diff --git a/package-lock.json b/package-lock.json index 6fe663dad..41e602f7d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,429 +1,878 @@ { "name": "chai", "version": "5.0.0-alpha.0", - "lockfileVersion": 1, + "lockfileVersion": 3, "requires": true, - "dependencies": { - "@sindresorhus/is": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", - "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", + "packages": { + "": { + "name": "chai", + "version": "5.0.0-alpha.0", + "license": "MIT", + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^4.1.2", + "loupe": "^2.3.1", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "devDependencies": { + "bump-cli": "^1.1.3", + "codecov": "^3.8.1", + "esbuild": "^0.17.3", + "istanbul": "^0.4.3", + "karma": "^6.1.1", + "karma-chrome-launcher": "^3.1.0", + "karma-firefox-launcher": "^2.1.0", + "karma-mocha": "^2.0.1", + "karma-sauce-launcher": "^4.3.5", + "mocha": "^8.3.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", + "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.18.6" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", + "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.18.6", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", + "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.18.6", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, - "@szmarczak/http-timer": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.5.tgz", - "integrity": "sha512-PyRA9sm1Yayuj5OIoJ1hGt2YISX45w9WcFbh6ddT0Z/0yaFxOtGLInr4jUfU1EAFVs0Yfyfev4RNwBlUaHdlDQ==", + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@colors/colors": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", + "integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==", "dev": true, - "requires": { + "engines": { + "node": ">=0.1.90" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.3.tgz", + "integrity": "sha512-1Mlz934GvbgdDmt26rTLmf03cAgLg5HyOgJN+ZGCeP3Q9ynYTNMn2/LQxIl7Uy+o4K6Rfi2OuLsr12JQQR8gNg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.3.tgz", + "integrity": "sha512-XvJsYo3dO3Pi4kpalkyMvfQsjxPWHYjoX4MDiB/FUM4YMfWcXa5l4VCwFWVYI1+92yxqjuqrhNg0CZg3gSouyQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.3.tgz", + "integrity": "sha512-nuV2CmLS07Gqh5/GrZLuqkU9Bm6H6vcCspM+zjp9TdQlxJtIe+qqEXQChmfc7nWdyr/yz3h45Utk1tUn8Cz5+A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.3.tgz", + "integrity": "sha512-01Hxaaat6m0Xp9AXGM8mjFtqqwDjzlMP0eQq9zll9U85ttVALGCGDuEvra5Feu/NbP5AEP1MaopPwzsTcUq1cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.3.tgz", + "integrity": "sha512-Eo2gq0Q/er2muf8Z83X21UFoB7EU6/m3GNKvrhACJkjVThd0uA+8RfKpfNhuMCl1bKRfBzKOk6xaYKQZ4lZqvA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.3.tgz", + "integrity": "sha512-CN62ESxaquP61n1ZjQP/jZte8CE09M6kNn3baos2SeUfdVBkWN5n6vGp2iKyb/bm/x4JQzEvJgRHLGd5F5b81w==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.3.tgz", + "integrity": "sha512-feq+K8TxIznZE+zhdVurF3WNJ/Sa35dQNYbaqM/wsCbWdzXr5lyq+AaTUSER2cUR+SXPnd/EY75EPRjf4s1SLg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.3.tgz", + "integrity": "sha512-CLP3EgyNuPcg2cshbwkqYy5bbAgK+VhyfMU7oIYyn+x4Y67xb5C5ylxsNUjRmr8BX+MW3YhVNm6Lq6FKtRTWHQ==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.3.tgz", + "integrity": "sha512-JHeZXD4auLYBnrKn6JYJ0o5nWJI9PhChA/Nt0G4MvLaMrvXuWnY93R3a7PiXeJQphpL1nYsaMcoV2QtuvRnF/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.3.tgz", + "integrity": "sha512-FyXlD2ZjZqTFh0sOQxFDiWG1uQUEOLbEh9gKN/7pFxck5Vw0qjWSDqbn6C10GAa1rXJpwsntHcmLqydY9ST9ZA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.3.tgz", + "integrity": "sha512-OrDGMvDBI2g7s04J8dh8/I7eSO+/E7nMDT2Z5IruBfUO/RiigF1OF6xoH33Dn4W/OwAWSUf1s2nXamb28ZklTA==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.3.tgz", + "integrity": "sha512-DcnUpXnVCJvmv0TzuLwKBC2nsQHle8EIiAJiJ+PipEVC16wHXaPEKP0EqN8WnBe0TPvMITOUlP2aiL5YMld+CQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.3.tgz", + "integrity": "sha512-BDYf/l1WVhWE+FHAW3FzZPtVlk9QsrwsxGzABmN4g8bTjmhazsId3h127pliDRRu5674k1Y2RWejbpN46N9ZhQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.3.tgz", + "integrity": "sha512-WViAxWYMRIi+prTJTyV1wnqd2mS2cPqJlN85oscVhXdb/ZTFJdrpaqm/uDsZPGKHtbg5TuRX/ymKdOSk41YZow==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.3.tgz", + "integrity": "sha512-Iw8lkNHUC4oGP1O/KhumcVy77u2s6+KUjieUqzEU3XuWJqZ+AY7uVMrrCbAiwWTkpQHkr00BuXH5RpC6Sb/7Ug==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.3.tgz", + "integrity": "sha512-0AGkWQMzeoeAtXQRNB3s4J1/T2XbigM2/Mn2yU1tQSmQRmHIZdkGbVq2A3aDdNslPyhb9/lH0S5GMTZ4xsjBqg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.3.tgz", + "integrity": "sha512-4+rR/WHOxIVh53UIQIICryjdoKdHsFZFD4zLSonJ9RRw7bhKzVyXbnRPsWSfwybYqw9sB7ots/SYyufL1mBpEg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.3.tgz", + "integrity": "sha512-cVpWnkx9IYg99EjGxa5Gc0XmqumtAwK3aoz7O4Dii2vko+qXbkHoujWA68cqXjhh6TsLaQelfDO4MVnyr+ODeA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.3.tgz", + "integrity": "sha512-RxmhKLbTCDAY2xOfrww6ieIZkZF+KBqG7S2Ako2SljKXRFi+0863PspK74QQ7JpmWwncChY25JTJSbVBYGQk2Q==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.3.tgz", + "integrity": "sha512-0r36VeEJ4efwmofxVJRXDjVRP2jTmv877zc+i+Pc7MNsIr38NfsjkQj23AfF7l0WbB+RQ7VUb+LDiqC/KY/M/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.3.tgz", + "integrity": "sha512-wgO6rc7uGStH22nur4aLFcq7Wh86bE9cOFmfTr/yxN3BXvDEdCSXyKkO+U5JIt53eTOgC47v9k/C1bITWL/Teg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.3.tgz", + "integrity": "sha512-FdVl64OIuiKjgXBjwZaJLKp0eaEckifbhn10dXWhysMJkWblg3OEEGKSIyhiD5RSgAya8WzP3DNkngtIg3Nt7g==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@socket.io/component-emitter": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.0.tgz", + "integrity": "sha512-+9jVqKhRSpsc591z5vX+X5Yyw+he/HCB4iQ/RYxw35CEPaY1gnsNE43nf9n9AaYjAQrTiI/mOwKUKdUs9vf7Xg==", + "dev": true + }, + "node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dev": true, + "dependencies": { "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" } }, - "@tootallnate/once": { + "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true + "dev": true, + "engines": { + "node": ">= 6" + } }, - "@types/cacheable-request": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.1.tgz", - "integrity": "sha512-ykFq2zmBGOCbpIXtoVbz4SKY5QriWPh3AjyU4G74RYbtt5yOc5OfaY75ftjg7mikMOla1CTGpX3lLbuJh8DTrQ==", + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", "dev": true, - "requires": { + "dependencies": { "@types/http-cache-semantics": "*", - "@types/keyv": "*", + "@types/keyv": "^3.1.4", "@types/node": "*", - "@types/responselike": "*" + "@types/responselike": "^1.0.0" } }, - "@types/component-emitter": { - "version": "1.2.10", - "resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.10.tgz", - "integrity": "sha512-bsjleuRKWmGqajMerkzox19aGbscQX5rmmvvXl3wlIp5gMG1HgkiwPxsN5p070fBDKTNSPgojVbuY1+HWMbFhg==", - "dev": true - }, - "@types/cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-y7mImlc/rNkvCRmg8gC3/lj87S7pTUIJ6QGjwHR9WQJcFs+ZMTOaoPrkdFA/YdbuqVEmEbb5RdhVxMkAcgOnpg==", + "node_modules/@types/cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==", "dev": true }, - "@types/cors": { - "version": "2.8.10", - "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.10.tgz", - "integrity": "sha512-C7srjHiVG3Ey1nR6d511dtDkCEjxuN9W1HWAEjGq8kpcwmNM6JJkpC0xvabM7BXTG2wDq8Eu33iH9aQKa7IvLQ==", - "dev": true + "node_modules/@types/cors": { + "version": "2.8.13", + "resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.13.tgz", + "integrity": "sha512-RG8AStHlUiV5ysZQKq97copd2UmVYw3/pRMLefISZ3S1hK104Cwm7iLQ3fTKx+lsUH2CE8FlLaYeEA2LSeqYUA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } }, - "@types/http-cache-semantics": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.0.tgz", - "integrity": "sha512-c3Xy026kOF7QOTn00hbIllV1dLR9hG9NkSrLQgCVs8NF6sBU+VGWjD3wLPhmh1TYAc7ugCFsvHYMN4VcBN1U1A==", + "node_modules/@types/http-cache-semantics": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", + "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==", "dev": true }, - "@types/keyv": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.1.tgz", - "integrity": "sha512-MPtoySlAZQ37VoLaPcTHCu1RWJ4llDkULYZIzOYxlhxBqYPB0RsRlmMU0R6tahtFe27mIdkHV+551ZWV4PLmVw==", + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", "dev": true, - "requires": { + "dependencies": { "@types/node": "*" } }, - "@types/node": { - "version": "14.14.31", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.31.tgz", - "integrity": "sha512-vFHy/ezP5qI0rFgJ7aQnjDXwAMrG0KqqIH7tQG5PPv3BWBayOPIQNBjVc/P6hhdZfMx51REc6tfDNXHUio893g==", + "node_modules/@types/node": { + "version": "18.11.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.11.18.tgz", + "integrity": "sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==", "dev": true }, - "@types/puppeteer": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-5.4.3.tgz", - "integrity": "sha512-3nE8YgR9DIsgttLW+eJf6mnXxq8Ge+27m5SU3knWmrlfl6+KOG0Bf9f7Ua7K+C4BnaTMAh3/UpySqdAYvrsvjg==", + "node_modules/@types/puppeteer": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/@types/puppeteer/-/puppeteer-7.0.4.tgz", + "integrity": "sha512-ja78vquZc8y+GM2al07GZqWDKQskQXygCDiu0e3uO0DMRKqE0MjrFBFmTulfPYzLB6WnL7Kl2tFPy0WXSpPomg==", + "deprecated": "This is a stub types definition. puppeteer provides its own type definitions, so you do not need this installed.", "dev": true, - "requires": { - "@types/node": "*" + "dependencies": { + "puppeteer": "*" } }, - "@types/puppeteer-core": { + "node_modules/@types/puppeteer-core": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/@types/puppeteer-core/-/puppeteer-core-5.4.0.tgz", "integrity": "sha512-yqRPuv4EFcSkTyin6Yy17pN6Qz2vwVwTCJIDYMXbE3j8vTPhv0nCQlZOl5xfi0WHUkqvQsjAR8hAfjeMCoetwg==", "dev": true, - "requires": { + "dependencies": { "@types/puppeteer": "*" } }, - "@types/responselike": { + "node_modules/@types/responselike": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", "dev": true, - "requires": { + "dependencies": { "@types/node": "*" } }, - "@types/which": { + "node_modules/@types/which": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@types/which/-/which-1.3.2.tgz", "integrity": "sha512-8oDqyLC7eD4HM307boe2QWKyuzdzWBj56xI/imSl2cpL+U3tCMaTAkMJ4ee5JBZ/FsOJlvRGeIShiZDAl1qERA==", "dev": true }, - "@types/yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha512-A1b8SU4D10uoPjwb0lnHmmu8wZhR9d+9o2PKBQT2jU5YPTKsxac6M2qGAdY7VcL+dHHhARVUDmeg0rOrcd9EjA==", + "node_modules/@types/yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha512-Cn6WYCm0tXv8p6k+A8PvbDG763EDpBoTzHdA+Q/MF6H3sapGjCm9NzoaJncJS9tUKSuCoDs9XHxYYsQDgxR6kw==", "dev": true, "optional": true, - "requires": { + "dependencies": { "@types/node": "*" } }, - "@ungap/promise-all-settled": { + "node_modules/@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "@wdio/config": { + "node_modules/@wdio/config": { "version": "6.12.1", "resolved": "https://registry.npmjs.org/@wdio/config/-/config-6.12.1.tgz", "integrity": "sha512-V5hTIW5FNlZ1W33smHF4Rd5BKjGW2KeYhyXDQfXHjqLCeRiirZ9fABCo9plaVQDnwWSUMWYaAaIAifV82/oJCQ==", "dev": true, - "requires": { + "dependencies": { "@wdio/logger": "6.10.10", "deepmerge": "^4.0.0", "glob": "^7.1.2" + }, + "engines": { + "node": ">=10.0.0" } }, - "@wdio/logger": { + "node_modules/@wdio/logger": { "version": "6.10.10", "resolved": "https://registry.npmjs.org/@wdio/logger/-/logger-6.10.10.tgz", "integrity": "sha512-2nh0hJz9HeZE0VIEMI+oPgjr/Q37ohrR9iqsl7f7GW5ik+PnKYCT9Eab5mR1GNMG60askwbskgGC1S9ygtvrSw==", "dev": true, - "requires": { + "dependencies": { "chalk": "^4.0.0", "loglevel": "^1.6.0", "loglevel-plugin-prefix": "^0.8.4", "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10.0.0" } }, - "@wdio/protocols": { + "node_modules/@wdio/protocols": { "version": "6.12.0", "resolved": "https://registry.npmjs.org/@wdio/protocols/-/protocols-6.12.0.tgz", "integrity": "sha512-UhTBZxClCsM3VjaiDp4DoSCnsa7D1QNmI2kqEBfIpyNkT3GcZhJb7L+nL0fTkzCwi7+/uLastb3/aOwH99gt0A==", - "dev": true + "dev": true, + "engines": { + "node": ">=10.0.0" + } }, - "@wdio/repl": { + "node_modules/@wdio/repl": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/@wdio/repl/-/repl-6.11.0.tgz", "integrity": "sha512-FxrFKiTkFyELNGGVEH1uijyvNY7lUpmff6x+FGskFGZB4uSRs0rxkOMaEjxnxw7QP1zgQKr2xC7GyO03gIGRGg==", "dev": true, - "requires": { + "dependencies": { "@wdio/utils": "6.11.0" + }, + "engines": { + "node": ">=10.0.0" } }, - "@wdio/utils": { + "node_modules/@wdio/utils": { "version": "6.11.0", "resolved": "https://registry.npmjs.org/@wdio/utils/-/utils-6.11.0.tgz", "integrity": "sha512-vf0sOQzd28WbI26d6/ORrQ4XKWTzSlWLm9W/K/eJO0NASKPEzR+E+Q2kaa+MJ4FKXUpjbt+Lxfo+C26TzBk7tg==", "dev": true, - "requires": { + "dependencies": { "@wdio/logger": "6.10.10" + }, + "engines": { + "node": ">=10.0.0" } }, - "JSONStream": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", - "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", - "dev": true, - "requires": { - "jsonparse": "^1.2.0", - "through": ">=2.2.7 <3" - } - }, - "abbrev": { + "node_modules/abbrev": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz", - "integrity": "sha1-kbR5JYinc4wl813W9jdSovh3YTU=", + "integrity": "sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q==", "dev": true }, - "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "node_modules/accepts": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", + "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==", "dev": true, - "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" - }, "dependencies": { - "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", - "dev": true - }, - "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", - "dev": true, - "requires": { - "mime-db": "1.46.0" - } - } - } - }, - "acorn": { - "version": "7.4.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", - "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true - }, - "acorn-node": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.8.2.tgz", - "integrity": "sha512-8mt+fslDufLYntIoPAaIMUe/lrbrehIiwmR3t2k9LljIzoigEPF27eLk2hy8zSGzmR/ogr7zbRKINMo1u0yh5A==", - "dev": true, - "requires": { - "acorn": "^7.0.0", - "acorn-walk": "^7.0.0", - "xtend": "^4.0.2" + "mime-types": "~2.1.34", + "negotiator": "0.6.3" + }, + "engines": { + "node": ">= 0.6" } }, - "acorn-walk": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", - "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", - "dev": true - }, - "agent-base": { + "node_modules/agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", "dev": true, - "requires": { + "dependencies": { "debug": "4" }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/agent-base/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "amdefine": { + "node_modules/agent-base/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/amdefine": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "integrity": "sha512-S2Hw0TtNkMJhIabBwIojKL9YHO5T0n5eNqWJ7Lrlel/zDbftQpxpapi8tZs3X1HWa+u+QeydGmzzNU0m09+Rcg==", "dev": true, - "optional": true + "optional": true, + "engines": { + "node": ">=0.4.2" + } }, - "ansi-colors": { + "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "ansi-regex": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", - "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", - "dev": true + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } }, - "ansi-styles": { + "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, - "requires": { + "dependencies": { "color-convert": "^2.0.1" }, - "dependencies": { - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "anymatch": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.1.tgz", - "integrity": "sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg==", + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, - "requires": { + "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" } }, - "arch": { + "node_modules/arch": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/arch/-/arch-2.2.0.tgz", "integrity": "sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "archive-type": { + "node_modules/archive-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/archive-type/-/archive-type-4.0.0.tgz", - "integrity": "sha1-+S5yIzBW38aWlHJ0nCZ72wRrHXA=", + "integrity": "sha512-zV4Ky0v1F8dBrdYElwTvQhweQ0P7Kwc1aluqJsYtOBP01jXcWCyW2IEfI1YiqsG+Iy7ZR+o5LF1N+PGECBxHWA==", "dev": true, - "requires": { + "dependencies": { "file-type": "^4.2.0" }, - "dependencies": { - "file-type": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", - "integrity": "sha1-G2AOX8ofvcboDApwxxyNul95BsU=", - "dev": true - } + "engines": { + "node": ">=4" } }, - "archiver": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.2.0.tgz", - "integrity": "sha512-QEAKlgQuAtUxKeZB9w5/ggKXh21bZS+dzzuQ0RPBC20qtDCbTyzqmisoeJP46MP39fg4B4IcyvR+yeyEBdblsQ==", + "node_modules/archive-type/node_modules/file-type": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-4.4.0.tgz", + "integrity": "sha512-f2UbFQEk7LXgWpi5ntcO86OeA/cC80fuDDDaX/fZ2ZGel+AF7leRQqBBW1eJNiiQkrZlAoM6P+VYP5P6bOlDEQ==", "dev": true, - "requires": { + "engines": { + "node": ">=4" + } + }, + "node_modules/archiver": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/archiver/-/archiver-5.3.1.tgz", + "integrity": "sha512-8KyabkmbYrH+9ibcTScQ1xCJC/CGcugdVIwB+53f5sZziXgwUh3iXlAlANMxcZyDEfTHMe6+Z5FofV8nopXP7w==", + "dev": true, + "dependencies": { "archiver-utils": "^2.1.0", - "async": "^3.2.0", + "async": "^3.2.3", "buffer-crc32": "^0.2.1", "readable-stream": "^3.6.0", "readdir-glob": "^1.0.0", - "tar-stream": "^2.1.4", - "zip-stream": "^4.0.4" + "tar-stream": "^2.2.0", + "zip-stream": "^4.1.0" }, - "dependencies": { - "async": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.0.tgz", - "integrity": "sha512-TR2mEZFVOj2pLStYxLht7TyfuRzaydfpxr3k9RpHIzMgw7A64dzsdqCxH1WJyQdoe8T10nDXd9wnEigmiuHIZw==", - "dev": true - }, - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - } - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - } + "engines": { + "node": ">= 10" } }, - "archiver-utils": { + "node_modules/archiver-utils": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/archiver-utils/-/archiver-utils-2.1.0.tgz", "integrity": "sha512-bEL/yUb/fNNiNTuUz979Z0Yg5L+LzLxGJz8x79lYmR54fmTIb6ob/hNQgkQnIUDWIFjZVQwl9Xs356I6BAMHfw==", "dev": true, - "requires": { + "dependencies": { "glob": "^7.1.4", "graceful-fs": "^4.2.0", "lazystream": "^1.0.0", @@ -435,696 +884,591 @@ "normalize-path": "^3.0.0", "readable-stream": "^2.0.0" }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver/node_modules/async": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", + "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==", + "dev": true + }, + "node_modules/archiver/node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, "dependencies": { - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/archiver/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/archiver/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/archiver/node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" } }, - "argparse": { + "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, - "requires": { + "dependencies": { "sprintf-js": "~1.0.2" } }, - "argv": { + "node_modules/argv": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", - "integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=", - "dev": true - }, - "array-filter": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", - "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", - "dev": true - }, - "asn1.js": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", - "integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "safer-buffer": "^2.1.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", + "integrity": "sha512-dEamhpPEwRUBpLNHeuCm/v+g0anFByHahxodVO/BbAarHVBBg2MccCwf9K+o1Pof+2btdnkJelYVUWjW/VrATw==", "dev": true, - "requires": { - "object-assign": "^4.1.1", - "util": "0.10.3" - }, - "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", - "dev": true - }, - "util": { - "version": "0.10.3", - "resolved": "http://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - } - } + "engines": { + "node": ">=0.6.10" } }, - "assertion-error": { + "node_modules/assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "engines": { + "node": "*" + } }, - "async": { + "node_modules/async": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "integrity": "sha512-nSVgobk4rv61R9PUSDtYt7mPVB2olxNR5RWJcAsH676/ef11bUZwvu7+RGYrYauVdDPcO519v68wRhXQtxsV9w==", "dev": true }, - "asynckit": { + "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==", "dev": true }, - "at-least-node": { + "node_modules/at-least-node": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "dev": true + "dev": true, + "engines": { + "node": ">= 4.0.0" + } }, - "atob": { + "node_modules/atob": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", - "dev": true - }, - "available-typed-arrays": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", - "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", "dev": true, - "requires": { - "array-filter": "^1.0.0" + "bin": { + "atob": "bin/atob.js" + }, + "engines": { + "node": ">= 4.5.0" } }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base64-arraybuffer": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", - "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=", + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "base64-js": { + "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "base64id": { + "node_modules/base64id": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/base64id/-/base64id-2.0.0.tgz", "integrity": "sha512-lGe34o6EHj9y3Kts9R4ZYs/Gr+6N7MCaMlIFA3F1R2O5/m7K06AxfSeO5530PEERE6/WyEg3lsuyw4GHlPZHog==", - "dev": true + "dev": true, + "engines": { + "node": "^4.5.0 || >= 5.9" + } }, - "bin-check": { + "node_modules/bin-check": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bin-check/-/bin-check-4.1.0.tgz", "integrity": "sha512-b6weQyEUKsDGFlACWSIOfveEnImkJyK/FGW6FAG42loyoquvjdtOIqO6yBFzHyqyVVhNgNkQxxx09SFLK28YnA==", "dev": true, - "requires": { + "dependencies": { "execa": "^0.7.0", "executable": "^4.1.0" + }, + "engines": { + "node": ">=4" } }, - "bin-version": { + "node_modules/bin-version": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bin-version/-/bin-version-3.1.0.tgz", "integrity": "sha512-Mkfm4iE1VFt4xd4vH+gx+0/71esbfus2LsnCGe8Pi4mndSPyT+NGES/Eg99jx8/lUGWfu3z2yuB/bt5UB+iVbQ==", "dev": true, - "requires": { + "dependencies": { "execa": "^1.0.0", "find-versions": "^3.0.0" }, - "dependencies": { - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - }, - "execa": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", - "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", - "dev": true, - "requires": { - "cross-spawn": "^6.0.0", - "get-stream": "^4.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - } - }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } + "engines": { + "node": ">=6" } }, - "bin-version-check": { + "node_modules/bin-version-check": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/bin-version-check/-/bin-version-check-4.0.0.tgz", "integrity": "sha512-sR631OrhC+1f8Cvs8WyVWOA33Y8tgwjETNPyyD/myRBXLkfS/vl74FmH/lFcRl9KY3zwGh7jFhvyk9vV3/3ilQ==", "dev": true, - "requires": { + "dependencies": { "bin-version": "^3.0.0", "semver": "^5.6.0", "semver-truncate": "^1.1.2" }, + "engines": { + "node": ">=6" + } + }, + "node_modules/bin-version-check/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/bin-version/node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/bin-version/node_modules/execa": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz", + "integrity": "sha512-adbxcyWV46qiHyvSp50TKt05tB4tK3HcmF7/nxfAdhnox83seTDbwnaqKO4sXRy7roHAIFqJP/Rw/AuEbX61LA==", + "dev": true, "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } + "cross-spawn": "^6.0.0", + "get-stream": "^4.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/bin-version/node_modules/get-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", + "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/bin-version/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" } }, - "bin-wrapper": { + "node_modules/bin-wrapper": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bin-wrapper/-/bin-wrapper-4.1.0.tgz", "integrity": "sha512-hfRmo7hWIXPkbpi0ZltboCMVrU+0ClXR/JgbCKKjlDjQf6igXa7OwdqNcFWQZPZTgiY7ZpzE3+LjjkLiTN2T7Q==", "dev": true, - "requires": { + "dependencies": { "bin-check": "^4.1.0", "bin-version-check": "^4.0.0", "download": "^7.1.0", "import-lazy": "^3.1.0", "os-filter-obj": "^2.0.0", "pify": "^4.0.1" + }, + "engines": { + "node": ">=6" } }, - "binary-extensions": { + "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "bl": { + "node_modules/bl": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", "dev": true, - "requires": { + "dependencies": { "readable-stream": "^2.3.5", "safe-buffer": "^5.1.1" } }, - "bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==", - "dev": true - }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", + "node_modules/body-parser": { + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", + "integrity": "sha512-jWi7abTbYwajOytWCQc37VulmWiRae5RyTpaCyDcS5/lMdtwSz5lOpDE67srw/HYe35f1z3fDQw+3txg7gNtWw==", "dev": true, - "requires": { - "bytes": "3.1.0", + "dependencies": { + "bytes": "3.1.2", "content-type": "~1.0.4", "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", + "depd": "2.0.0", + "destroy": "1.2.0", + "http-errors": "2.0.0", "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" + "on-finished": "2.4.1", + "qs": "6.11.0", + "raw-body": "2.5.1", + "type-is": "~1.6.18", + "unpipe": "1.0.0" }, - "dependencies": { - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "dev": true - } + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, - "boolean": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.0.2.tgz", - "integrity": "sha512-RwywHlpCRc3/Wh81MiCKun4ydaIFyW5Ea6JbL6sRCVx5q5irDw7pMXBUFYF/jArQ6YrG36q0kpovc9P/Kd3I4g==", + "node_modules/boolean": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", + "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==", "dev": true }, - "brace-expansion": { + "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "requires": { + "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "braces": { + "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", "dev": true, - "requires": { + "dependencies": { "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" } }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browser-pack": { - "version": "6.1.0", - "resolved": "http://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", - "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "combine-source-map": "~0.8.0", - "defined": "^1.0.0", - "safe-buffer": "^5.1.1", - "through2": "^2.0.0", - "umd": "^3.0.0" - } - }, - "browser-resolve": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-2.0.0.tgz", - "integrity": "sha512-7sWsQlYL2rGLy2IWm8WL8DCTJvYLc/qlOnsakDac87SOoCd16WLsaAMdCiAqsTNHIe+SXfaqyxyo6THoWqs8WQ==", - "dev": true, - "requires": { - "resolve": "^1.17.0" - } - }, - "browser-stdout": { + "node_modules/browser-stdout": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "browserify": { - "version": "17.0.0", - "resolved": "https://registry.npmjs.org/browserify/-/browserify-17.0.0.tgz", - "integrity": "sha512-SaHqzhku9v/j6XsQMRxPyBrSP3gnwmE27gLJYZgMT2GeK3J0+0toN+MnuNYDfHwVGQfLiMZ7KSNSIXHemy905w==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "assert": "^1.4.0", - "browser-pack": "^6.0.1", - "browser-resolve": "^2.0.0", - "browserify-zlib": "~0.2.0", - "buffer": "~5.2.1", - "cached-path-relative": "^1.0.0", - "concat-stream": "^1.6.0", - "console-browserify": "^1.1.0", - "constants-browserify": "~1.0.0", - "crypto-browserify": "^3.0.0", - "defined": "^1.0.0", - "deps-sort": "^2.0.1", - "domain-browser": "^1.2.0", - "duplexer2": "~0.1.2", - "events": "^3.0.0", - "glob": "^7.1.0", - "has": "^1.0.0", - "htmlescape": "^1.1.0", - "https-browserify": "^1.0.0", - "inherits": "~2.0.1", - "insert-module-globals": "^7.2.1", - "labeled-stream-splicer": "^2.0.0", - "mkdirp-classic": "^0.5.2", - "module-deps": "^6.2.3", - "os-browserify": "~0.3.0", - "parents": "^1.0.1", - "path-browserify": "^1.0.0", - "process": "~0.11.0", - "punycode": "^1.3.2", - "querystring-es3": "~0.2.0", - "read-only-stream": "^2.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.1.4", - "shasum-object": "^1.0.0", - "shell-quote": "^1.6.1", - "stream-browserify": "^3.0.0", - "stream-http": "^3.0.0", - "string_decoder": "^1.1.1", - "subarg": "^1.0.0", - "syntax-error": "^1.1.1", - "through2": "^2.0.0", - "timers-browserify": "^1.0.1", - "tty-browserify": "0.0.1", - "url": "~0.11.0", - "util": "~0.12.0", - "vm-browserify": "^1.0.0", - "xtend": "^4.0.0" - } - }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", - "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "browserify-rsa": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.1.0.tgz", - "integrity": "sha512-AdEER0Hkspgno2aR97SAf6vi0y0k8NuOpGnVH3O99rcA5Q6sh8QxcngtHuJ6uXwnfAXNM4Gn1Gb7/MV1+Ymbog==", - "dev": true, - "requires": { - "bn.js": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sign": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz", - "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==", - "dev": true, - "requires": { - "bn.js": "^5.1.1", - "browserify-rsa": "^4.0.1", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "elliptic": "^6.5.3", - "inherits": "^2.0.4", - "parse-asn1": "^5.1.5", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } - }, - "buffer": { + "node_modules/buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", "dev": true, - "requires": { + "dependencies": { "base64-js": "^1.0.2", "ieee754": "^1.1.4" } }, - "buffer-alloc": { + "node_modules/buffer-alloc": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", "dev": true, - "requires": { + "dependencies": { "buffer-alloc-unsafe": "^1.1.0", "buffer-fill": "^1.0.0" } }, - "buffer-alloc-unsafe": { + "node_modules/buffer-alloc-unsafe": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", "dev": true }, - "buffer-crc32": { + "node_modules/buffer-crc32": { "version": "0.2.13", "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", - "dev": true - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=", - "dev": true - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "dev": true, + "engines": { + "node": "*" + } }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "node_modules/buffer-fill": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", + "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", "dev": true }, - "bump-cli": { + "node_modules/bump-cli": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/bump-cli/-/bump-cli-1.1.3.tgz", - "integrity": "sha1-+VVN1aONyl1lKv3jcsWTaLuMbGU=", + "integrity": "sha512-7cdMWGZJnuZ1vXX9Zp5u1PSEiNHSHe0dOF0buyT2MCZcw9Vt4pTMocOBsgeKNRPFn9Hh/8yuYWVvElBqmhwhNQ==", "dev": true, - "requires": { + "dependencies": { "minimist": "^1.1.0", "semver": "^3.0.1" + }, + "bin": { + "bump": "bin/bump" } }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", - "dev": true + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } }, - "cacheable-lookup": { + "node_modules/cacheable-lookup": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", - "dev": true + "dev": true, + "engines": { + "node": ">=10.6.0" + } }, - "cacheable-request": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", - "integrity": "sha1-DYCIAbY0KtM8kd+dC0TcCbkeXD0=", + "node_modules/cacheable-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.2.tgz", + "integrity": "sha512-pouW8/FmiPQbuGpkXQ9BAPv/Mo5xDGANgSNXzTzJ8DrKGuXOssM4wIQRjfanNRh3Yu5cfYPvcorqbhg2KIJtew==", "dev": true, - "requires": { - "clone-response": "1.0.2", - "get-stream": "3.0.0", - "http-cache-semantics": "3.8.1", - "keyv": "3.0.0", - "lowercase-keys": "1.0.0", - "normalize-url": "2.0.1", - "responselike": "1.0.2" - }, "dependencies": { - "lowercase-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", - "integrity": "sha1-TjNms55/VFfjXxMkvfb4jQv8cwY=", - "dev": true - } + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" } }, - "cached-path-relative": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.2.tgz", - "integrity": "sha512-5r2GqsoEb4qMTTN9J+WzXfjov+hjxT+j3u5K+kIVNIwAd99DLCJE9pBIMP1qVeybV6JiijL385Oz0DcYxfbOIg==", - "dev": true + "node_modules/cacheable-request/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "call-bind": { + "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "dev": true, - "requires": { + "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" } }, - "camel-case": { + "node_modules/camel-case": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", "integrity": "sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==", "dev": true, - "requires": { + "dependencies": { "pascal-case": "^3.1.2", "tslib": "^2.0.3" } }, - "camelcase": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", - "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", - "dev": true + "node_modules/camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "capital-case": { + "node_modules/capital-case": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/capital-case/-/capital-case-1.0.4.tgz", "integrity": "sha512-ds37W8CytHgwnhGGTi88pcPyR15qoNkOpYwmMMfnWqqWgESapLqvDx6huFjQ5vqWSn2Z06173XNA7LtMOeUh1A==", "dev": true, - "requires": { + "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", "upper-case-first": "^2.0.2" } }, - "caw": { + "node_modules/caw": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/caw/-/caw-2.0.1.tgz", "integrity": "sha512-Cg8/ZSBEa8ZVY9HspcGUYaK63d/bN7rqS3CYCzEGUxuYv6UlmcjzDUz2fCFFHyTvUW5Pk0I+3hkA3iXlIj6guA==", "dev": true, - "requires": { + "dependencies": { "get-proxy": "^2.0.0", "isurl": "^1.0.0-alpha5", "tunnel-agent": "^0.6.0", "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" } }, - "chalk": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", - "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", "dev": true, - "requires": { + "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chalk/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "change-case": { + "node_modules/change-case": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/change-case/-/change-case-4.1.2.tgz", "integrity": "sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A==", "dev": true, - "requires": { + "dependencies": { "camel-case": "^4.1.2", "capital-case": "^1.0.4", "constant-case": "^3.0.4", @@ -1139,477 +1483,478 @@ "tslib": "^2.0.3" } }, - "check-error": { + "node_modules/check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" + "integrity": "sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==", + "engines": { + "node": "*" + } }, - "chokidar": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", - "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", "dev": true, - "requires": { - "anymatch": "~3.1.1", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", "braces": "~3.0.2", - "fsevents": "~2.3.1", - "glob-parent": "~5.1.0", + "glob-parent": "~5.1.2", "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.5.0" + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" } }, - "chownr": { + "node_modules/chownr": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", "dev": true }, - "chrome-launcher": { + "node_modules/chrome-launcher": { "version": "0.13.4", "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-0.13.4.tgz", "integrity": "sha512-nnzXiDbGKjDSK6t2I+35OAPBy5Pw/39bgkb/ZAFwMhwJbdYBp6aH+vW28ZgtjdU890Q7D+3wN/tB8N66q5Gi2A==", "dev": true, - "requires": { + "dependencies": { "@types/node": "*", "escape-string-regexp": "^1.0.5", "is-wsl": "^2.2.0", "lighthouse-logger": "^1.0.0", "mkdirp": "^0.5.3", "rimraf": "^3.0.2" - }, - "dependencies": { - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - } } }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "node_modules/chrome-launcher/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" + "engines": { + "node": ">=0.8.0" } }, - "cliui": { + "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "dev": true, - "requires": { + "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^7.0.0" } }, - "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", + "node_modules/cliui/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "requires": { + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone-response": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.3.tgz", + "integrity": "sha512-ROoL94jJH2dUVML2Y/5PEDNaSHgeOdSDicUyS7izcF63G6sTc/FTjLub4b8Il9S8S0beOfYt0TaA5qvFK+w0wA==", + "dev": true, + "dependencies": { "mimic-response": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "codecov": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.8.1.tgz", - "integrity": "sha512-Qm7ltx1pzLPsliZY81jyaQ80dcNR4/JpcX0IHCIWrHBXgseySqbdbYfkdiXd7o/xmzQpGRVCKGYeTrHUpn6Dcw==", + "node_modules/codecov": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.8.3.tgz", + "integrity": "sha512-Y8Hw+V3HgR7V71xWH2vQ9lyS358CbGCldWlJFR0JirqoGtOoas3R3/OclRTvgUYFK29mmJICDPauVKmpqbwhOA==", + "deprecated": "https://about.codecov.io/blog/codecov-uploader-deprecation-plan/", "dev": true, - "requires": { + "dependencies": { "argv": "0.0.2", - "ignore-walk": "3.0.3", - "js-yaml": "3.14.0", - "teeny-request": "6.0.1", - "urlgrey": "0.4.4" - }, - "dependencies": { - "js-yaml": { - "version": "3.14.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.0.tgz", - "integrity": "sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - } + "ignore-walk": "3.0.4", + "js-yaml": "3.14.1", + "teeny-request": "7.1.1", + "urlgrey": "1.0.0" + }, + "bin": { + "codecov": "bin/codecov" + }, + "engines": { + "node": ">=4.0" } }, - "colors": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", - "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", - "dev": true - }, - "combine-source-map": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", - "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "dev": true, - "requires": { - "convert-source-map": "~1.1.0", - "inline-source-map": "~0.6.0", - "lodash.memoize": "~3.0.3", - "source-map": "~0.5.3" + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, - "combined-stream": { + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", "dev": true, - "requires": { + "dependencies": { "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "commander": { - "version": "2.17.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz", - "integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==", - "dev": true - }, - "component-emitter": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", - "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==", + "node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", "dev": true }, - "compress-commons": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.0.2.tgz", - "integrity": "sha512-qhd32a9xgzmpfoga1VQEiLEwdKZ6Plnpx5UCgIsf89FSolyJ7WnifY4Gtjgv5WR6hWAyRaHxC5MiEhU/38U70A==", + "node_modules/compress-commons": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/compress-commons/-/compress-commons-4.1.1.tgz", + "integrity": "sha512-QLdDLCKNV2dtoTorqgxngQCMA+gWXkM/Nwu7FpeBhk/RdkzimqC3jueb/FDmaZeXh+uby1jkBqE3xArsLBE5wQ==", "dev": true, - "requires": { + "dependencies": { "buffer-crc32": "^0.2.13", - "crc32-stream": "^4.0.1", + "crc32-stream": "^4.0.2", "normalize-path": "^3.0.0", "readable-stream": "^3.6.0" }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/compress-commons/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "dependencies": { - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, - "concat-map": { + "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "config-chain": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", - "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "node_modules/config-chain": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz", + "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==", "dev": true, - "requires": { + "dependencies": { "ini": "^1.3.4", "proto-list": "~1.2.1" } }, - "connect": { + "node_modules/connect": { "version": "3.7.0", "resolved": "https://registry.npmjs.org/connect/-/connect-3.7.0.tgz", "integrity": "sha512-ZqRXc+tZukToSNmh5C2iWMSoV3X1YUcPbqEM4DkEG5tNQXrQUZCNVGGv3IuicnkMtPfGf3Xtp8WCXs295iQ1pQ==", "dev": true, - "requires": { + "dependencies": { "debug": "2.6.9", "finalhandler": "1.1.2", "parseurl": "~1.3.3", "utils-merge": "1.0.1" + }, + "engines": { + "node": ">= 0.10.0" } }, - "console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==", - "dev": true - }, - "constant-case": { + "node_modules/constant-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/constant-case/-/constant-case-3.0.4.tgz", "integrity": "sha512-I2hSBi7Vvs7BEuJDr5dDHfzb/Ruj3FyvFyh7KLilAjNQw3Be+xgqUBA2W6scVEcL0hL1dwPRtIqEPVUCKkSsyQ==", "dev": true, - "requires": { + "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", "upper-case": "^2.0.2" } }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", + "node_modules/content-disposition": { + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz", + "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==", "dev": true, - "requires": { - "safe-buffer": "5.1.2" - }, "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - } + "safe-buffer": "5.2.1" + }, + "engines": { + "node": ">= 0.6" } }, - "content-type": { + "node_modules/content-type": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", - "dev": true - }, - "convert-source-map": { - "version": "1.1.3", - "resolved": "http://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", - "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.6" + } }, - "cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", - "dev": true + "node_modules/cookie": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz", + "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==", + "dev": true, + "engines": { + "node": ">= 0.6" + } }, - "core-js": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.9.1.tgz", - "integrity": "sha512-gSjRvzkxQc1zjM/5paAmL4idJBFzuJoo+jDjF1tStYFMV2ERfD02HhahhCGXUyHxQRG4yFKVSdO6g62eoRMcDg==", - "dev": true + "node_modules/core-js": { + "version": "3.27.2", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.27.2.tgz", + "integrity": "sha512-9ashVQskuh5AZEZ1JdQWp1GqSoC1e1G87MzRqg2gIfVAQ7Qn9K+uFj8EcniUFA4P2NLZfV+TOlX1SzoKfo+s7w==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", "dev": true }, - "cors": { + "node_modules/cors": { "version": "2.8.5", "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", "dev": true, - "requires": { + "dependencies": { "object-assign": "^4", "vary": "^1" + }, + "engines": { + "node": ">= 0.10" } }, - "crc-32": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.0.tgz", - "integrity": "sha512-1uBwHxF+Y/4yF5G48fwnKq6QsIXheor3ZLPT80yGBV1oEUwpPojlEhQbWKVw1VwcTQyMGHK1/XMmTjmlsmTTGA==", + "node_modules/cosmiconfig": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.0.0.tgz", + "integrity": "sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==", + "dev": true, + "dependencies": { + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/cosmiconfig/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/cosmiconfig/node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/crc-32": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/crc-32/-/crc-32-1.2.2.tgz", + "integrity": "sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==", "dev": true, - "requires": { - "exit-on-epipe": "~1.0.1", - "printj": "~1.1.0" + "bin": { + "crc32": "bin/crc32.njs" + }, + "engines": { + "node": ">=0.8" } }, - "crc32-stream": { + "node_modules/crc32-stream": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-4.0.2.tgz", "integrity": "sha512-DxFZ/Hk473b/muq1VJ///PMNLj0ZMnzye9thBpmjpJKCc5eMgB95aK8zCGrGfQ90cWo561Te6HK9D+j4KPdM6w==", "dev": true, - "requires": { + "dependencies": { "crc-32": "^1.2.0", "readable-stream": "^3.4.0" }, - "dependencies": { - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } + "engines": { + "node": ">= 10" } }, - "create-ecdh": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.4.tgz", - "integrity": "sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==", + "node_modules/crc32-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.5.3" - }, "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, - "create-hash": { - "version": "1.2.0", - "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "node_modules/cross-fetch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.5.tgz", + "integrity": "sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw==", "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" + "dependencies": { + "node-fetch": "2.6.7" } }, - "create-hmac": { - "version": "1.1.7", - "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "node_modules/cross-fetch/node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } } }, - "cross-spawn": { + "node_modules/cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "integrity": "sha512-pTgQJ5KC0d2hcY8eyL1IzlBPYjTkyH72XRZPnLyKus2mBfNjQs3klqbJU2VILqZryAZUt9JOb3h/mWMy23/f5A==", "dev": true, - "requires": { + "dependencies": { "lru-cache": "^4.0.1", "shebang-command": "^1.2.0", "which": "^1.2.9" - }, - "dependencies": { - "lru-cache": { - "version": "4.1.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", - "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - } - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" } }, - "css-shorthand-properties": { + "node_modules/css-shorthand-properties": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/css-shorthand-properties/-/css-shorthand-properties-1.1.1.tgz", "integrity": "sha512-Md+Juc7M3uOdbAFwOYlTrccIZ7oCFuzrhKYQjdeUEW/sE1hv17Jp/Bws+ReOPpGVBTYCBoYo+G17V5Qo8QQ75A==", "dev": true }, - "css-value": { + "node_modules/css-value": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/css-value/-/css-value-0.0.1.tgz", - "integrity": "sha1-Xv1sLupeof1rasV+wEJ7GEUkJOo=", + "integrity": "sha512-FUV3xaJ63buRLgHrLQVlVgQnQdR4yqdLGaDu7g8CQcWjInDfM9plBTPI9FRfpahju1UBSaMckeb2/46ApS/V1Q==", "dev": true }, - "custom-event": { + "node_modules/custom-event": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/custom-event/-/custom-event-1.0.1.tgz", - "integrity": "sha1-XQKkaFCt8bSjF5RqOSj8y1v9BCU=", + "integrity": "sha512-GAj5FOq0Hd+RsCGVJxZuKaIDXDf3h6GQoNEjFgbLLI/trgtavwUbSnZ5pVfg27DVCaWjIohryS0JFwIJyT2cMg==", "dev": true }, - "dash-ast": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", - "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==", - "dev": true - }, - "date-format": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/date-format/-/date-format-3.0.0.tgz", - "integrity": "sha512-eyTcpKOcamdhWJXj56DpQMo1ylSQpcGtGKXcU0Tb97+K56/CF5amAqqqNj0+KvA0iw2ynxtHWFsPDSClCxe48w==", - "dev": true + "node_modules/date-format": { + "version": "4.0.14", + "resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz", + "integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==", + "dev": true, + "engines": { + "node": ">=4.0" + } }, - "debug": { + "node_modules/debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, - "requires": { + "dependencies": { "ms": "2.0.0" } }, - "decamelize": { + "node_modules/decamelize": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true + "node_modules/decode-uri-component": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", + "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "dev": true, + "engines": { + "node": ">=0.10" + } }, - "decompress": { + "node_modules/decompress": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.1.tgz", "integrity": "sha512-e48kc2IjU+2Zw8cTb6VZcJQ3lgVbS4uuB1TfCHbiZIP/haNXm+SVyhu+87jts5/3ROpd82GSVCoNs/z8l4ZOaQ==", "dev": true, - "requires": { + "dependencies": { "decompress-tar": "^4.0.0", "decompress-tarbz2": "^4.0.0", "decompress-targz": "^4.0.0", @@ -1619,217 +1964,254 @@ "pify": "^2.3.0", "strip-dirs": "^2.0.0" }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "decompress-response": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", - "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", + "node_modules/decompress-response/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", "dev": true, - "requires": { - "mimic-response": "^1.0.0" + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "decompress-tar": { + "node_modules/decompress-tar": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", "dev": true, - "requires": { + "dependencies": { "file-type": "^5.2.0", "is-stream": "^1.1.0", "tar-stream": "^1.5.2" }, - "dependencies": { - "file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", - "dev": true - } + "engines": { + "node": ">=4" } }, - "decompress-tarbz2": { + "node_modules/decompress-tar/node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", "dev": true, - "requires": { + "dependencies": { "decompress-tar": "^4.1.0", "file-type": "^6.1.0", "is-stream": "^1.1.0", "seek-bzip": "^1.0.5", "unbzip2-stream": "^1.0.9" }, - "dependencies": { - "file-type": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", - "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", - "dev": true - } + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-tarbz2/node_modules/file-type": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", + "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==", + "dev": true, + "engines": { + "node": ">=4" } }, - "decompress-targz": { + "node_modules/decompress-targz": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", "dev": true, - "requires": { + "dependencies": { "decompress-tar": "^4.1.1", "file-type": "^5.2.0", "is-stream": "^1.1.0" }, - "dependencies": { - "file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=", - "dev": true - } + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-targz/node_modules/file-type": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", + "integrity": "sha512-Iq1nJ6D2+yIO4c8HHg4fyVb8mAJieo1Oloy1mLLaB2PvezNedhBVm+QU7g0qM42aiMbRXTxKKwGD17rjKNJYVQ==", + "dev": true, + "engines": { + "node": ">=4" } }, - "decompress-unzip": { + "node_modules/decompress-unzip": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", - "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", + "integrity": "sha512-1fqeluvxgnn86MOh66u8FjbtJpAFv5wgCT9Iw8rcBqQcCo5tO8eiJw7NNTrvt9n4CRBVq7CstiS922oPgyGLrw==", "dev": true, - "requires": { + "dependencies": { "file-type": "^3.8.0", "get-stream": "^2.2.0", "pify": "^2.3.0", "yauzl": "^2.4.2" }, + "engines": { + "node": ">=4" + } + }, + "node_modules/decompress-unzip/node_modules/file-type": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", + "integrity": "sha512-RLoqTXE8/vPmMuTI88DAzhMYC99I8BWv7zYP4A1puo5HIjEJ5EX48ighy4ZyKMG9EDXxBgW6e++cn7d1xuFghA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress-unzip/node_modules/get-stream": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", + "integrity": "sha512-AUGhbbemXxrZJRD5cDvKtQxLuYaIbNtDTK8YqupCI393Q2KSTreEsLUN3ZxAWFGiKTzL6nKuzfcIvieflUX9qA==", + "dev": true, "dependencies": { - "file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=", - "dev": true - }, - "get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "dev": true, - "requires": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - } - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } + "object-assign": "^4.0.1", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "deep-eql": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.2.tgz", - "integrity": "sha512-gT18+YW4CcW/DBNTwAmqTtkJh7f9qqScu2qFVlx7kCoeY9tlBu9cUcr7+I+Z/noG8INehS3xQgLpTtd/QUTn4w==", - "requires": { + "node_modules/decompress-unzip/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/decompress/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/deep-eql": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", + "integrity": "sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==", + "dependencies": { "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=6" } }, - "deep-is": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", - "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "deepmerge": { + "node_modules/deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", "integrity": "sha512-FJ3UgI4gIl+PHZm53knsuSFpE+nESMr7M4v9QcgB7S63Kj/6WqMiFQJpBBYz1Pt+66bZpP3Q7Lye0Oo9MPKEdg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "defer-to-connect": { + "node_modules/defer-to-connect": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", - "dev": true - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", "dev": true, - "requires": { - "object-keys": "^1.0.12" + "engines": { + "node": ">=10" } }, - "defined": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", - "dev": true + "node_modules/define-properties": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", + "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "dev": true, + "dependencies": { + "has-property-descriptors": "^1.0.0", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "delayed-stream": { + "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "dev": true - }, - "deps-sort": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.1.tgz", - "integrity": "sha512-1orqXQr5po+3KI6kQb9A4jnXT1PBwggGl2d7Sq2xsnOeI9GPcE/tGcF9UiSZtZBM7MukY4cAh7MemS6tZYipfw==", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "shasum-object": "^1.0.0", - "subarg": "^1.0.0", - "through2": "^2.0.0" + "engines": { + "node": ">=0.4.0" } }, - "des.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", - "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" + "engines": { + "node": ">= 0.8" } }, - "detect-node": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.0.4.tgz", - "integrity": "sha512-ZIzRpLJrOj7jjP2miAtgqIfmzbxa4ZOr5jJc601zklsfEx9oTzmmj2nVpIPRpNlRTIh8lc1kyViIY7BWSGNmKw==", - "dev": true - }, - "detective": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/detective/-/detective-5.2.0.tgz", - "integrity": "sha512-6SsIx+nUUbuK0EthKjv0zrdnajCCXVYGmbYYiYjFVpzcjwEs/JMDZ8tPRG29J/HhN56t3GJp2cGSWDRjjot8Pg==", + "node_modules/destroy": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", + "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==", "dev": true, - "requires": { - "acorn-node": "^1.6.1", - "defined": "^1.0.0", - "minimist": "^1.1.1" + "engines": { + "node": ">= 0.8", + "npm": "1.2.8000 || >= 1.4.16" } }, - "devtools": { + "node_modules/detect-node": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/detect-node/-/detect-node-2.1.0.tgz", + "integrity": "sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==", + "dev": true + }, + "node_modules/devtools": { "version": "6.12.1", "resolved": "https://registry.npmjs.org/devtools/-/devtools-6.12.1.tgz", "integrity": "sha512-JyG46suEiZmld7/UVeogkCWM0zYGt+2ML/TI+SkEp+bTv9cs46cDb0pKF3glYZJA7wVVL2gC07Ic0iCxyJEnCQ==", "dev": true, - "requires": { + "dependencies": { "@wdio/config": "6.12.1", "@wdio/logger": "6.10.10", "@wdio/protocols": "6.12.0", @@ -1840,86 +2222,59 @@ "ua-parser-js": "^0.7.21", "uuid": "^8.0.0" }, - "dependencies": { - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true - } + "engines": { + "node": ">=10.0.0" } }, - "devtools-protocol": { + "node_modules/devtools-protocol": { "version": "0.0.818844", "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.818844.tgz", "integrity": "sha512-AD1hi7iVJ8OD0aMLQU5VK0XH9LDlA1+BcPIgrAxPfaibx2DbWucuyOhc4oyQCbnvDDO68nN6/LcKfqTP343Jjg==", "dev": true }, - "di": { + "node_modules/di": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/di/-/di-0.0.1.tgz", - "integrity": "sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw=", + "integrity": "sha512-uJaamHkagcZtHPqCIHZxnFrXlunQXgBOsZSUOWwFw31QJCAbyTBoHMW75YOTur5ZNx8pIeAKgf6GWIgaqqiLhA==", "dev": true }, - "diff": { + "node_modules/diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } + "engines": { + "node": ">=0.3.1" } }, - "dom-serialize": { + "node_modules/dom-serialize": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz", - "integrity": "sha1-ViromZ9Evl6jB29UGdzVnrQ6yVs=", + "integrity": "sha512-Yra4DbvoW7/Z6LBN560ZwXMjoNOSAN2wRsKFGc4iBeso+mpIA6qj1vfdf9HpMaKAqG6wXTy+1SYEzmNpKXOSsQ==", "dev": true, - "requires": { + "dependencies": { "custom-event": "~1.0.0", "ent": "~2.2.0", "extend": "^3.0.0", "void-elements": "^2.0.0" } }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "dot-case": { + "node_modules/dot-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/dot-case/-/dot-case-3.0.4.tgz", "integrity": "sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==", "dev": true, - "requires": { + "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" } }, - "download": { + "node_modules/download": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/download/-/download-7.1.0.tgz", "integrity": "sha512-xqnBTVd/E+GxJVrX5/eUJiLYjCGPwMpdL+jGhGU57BvtcA7wwhtHVbXBeUk51kOpW3S7Jn3BQbN9Q1R1Km2qDQ==", "dev": true, - "requires": { + "dependencies": { "archive-type": "^4.0.0", "caw": "^2.0.1", "content-disposition": "^0.5.2", @@ -1933,315 +2288,452 @@ "p-event": "^2.1.0", "pify": "^3.0.0" }, + "engines": { + "node": ">=6" + } + }, + "node_modules/download/node_modules/@sindresorhus/is": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.7.0.tgz", + "integrity": "sha512-ONhaKPIufzzrlNbqtWFFd+jlnemX6lJAgq9ZeiZtS7I1PIf/la7CW4m83rTXRnVnsMbW2k56pGYu7AUFJD9Pow==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/cacheable-request": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-2.1.4.tgz", + "integrity": "sha512-vag0O2LKZ/najSoUwDbVlnlCFvhBE/7mGTY2B5FgCBDcRD+oVV1HYTOwM6JZfMg/hIcM6IwnTZ1uQQL5/X3xIQ==", + "dev": true, "dependencies": { - "got": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", - "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", - "dev": true, - "requires": { - "@sindresorhus/is": "^0.7.0", - "cacheable-request": "^2.1.1", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "into-stream": "^3.1.0", - "is-retry-allowed": "^1.1.0", - "isurl": "^1.0.0-alpha5", - "lowercase-keys": "^1.0.0", - "mimic-response": "^1.0.0", - "p-cancelable": "^0.4.0", - "p-timeout": "^2.0.1", - "pify": "^3.0.0", - "safe-buffer": "^5.1.1", - "timed-out": "^4.0.1", - "url-parse-lax": "^3.0.0", - "url-to-options": "^1.0.1" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } + "clone-response": "1.0.2", + "get-stream": "3.0.0", + "http-cache-semantics": "3.8.1", + "keyv": "3.0.0", + "lowercase-keys": "1.0.0", + "normalize-url": "2.0.1", + "responselike": "1.0.2" } }, - "duplexer2": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", - "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "node_modules/download/node_modules/cacheable-request/node_modules/lowercase-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.0.tgz", + "integrity": "sha512-RPlX0+PHuvxVDZ7xX+EBVAp4RsVxP/TdDSN2mJYdiq1Lc4Hz7EUSjUI7RZrKKlmrIzVhf6Jo2stj7++gVarS0A==", "dev": true, - "requires": { - "readable-stream": "^2.0.2" + "engines": { + "node": ">=0.10.0" } }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "node_modules/download/node_modules/clone-response": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", + "integrity": "sha512-yjLXh88P599UOyPTFX0POsd7WxnbsVsGohcwzHOLspIhhpalPw1BcqED8NblyZLKcGrL8dTgMlcaZxV2jAD41Q==", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + } + }, + "node_modules/download/node_modules/decompress-response": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", + "integrity": "sha512-BzRPQuY1ip+qDonAOz42gRm/pg9F768C+npV/4JOsxRC2sq+Rlk+Q4ZCAsOhnIaMrgarILY+RMUIvMmmX1qAEA==", + "dev": true, + "dependencies": { + "mimic-response": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/got": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/got/-/got-8.3.2.tgz", + "integrity": "sha512-qjUJ5U/hawxosMryILofZCkm3C84PLJS/0grRIpjAwu+Lkxxj5cxeCU25BG0/3mDSpXKTyZr8oh8wIgLaH0QCw==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^0.7.0", + "cacheable-request": "^2.1.1", + "decompress-response": "^3.3.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "into-stream": "^3.1.0", + "is-retry-allowed": "^1.1.0", + "isurl": "^1.0.0-alpha5", + "lowercase-keys": "^1.0.0", + "mimic-response": "^1.0.0", + "p-cancelable": "^0.4.0", + "p-timeout": "^2.0.1", + "pify": "^3.0.0", + "safe-buffer": "^5.1.1", + "timed-out": "^4.0.1", + "url-parse-lax": "^3.0.0", + "url-to-options": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/http-cache-semantics": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", + "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", + "dev": true + }, + "node_modules/download/node_modules/json-buffer": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", + "integrity": "sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==", + "dev": true + }, + "node_modules/download/node_modules/keyv": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", + "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.0" + } + }, + "node_modules/download/node_modules/lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/download/node_modules/normalize-url": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", + "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "dev": true, + "dependencies": { + "prepend-http": "^2.0.0", + "query-string": "^5.0.1", + "sort-keys": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/p-cancelable": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", + "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/download/node_modules/responselike": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha512-/Fpe5guzJk1gPqdJLJR5u7eG/gNY4nImjbRDaVWVMRhne55TCmj2i9Q+54PBRfatRC8v/rIiv9BN0pMd9OV5EQ==", + "dev": true, + "dependencies": { + "lowercase-keys": "^1.0.0" + } + }, + "node_modules/download/node_modules/sort-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", + "integrity": "sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg==", + "dev": true, + "dependencies": { + "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/duplexer3": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.5.tgz", + "integrity": "sha512-1A8za6ws41LQgv9HrE/66jyC5yuSjQ3L/KOpFtoBilsAK2iA2wuS5rTt1OCzIvtS2V7nVmedsUU+DGRcjBmOYA==", "dev": true }, - "edge-paths": { + "node_modules/edge-paths": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/edge-paths/-/edge-paths-2.2.1.tgz", "integrity": "sha512-AI5fC7dfDmCdKo3m5y7PkYE8m6bMqR6pvVpgtrZkkhcJXFLelUgkjrhk3kXXx8Kbw2cRaTT4LkOR7hqf39KJdw==", "dev": true, - "requires": { + "dependencies": { "@types/which": "^1.3.2", "which": "^2.0.2" - }, + } + }, + "node_modules/edge-paths/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "dependencies": { - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "ee-first": { + "node_modules/ee-first": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dev": true, - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - } - } - }, - "emoji-regex": { + "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "encodeurl": { + "node_modules/encodeurl": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", - "dev": true + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "dev": true, + "engines": { + "node": ">= 0.8" + } }, - "end-of-stream": { + "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "dev": true, - "requires": { + "dependencies": { "once": "^1.4.0" } }, - "engine.io": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-4.1.1.tgz", - "integrity": "sha512-t2E9wLlssQjGw0nluF6aYyfX8LwYU8Jj0xct+pAhfWfv/YrBn6TSNtEYsgxHIfaMqfrLx07czcMg9bMN6di+3w==", + "node_modules/engine.io": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.2.1.tgz", + "integrity": "sha512-ECceEFcAaNRybd3lsGQKas3ZlMVjN3cyWwMP25D2i0zWfyiytVbTpRPa34qrr+FHddtpBVOmq4H/DCv1O0lZRA==", "dev": true, - "requires": { + "dependencies": { + "@types/cookie": "^0.4.1", + "@types/cors": "^2.8.12", + "@types/node": ">=10.0.0", "accepts": "~1.3.4", "base64id": "2.0.0", "cookie": "~0.4.1", "cors": "~2.8.5", "debug": "~4.3.1", - "engine.io-parser": "~4.0.0", - "ws": "~7.4.2" + "engine.io-parser": "~5.0.3", + "ws": "~8.2.3" }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } + "engines": { + "node": ">=10.0.0" } }, - "engine.io-parser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-4.0.2.tgz", - "integrity": "sha512-sHfEQv6nmtJrq6TKuIz5kyEKH/qSdK56H/A+7DnAuUPWosnIZAS2NHNcPLmyjtY3cGS/MqJdZbUjW97JU72iYg==", + "node_modules/engine.io-parser": { + "version": "5.0.6", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.0.6.tgz", + "integrity": "sha512-tjuoZDMAdEhVnSFleYPCtdL2GXwVTGtNjoeJd9IhIG3C1xs9uwxqRNEu5WpnDZCaozwVlK/nuQhpodhXSIMaxw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/engine.io/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, - "requires": { - "base64-arraybuffer": "0.1.4" + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "ent": { + "node_modules/engine.io/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/ent": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/ent/-/ent-2.2.0.tgz", - "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", + "integrity": "sha512-GHrMyVZQWvTIdDtpiEXdHZnFQKzeO09apj8Cbl4pKWy4i0Oprcq17usfDt5aO63swf0JOeMWjWQE/LzgSRuWpA==", "dev": true }, - "es-abstract": { - "version": "1.18.0-next.3", - "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0-next.3.tgz", - "integrity": "sha512-VMzHx/Bczjg59E6jZOQjHeN3DEoptdhejpARgflAViidlqSpjdq9zA6lKwlhRRs/lOw1gHJv2xkkSFRgvEwbQg==", - "dev": true, - "requires": { - "call-bind": "^1.0.2", - "es-to-primitive": "^1.2.1", - "function-bind": "^1.1.1", - "get-intrinsic": "^1.1.1", - "has": "^1.0.3", - "has-symbols": "^1.0.2", - "is-callable": "^1.2.3", - "is-negative-zero": "^2.0.1", - "is-regex": "^1.1.2", - "is-string": "^1.0.5", - "object-inspect": "^1.9.0", - "object-keys": "^1.1.1", - "object.assign": "^4.1.2", - "string.prototype.trimend": "^1.0.4", - "string.prototype.trimstart": "^1.0.4", - "unbox-primitive": "^1.0.0" - } - }, - "es-to-primitive": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", - "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, - "requires": { - "is-callable": "^1.1.4", - "is-date-object": "^1.0.1", - "is-symbol": "^1.0.2" + "dependencies": { + "is-arrayish": "^0.2.1" } }, - "es6-error": { + "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "escalade": { + "node_modules/esbuild": { + "version": "0.17.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.3.tgz", + "integrity": "sha512-9n3AsBRe6sIyOc6kmoXg2ypCLgf3eZSraWFRpnkto+svt8cZNuKTkb1bhQcitBcvIqjNiK7K0J3KPmwGSfkA8g==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.17.3", + "@esbuild/android-arm64": "0.17.3", + "@esbuild/android-x64": "0.17.3", + "@esbuild/darwin-arm64": "0.17.3", + "@esbuild/darwin-x64": "0.17.3", + "@esbuild/freebsd-arm64": "0.17.3", + "@esbuild/freebsd-x64": "0.17.3", + "@esbuild/linux-arm": "0.17.3", + "@esbuild/linux-arm64": "0.17.3", + "@esbuild/linux-ia32": "0.17.3", + "@esbuild/linux-loong64": "0.17.3", + "@esbuild/linux-mips64el": "0.17.3", + "@esbuild/linux-ppc64": "0.17.3", + "@esbuild/linux-riscv64": "0.17.3", + "@esbuild/linux-s390x": "0.17.3", + "@esbuild/linux-x64": "0.17.3", + "@esbuild/netbsd-x64": "0.17.3", + "@esbuild/openbsd-x64": "0.17.3", + "@esbuild/sunos-x64": "0.17.3", + "@esbuild/win32-arm64": "0.17.3", + "@esbuild/win32-ia32": "0.17.3", + "@esbuild/win32-x64": "0.17.3" + } + }, + "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "escape-html": { + "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", "dev": true }, - "escape-string-regexp": { + "node_modules/escape-string-regexp": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "escodegen": { + "node_modules/escodegen": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.8.1.tgz", - "integrity": "sha1-WltTr0aTEQvrsIZ6o0MN07cKEBg=", + "integrity": "sha512-yhi5S+mNTOuRvyW4gWlg5W1byMaQGWWSYHXsuFZ7GBo7tpyOwi2EdzMP/QWxh9hwkD2m+wDVHJsxhRIj+v/b/A==", "dev": true, - "requires": { + "dependencies": { "esprima": "^2.7.1", "estraverse": "^1.9.1", "esutils": "^2.0.2", - "optionator": "^0.8.1", - "source-map": "~0.2.0" + "optionator": "^0.8.1" }, - "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "source-map": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", - "integrity": "sha1-2rc/vPwrqBm03gO9b26qSBZLP50=", - "dev": true, - "optional": true, - "requires": { - "amdefine": ">=0.0.4" - } - } + "bin": { + "escodegen": "bin/escodegen.js", + "esgenerate": "bin/esgenerate.js" + }, + "engines": { + "node": ">=0.12.0" + }, + "optionalDependencies": { + "source-map": "~0.2.0" + } + }, + "node_modules/escodegen/node_modules/source-map": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.2.0.tgz", + "integrity": "sha512-CBdZ2oa/BHhS4xj5DlhjWNHcan57/5YuvfdLf17iVmIpd9KRm+DFLmC6nBNj+6Ua7Kt3TmOjDpQT1aTYOQtoUA==", + "dev": true, + "optional": true, + "dependencies": { + "amdefine": ">=0.0.4" + }, + "engines": { + "node": ">=0.8.0" } }, - "esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "node_modules/esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha512-OarPfz0lFCiW4/AV2Oy1Rp9qu0iusTKqykwTspGCZtPxmF81JR4MmIebvF1F9+UOKth2ZubLQ4XGGaU+hSn99A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=0.10.0" + } }, - "estraverse": { + "node_modules/estraverse": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.9.3.tgz", - "integrity": "sha1-r2fy3JIlgkFZUJJgkaQAXSnJu0Q=", - "dev": true + "integrity": "sha512-25w1fMXQrGdoquWnScXZGckOv+Wes+JDnuN/+7ex3SauFRS72r2lFDec0EKPt2YD1wUJ/IrfEex+9yp4hfSOJA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "eventemitter3": { + "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==", "dev": true }, - "events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "execa": { + "node_modules/execa": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "integrity": "sha512-RztN09XglpYI7aBBrJCPW95jEH7YF1UEPOoX9yDhUTPdp7mK+CQvnLTuD10BNXZ3byLTu2uehZ8EcKT/4CGiFw==", "dev": true, - "requires": { + "dependencies": { "cross-spawn": "^5.0.1", "get-stream": "^3.0.0", "is-stream": "^1.1.0", @@ -2249,159 +2741,201 @@ "p-finally": "^1.0.0", "signal-exit": "^3.0.0", "strip-eof": "^1.0.0" + }, + "engines": { + "node": ">=4" } }, - "executable": { + "node_modules/executable": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/executable/-/executable-4.1.1.tgz", "integrity": "sha512-8iA79xD3uAch729dUG8xaaBBFGaEa0wdD2VkYLFHwlqosEj/jT66AzcreRDSgV7ehnNLBW2WR5jIXwGKjVdTLg==", "dev": true, - "requires": { + "dependencies": { "pify": "^2.2.0" }, - "dependencies": { - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - } + "engines": { + "node": ">=4" } }, - "exit-on-epipe": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/exit-on-epipe/-/exit-on-epipe-1.0.1.tgz", - "integrity": "sha512-h2z5mrROTxce56S+pnvAV890uu7ls7f1kEvVGJbw1OlFH3/mlJ5bkXu0KRyW94v37zzHPiUd55iLn3DA7TjWpw==", - "dev": true + "node_modules/executable/node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "ext-list": { + "node_modules/ext-list": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/ext-list/-/ext-list-2.2.2.tgz", "integrity": "sha512-u+SQgsubraE6zItfVA0tBuCBhfU9ogSRnsvygI7wht9TS510oLkBRXBsqopeUG/GBOIQyKZO9wjTqIu/sf5zFA==", "dev": true, - "requires": { + "dependencies": { "mime-db": "^1.28.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "ext-name": { + "node_modules/ext-name": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ext-name/-/ext-name-5.0.0.tgz", "integrity": "sha512-yblEwXAbGv1VQDmow7s38W77hzAgJAO50ztBLMcUyUBfxv1HC+LGwtiEN+Co6LtlqT/5uwVOxsD4TNIilWhwdQ==", "dev": true, - "requires": { + "dependencies": { "ext-list": "^2.0.0", "sort-keys-length": "^1.0.0" + }, + "engines": { + "node": ">=4" } }, - "extend": { + "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, - "extract-zip": { + "node_modules/extract-zip": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "dev": true, - "requires": { - "@types/yauzl": "^2.9.1", + "dependencies": { "debug": "^4.1.1", "get-stream": "^5.1.0", "yauzl": "^2.10.0" }, + "bin": { + "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" + } + }, + "node_modules/extract-zip/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "fast-deep-equal": { + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/extract-zip/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/fast-deep-equal": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", "dev": true }, - "fast-levenshtein": { + "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", - "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, - "fast-safe-stringify": { - "version": "2.0.7", - "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz", - "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==", - "dev": true + "node_modules/fast-url-parser": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", + "integrity": "sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ==", + "dev": true, + "dependencies": { + "punycode": "^1.3.2" + } }, - "fd-slicer": { + "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", "dev": true, - "requires": { + "dependencies": { "pend": "~1.2.0" } }, - "file-type": { + "node_modules/file-type": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/file-type/-/file-type-8.1.0.tgz", "integrity": "sha512-qyQ0pzAy78gVoJsmYeNgl8uH8yKhr1lVhW7JbzJmnlRi0I4R2eEDEJZVKG8agpDnLpacwNbDhLNG/LMdxHD2YQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "filename-reserved-regex": { + "node_modules/filename-reserved-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", - "integrity": "sha1-q/c9+rc10EVECr/qLZHzieu/oik=", - "dev": true + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "filenamify": { + "node_modules/filenamify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-2.1.0.tgz", "integrity": "sha512-ICw7NTT6RsDp2rnYKVd8Fu4cr6ITzGy3+u4vUujPkabyaz+03F24NWEX7fs5fp+kBonlaqPH8fAO2NM+SXt/JA==", "dev": true, - "requires": { + "dependencies": { "filename-reserved-regex": "^2.0.0", "strip-outer": "^1.0.0", "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=4" } }, - "fill-range": { + "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", "dev": true, - "requires": { + "dependencies": { "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "finalhandler": { + "node_modules/finalhandler": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", "dev": true, - "requires": { + "dependencies": { "debug": "2.6.9", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", @@ -2409,186 +2943,258 @@ "parseurl": "~1.3.3", "statuses": "~1.5.0", "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "node_modules/finalhandler/node_modules/on-finished": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", + "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==", "dev": true, - "requires": { - "locate-path": "^5.0.0", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "find-versions": { + "node_modules/find-versions": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", "dev": true, - "requires": { + "dependencies": { "semver-regex": "^2.0.0" + }, + "engines": { + "node": ">=6" } }, - "flat": { + "node_modules/flat": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "flatted": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", - "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", - "dev": true + "dev": true, + "bin": { + "flat": "cli.js" + } }, - "follow-redirects": { - "version": "1.13.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.3.tgz", - "integrity": "sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA==", + "node_modules/flatted": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz", + "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==", "dev": true }, - "foreach": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", - "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", - "dev": true + "node_modules/follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } }, - "form-data": { + "node_modules/form-data": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz", "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==", "dev": true, - "requires": { + "dependencies": { "asynckit": "^0.4.0", "combined-stream": "^1.0.8", "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" } }, - "from2": { + "node_modules/from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", + "integrity": "sha512-OMcX/4IC/uqEPVgGeyfN22LJk6AZrMkRZHxcHBMBvHScDGgwTm2GT2Wkgtocyd3JfZffjj2kYUDXXII0Fk9W0g==", "dev": true, - "requires": { + "dependencies": { "inherits": "^2.0.1", "readable-stream": "^2.0.0" } }, - "fs-constants": { + "node_modules/fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", "dev": true }, - "fs-extra": { + "node_modules/fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, - "requires": { + "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" } }, - "fs.realpath": { + "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "fsevents": { + "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", "dev": true, - "optional": true + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } }, - "function-bind": { + "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "get-assigned-identifiers": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", - "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", - "dev": true - }, - "get-caller-file": { + "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } }, - "get-func-name": { + "node_modules/get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "engines": { + "node": "*" + } }, - "get-intrinsic": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", - "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "node_modules/get-intrinsic": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz", + "integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==", "dev": true, - "requires": { + "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", - "has-symbols": "^1.0.1" + "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "get-port": { + "node_modules/get-port": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/get-port/-/get-port-5.1.1.tgz", "integrity": "sha512-g/Q1aTSDOxFpchXC4i8ZWvxA1lnPqx/JHqcpIw0/LX9T8x/GBbi6YnlN5nhaKIFkT8oFsscUKgDJYxfwfS6QsQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "get-proxy": { + "node_modules/get-proxy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/get-proxy/-/get-proxy-2.1.0.tgz", "integrity": "sha512-zmZIaQTWnNQb4R4fJUEp/FC51eZsc6EkErspy3xtIYStaq8EB/hDIWipxsal+E8rz0qD7f2sL/NA9Xee4RInJw==", "dev": true, - "requires": { + "dependencies": { "npm-conf": "^1.1.0" + }, + "engines": { + "node": ">=4" } }, - "get-stream": { + "node_modules/get-stream": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true + "integrity": "sha512-GlhdIUuVakc8SJ6kK0zAFbiGzRFzNnY4jUuEbV9UROo4Y+0Ny4fjvcZFVTeDA4odpFyOQzaw6hXukJSq/f28sQ==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, - "requires": { + "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "glob-parent": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.1.tgz", - "integrity": "sha512-FnI+VGOpnlGHWZxthPGR+QhR78fuiK0sNLkHQv+bL9fQi57lNNdquIbna/WrfROrolq8GK5Ek6BiMwqL/voRYQ==", + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "requires": { + "dependencies": { "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" } }, - "global-agent": { - "version": "2.1.12", - "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-2.1.12.tgz", - "integrity": "sha512-caAljRMS/qcDo69X9BfkgrihGUgGx44Fb4QQToNQjsiWh+YlQ66uqYVAdA8Olqit+5Ng0nkz09je3ZzANMZcjg==", + "node_modules/global-agent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-2.2.0.tgz", + "integrity": "sha512-+20KpaW6DDLqhG7JDiJpD1JvNvb8ts+TNl7BPOYcURqCrXqnN1Vf+XVOrkKJAFPqfX+oEhsdzOj1hLWkBTdNJg==", "dev": true, - "requires": { + "dependencies": { "boolean": "^3.0.1", "core-js": "^3.6.5", "es6-error": "^4.1.1", @@ -2597,711 +3203,618 @@ "semver": "^7.3.2", "serialize-error": "^7.0.1" }, + "engines": { + "node": ">=10.0" + } + }, + "node_modules/global-agent/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, "dependencies": { - "semver": { - "version": "7.3.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.4.tgz", - "integrity": "sha512-tCfb2WLjqFAtXn4KEdxIhalnRtoKFN7nAwj0B3ZXCbQloV2tq5eDbcTmT68JJD3nRJq24/XgxtQKFIpQdtvmVw==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - } - } + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, - "globalthis": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.2.tgz", - "integrity": "sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==", + "node_modules/global-agent/node_modules/semver": { + "version": "7.3.8", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.8.tgz", + "integrity": "sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/global-agent/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/globalthis": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.3.tgz", + "integrity": "sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA==", "dev": true, - "requires": { + "dependencies": { "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "got": { - "version": "11.8.2", - "resolved": "https://registry.npmjs.org/got/-/got-11.8.2.tgz", - "integrity": "sha512-D0QywKgIe30ODs+fm8wMZiAcZjypcCodPNuMz5H9Mny7RJ+IjJ10BdmGW7OM7fHXP+O7r6ZwapQ/YQmMSvB0UQ==", + "node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", "dev": true, - "requires": { + "dependencies": { "@sindresorhus/is": "^4.0.0", "@szmarczak/http-timer": "^4.0.5", "@types/cacheable-request": "^6.0.1", "@types/responselike": "^1.0.0", "cacheable-lookup": "^5.0.3", - "cacheable-request": "^7.0.1", + "cacheable-request": "^7.0.2", "decompress-response": "^6.0.0", "http2-wrapper": "^1.0.0-beta.5.2", "lowercase-keys": "^2.0.0", "p-cancelable": "^2.0.0", "responselike": "^2.0.0" }, - "dependencies": { - "@sindresorhus/is": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.0.0.tgz", - "integrity": "sha512-FyD2meJpDPjyNQejSjvnhpgI/azsQkA4lGbuu5BQZfjvJ9cbRZXzeWL2HceCekW4lixO9JPesIIQkSoLjeJHNQ==", - "dev": true - }, - "cacheable-request": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.1.tgz", - "integrity": "sha512-lt0mJ6YAnsrBErpTMWeu5kl/tg9xMAWjavYTN6VQXM1A/teBITuNcccXsCxF0tDQQJf9DfAaX5O4e0zp0KlfZw==", - "dev": true, - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^4.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^2.0.0" - } - }, - "decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", - "dev": true, - "requires": { - "mimic-response": "^3.1.0" - } - }, - "get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "requires": { - "pump": "^3.0.0" - } - }, - "http-cache-semantics": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", - "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", - "dev": true - }, - "json-buffer": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", - "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", - "dev": true - }, - "keyv": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.0.3.tgz", - "integrity": "sha512-zdGa2TOpSZPq5mU6iowDARnMBZgtCqJ11dJROFi6tg6kTn4nuUdU09lFyLFSaHrWqpIJ+EBq4E8/Dc0Vx5vLdA==", - "dev": true, - "requires": { - "json-buffer": "3.0.1" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", - "dev": true - }, - "mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", - "dev": true - }, - "normalize-url": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", - "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", - "dev": true - }, - "p-cancelable": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.0.0.tgz", - "integrity": "sha512-wvPXDmbMmu2ksjkB4Z3nZWTSkJEb9lqVdMaCKpZUGJG9TMiNp9XcbG3fn9fPKjem04fJMJnXoyFPk2FmgiaiNg==", - "dev": true - }, - "responselike": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.0.tgz", - "integrity": "sha512-xH48u3FTB9VsZw7R+vvgaKeLKzT6jOogbQhEe/jewwnZgzPcnyWui2Av6JpoYZF/91uueC+lqhWqeURw5/qhCw==", - "dev": true, - "requires": { - "lowercase-keys": "^2.0.0" - } - } + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" } }, - "graceful-fs": { - "version": "4.2.6", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.6.tgz", - "integrity": "sha512-nTnJ528pbqxYanhpDYsi4Rd8MAeaBA67+RZ10CM1m3bTAVFEDcd5AuA4a6W5YkGZ1iNXHzZz8T6TBKLeBuNriQ==", + "node_modules/graceful-fs": { + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "grapheme-splitter": { + "node_modules/grapheme-splitter": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", "dev": true }, - "growl": { + "node_modules/growl": { "version": "1.10.5", "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true + "dev": true, + "engines": { + "node": ">=4.x" + } }, - "handlebars": { - "version": "4.0.12", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.12.tgz", - "integrity": "sha512-RhmTekP+FZL+XNhwS1Wf+bTTZpdLougwt5pcgA1tuz6Jcx0fpH/7z0qd71RKnZHBCxIRBHfBOnio4gViPemNzA==", + "node_modules/handlebars": { + "version": "4.7.7", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.7.tgz", + "integrity": "sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==", "dev": true, - "requires": { - "async": "^2.5.0", - "optimist": "^0.6.1", + "dependencies": { + "minimist": "^1.2.5", + "neo-async": "^2.6.0", "source-map": "^0.6.1", - "uglify-js": "^3.1.4" + "wordwrap": "^1.0.0" }, - "dependencies": { - "async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.1.tgz", - "integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==", - "dev": true, - "requires": { - "lodash": "^4.17.10" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } + "bin": { + "handlebars": "bin/handlebars" + }, + "engines": { + "node": ">=0.4.7" + }, + "optionalDependencies": { + "uglify-js": "^3.1.4" + } + }, + "node_modules/handlebars/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, - "has": { + "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, - "requires": { + "dependencies": { "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" } }, - "has-bigints": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", - "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", - "dev": true - }, - "has-flag": { + "node_modules/has-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true + "integrity": "sha512-DyYHfIYwAJmjAjSSPKANxI8bFY9YtFrgkAfinBojQ8YJTOuOuav64tMUJv584SES4xl74PmuaevIyaLESHdTAA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/has-property-descriptors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", + "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "has-symbol-support-x": { + "node_modules/has-symbol-support-x": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==", - "dev": true + "dev": true, + "engines": { + "node": "*" + } }, - "has-symbols": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", - "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", - "dev": true + "node_modules/has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "has-to-string-tag-x": { + "node_modules/has-to-string-tag-x": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", "dev": true, - "requires": { + "dependencies": { "has-symbol-support-x": "^1.4.1" - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dev": true, - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } + "engines": { + "node": "*" } }, - "hash.js": { + "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", "dev": true, - "requires": { + "dependencies": { "inherits": "^2.0.3", "minimalistic-assert": "^1.0.1" } }, - "he": { + "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true + "dev": true, + "bin": { + "he": "bin/he" + } }, - "header-case": { + "node_modules/header-case": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", "integrity": "sha512-H/vuk5TEEVZwrR0lp2zed9OCo1uAILMlx0JEMgC26rzyJJ3N1v6XkwHHXJQdR2doSjcGPM6OKPYoJgf0plJ11Q==", "dev": true, - "requires": { + "dependencies": { "capital-case": "^1.0.4", "tslib": "^2.0.3" } }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "htmlescape": { - "version": "1.1.1", - "resolved": "http://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", - "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", + "node_modules/http-cache-semantics": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", + "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", "dev": true }, - "http-cache-semantics": { - "version": "3.8.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz", - "integrity": "sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w==", - "dev": true + "node_modules/http-errors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz", + "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==", + "dev": true, + "dependencies": { + "depd": "2.0.0", + "inherits": "2.0.4", + "setprototypeof": "1.2.0", + "statuses": "2.0.1", + "toidentifier": "1.0.1" + }, + "engines": { + "node": ">= 0.8" + } }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "node_modules/http-errors/node_modules/statuses": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz", + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==", "dev": true, - "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" + "engines": { + "node": ">= 0.8" } }, - "http-proxy": { + "node_modules/http-proxy": { "version": "1.18.1", "resolved": "https://registry.npmjs.org/http-proxy/-/http-proxy-1.18.1.tgz", "integrity": "sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==", "dev": true, - "requires": { + "dependencies": { "eventemitter3": "^4.0.0", "follow-redirects": "^1.0.0", "requires-port": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" } }, - "http-proxy-agent": { + "node_modules/http-proxy-agent": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", "dev": true, - "requires": { + "dependencies": { "@tootallnate/once": "1", "agent-base": "6", "debug": "4" }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-agent/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "http2-wrapper": { + "node_modules/http-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/http2-wrapper": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", "dev": true, - "requires": { + "dependencies": { "quick-lru": "^5.1.1", "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" } }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "https-proxy-agent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", - "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", "dev": true, - "requires": { - "agent-base": "5", + "dependencies": { + "agent-base": "6", "debug": "4" }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/https-proxy-agent/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "agent-base": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", - "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", - "dev": true - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "iconv-lite": { + "node_modules/https-proxy-agent/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, - "requires": { + "dependencies": { "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" } }, - "ieee754": { + "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "ignore-walk": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.3.tgz", - "integrity": "sha512-m7o6xuOaT1aqheYHKf8W6J5pYH85ZI9w077erOzLje3JsB1gkafkAhHHY19dqjulgIZHFm32Cp5uNZgcQqdJKw==", + "node_modules/ignore-walk": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", + "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", "dev": true, - "requires": { + "dependencies": { "minimatch": "^3.0.4" } }, - "import-lazy": { + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-lazy": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-3.1.0.tgz", "integrity": "sha512-8/gvXvX2JMn0F+CDlSC4l6kOmVaLOO3XLkksI7CI3Ud95KDYJuYur2b9P/PUt/i/pDAMd/DulQsNbbbmRRsDIQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "inflight": { + "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, - "requires": { + "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "ini": { + "node_modules/ini": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "dev": true }, - "inline-source-map": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", - "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", - "dev": true, - "requires": { - "source-map": "~0.5.3" - } - }, - "insert-module-globals": { - "version": "7.2.1", - "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.1.tgz", - "integrity": "sha512-ufS5Qq9RZN+Bu899eA9QCAYThY+gGW7oRkmb0vC93Vlyu/CFGcH0OYPEjVkDXA5FEbTt1+VWzdoOD3Ny9N+8tg==", - "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "acorn-node": "^1.5.2", - "combine-source-map": "^0.8.0", - "concat-stream": "^1.6.1", - "is-buffer": "^1.1.0", - "path-is-absolute": "^1.0.1", - "process": "~0.11.0", - "through2": "^2.0.0", - "undeclared-identifiers": "^1.1.2", - "xtend": "^4.0.0" - } - }, - "into-stream": { + "node_modules/into-stream": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/into-stream/-/into-stream-3.1.0.tgz", - "integrity": "sha1-lvsKk2wSur1v8XUqF9BWFqvQlMY=", + "integrity": "sha512-TcdjPibTksa1NQximqep2r17ISRiNE9fwlfbg3F8ANdvP5/yrFTew86VcO//jk4QTaMlbjypPBq76HN2zaKfZQ==", "dev": true, - "requires": { + "dependencies": { "from2": "^2.1.1", "p-is-promise": "^1.1.0" + }, + "engines": { + "node": ">=4" } }, - "is-arguments": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.0.tgz", - "integrity": "sha512-1Ij4lOMPl/xB5kBDn7I+b2ttPMKa8szhEIrXDuXQD/oe3HJLTLhqhgGspwgyGd6MOywBUqVvYicF72lkgDnIHg==", - "dev": true, - "requires": { - "call-bind": "^1.0.0" - } - }, - "is-bigint": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", - "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "is-binary-path": { + "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", "dev": true, - "requires": { + "dependencies": { "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" } }, - "is-boolean-object": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz", - "integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==", - "dev": true, - "requires": { - "call-bind": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true - }, - "is-callable": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", - "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", - "dev": true - }, - "is-core-module": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.2.0.tgz", - "integrity": "sha512-XRAfAdyyY5F5cOXn7hYQDqh2Xmii+DEfIcQGxK/uNwMHhIkPWO0g8msXcbzLe+MpGoR951MlqM/2iIlU4vKDdQ==", + "node_modules/is-docker": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz", + "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==", "dev": true, - "requires": { - "has": "^1.0.3" + "bin": { + "is-docker": "cli.js" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "is-date-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.2.tgz", - "integrity": "sha512-USlDT524woQ08aoZFzh3/Z6ch9Y/EWXEHQ/AaRN0SkKq4t2Jw2R2339tSXmwuVoY7LLlBCbOIlx2myP/L5zk0g==", - "dev": true - }, - "is-docker": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.1.1.tgz", - "integrity": "sha512-ZOoqiXfEwtGknTiuDEy8pN2CfE3TxMHprvNer1mXiqwkOT77Rw3YVrUQ52EqAOU3QAWDQ+bQdx7HJzrv7LS2Hw==", - "dev": true - }, - "is-extglob": { + "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "is-generator-function": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.8.tgz", - "integrity": "sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ==", - "dev": true + "node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, - "requires": { + "dependencies": { "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, - "is-natural-number": { + "node_modules/is-natural-number": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", - "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=", - "dev": true - }, - "is-negative-zero": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.1.tgz", - "integrity": "sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w==", + "integrity": "sha512-Y4LTamMe0DDQIIAlaer9eKebAlDSV6huy+TWhJVPlzZh2o4tRP5SQWFlLn5N0To4mDD22/qdOq+veo1cSISLgQ==", "dev": true }, - "is-number": { + "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-number-object": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", - "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.12.0" + } }, - "is-object": { + "node_modules/is-object": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", - "dev": true + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "is-plain-obj": { + "node_modules/is-plain-obj": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", - "dev": true - }, - "is-regex": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", - "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "has-symbols": "^1.0.1" + "engines": { + "node": ">=0.10.0" } }, - "is-retry-allowed": { + "node_modules/is-retry-allowed": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-string": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.5.tgz", - "integrity": "sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ==", - "dev": true - }, - "is-symbol": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.3.tgz", - "integrity": "sha512-OwijhaRSgqvhm/0ZdAcXNZt9lYdKFpcRDT5ULUuYXPoT794UNOdU+gpT6Rzo7b4V2HUl/op6GqY894AZwv9faQ==", "dev": true, - "requires": { - "has-symbols": "^1.0.1" + "engines": { + "node": ">=0.10.0" } }, - "is-typed-array": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.5.tgz", - "integrity": "sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug==", + "node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", "dev": true, - "requires": { - "available-typed-arrays": "^1.0.2", - "call-bind": "^1.0.2", - "es-abstract": "^1.18.0-next.2", - "foreach": "^2.0.5", - "has-symbols": "^1.0.1" + "engines": { + "node": ">=0.10.0" } }, - "is-wsl": { + "node_modules/is-wsl": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz", "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==", "dev": true, - "requires": { + "dependencies": { "is-docker": "^2.0.0" + }, + "engines": { + "node": ">=8" } }, - "isarray": { + "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true }, - "isbinaryfile": { - "version": "4.0.6", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.6.tgz", - "integrity": "sha512-ORrEy+SNVqUhrCaal4hA4fBzhggQQ+BaLntyPOdoEiwlKZW9BZiJXjg3RMiruE4tPEI3pyVPpySHQF/dKWperg==", - "dev": true + "node_modules/isbinaryfile": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", + "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", + "dev": true, + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } }, - "isexe": { + "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "istanbul": { + "node_modules/istanbul": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", - "integrity": "sha1-ZcfXPUxNqE1POsMQuRj7C4Azczs=", + "integrity": "sha512-nMtdn4hvK0HjUlzr1DrKSUY8ychprt8dzHOgY2KXsIhHu5PuQQEOTM27gV9Xblyon7aUH/TSFIjRHEODF/FRPg==", + "deprecated": "This module is no longer maintained, try this instead:\n npm i nyc\nVisit https://istanbul.js.org/integrations for other alternatives.", "dev": true, - "requires": { + "dependencies": { "abbrev": "1.0.x", "async": "1.x", "escodegen": "1.8.x", @@ -3317,614 +3830,580 @@ "which": "^1.1.1", "wordwrap": "^1.0.0" }, + "bin": { + "istanbul": "lib/cli.js" + } + }, + "node_modules/istanbul/node_modules/glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha512-c9IPMazfRITpmAAKi22dK1VKxGDX9ehhqfABDriL/lzO92xcUKEJPQHrVA/2YHSNFB4iFlykVmWvwo48nr3OxA==", + "dev": true, "dependencies": { - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", - "dev": true, - "requires": { - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "2 || 3", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "resolve": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", - "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", - "dev": true - } + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" } }, - "isurl": { + "node_modules/istanbul/node_modules/resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha512-9znBF0vBcaSN3W2j7wKvdERPwqTxSpCq+if5C0WoTCyV9n24rua28jeuQ2pL/HOf+yUe/Mef+H/5p60K0Id3bg==", + "dev": true + }, + "node_modules/isurl": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", "dev": true, - "requires": { + "dependencies": { "has-to-string-tag-x": "^1.2.0", "is-object": "^1.0.1" + }, + "engines": { + "node": ">= 4" } }, - "js-yaml": { + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, - "requires": { + "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", + "node_modules/js-yaml/node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, - "json-stringify-safe": { + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==", "dev": true }, - "jsonfile": { + "node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", "dev": true, - "requires": { + "optionalDependencies": { "graceful-fs": "^4.1.6" } }, - "jsonparse": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", - "dev": true - }, - "karma": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/karma/-/karma-6.1.1.tgz", - "integrity": "sha512-vVDFxFGAsclgmFjZA/qGw5xqWdZIWxVD7xLyCukYUYd5xs/uGzYbXGOT5zOruVBQleKEmXIr4H2hzGCTn+M9Cg==", + "node_modules/karma": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/karma/-/karma-6.4.1.tgz", + "integrity": "sha512-Cj57NKOskK7wtFWSlMvZf459iX+kpYIPXmkNUzP2WAFcA7nhr/ALn5R7sw3w+1udFDcpMx/tuB8d5amgm3ijaA==", "dev": true, - "requires": { + "dependencies": { + "@colors/colors": "1.5.0", "body-parser": "^1.19.0", "braces": "^3.0.2", - "chokidar": "^3.4.2", - "colors": "^1.4.0", + "chokidar": "^3.5.1", "connect": "^3.7.0", "di": "^0.0.1", "dom-serialize": "^2.2.1", - "glob": "^7.1.6", - "graceful-fs": "^4.2.4", + "glob": "^7.1.7", + "graceful-fs": "^4.2.6", "http-proxy": "^1.18.1", - "isbinaryfile": "^4.0.6", - "lodash": "^4.17.19", - "log4js": "^6.2.1", - "mime": "^2.4.5", + "isbinaryfile": "^4.0.8", + "lodash": "^4.17.21", + "log4js": "^6.4.1", + "mime": "^2.5.2", "minimatch": "^3.0.4", + "mkdirp": "^0.5.5", "qjobs": "^1.2.0", "range-parser": "^1.2.1", "rimraf": "^3.0.2", - "socket.io": "^3.1.0", + "socket.io": "^4.4.1", "source-map": "^0.6.1", - "tmp": "0.2.1", - "ua-parser-js": "^0.7.23", + "tmp": "^0.2.1", + "ua-parser-js": "^0.7.30", "yargs": "^16.1.1" }, - "dependencies": { - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" - } - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.6", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", - "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==", - "dev": true - } + "bin": { + "karma": "bin/karma" + }, + "engines": { + "node": ">= 10" } }, - "karma-chrome-launcher": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.0.tgz", - "integrity": "sha512-3dPs/n7vgz1rxxtynpzZTvb9y/GIaW8xjAwcIGttLbycqoFtI7yo1NGnQi6oFTherRE+GIhCAHZC4vEqWGhNvg==", + "node_modules/karma-chrome-launcher": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/karma-chrome-launcher/-/karma-chrome-launcher-3.1.1.tgz", + "integrity": "sha512-hsIglcq1vtboGPAN+DGCISCFOxW+ZVnIqhDQcCMqqCp+4dmJ0Qpq5QAjkbA0X2L9Mi6OBkHi2Srrbmm7pUKkzQ==", "dev": true, - "requires": { + "dependencies": { "which": "^1.2.1" } }, - "karma-firefox-launcher": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.0.tgz", - "integrity": "sha512-dkiyqN2R6fCWt78rciOXJLFDWcQ7QEQi++HgebPJlw1y0ycDjGNDHuSrhdh48QG02fzZKK20WHFWVyBZ6CPngg==", + "node_modules/karma-firefox-launcher": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-2.1.2.tgz", + "integrity": "sha512-VV9xDQU1QIboTrjtGVD4NCfzIH7n01ZXqy/qpBhnOeGVOkG5JYPEm8kuSd7psHE6WouZaQ9Ool92g8LFweSNMA==", "dev": true, - "requires": { + "dependencies": { "is-wsl": "^2.2.0", "which": "^2.0.1" - }, + } + }, + "node_modules/karma-firefox-launcher/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, "dependencies": { - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "karma-mocha": { + "node_modules/karma-mocha": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/karma-mocha/-/karma-mocha-2.0.1.tgz", "integrity": "sha512-Tzd5HBjm8his2OA4bouAsATYEpZrp9vC7z5E5j4C5Of5Rrs1jY67RAwXNcVmd/Bnk1wgvQRou0zGVLey44G4tQ==", "dev": true, - "requires": { + "dependencies": { "minimist": "^1.2.3" } }, - "karma-sauce-launcher": { - "version": "4.3.5", - "resolved": "https://registry.npmjs.org/karma-sauce-launcher/-/karma-sauce-launcher-4.3.5.tgz", - "integrity": "sha512-a6c8qbuLspMi2KNGQefXe/lhZAd2JSkxheT6kBb3GKwWfyZyjG+eF3C7lFennWHZyzeXHv7pY5LMpi/mHGCzag==", + "node_modules/karma-sauce-launcher": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/karma-sauce-launcher/-/karma-sauce-launcher-4.3.6.tgz", + "integrity": "sha512-Ej62q4mUPFktyAm8g0g8J5qhwEkXwdHrwtiV4pZjKNHNnSs+4qgDyzs3VkpOy3AmNTsTqQXUN/lpiy0tZpDJZQ==", "dev": true, - "requires": { + "dependencies": { "global-agent": "^2.1.12", "saucelabs": "^4.6.3", "webdriverio": "^6.7.0" + }, + "engines": { + "node": ">= 10.0.0" } }, - "keyv": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", - "integrity": "sha512-eguHnq22OE3uVoSYG0LVWNP+4ppamWr9+zWBe1bsNcovIMy6huUJFPgy4mGwCd/rnl3vOLGW1MTlu4c57CT1xA==", + "node_modules/karma/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true, - "requires": { - "json-buffer": "3.0.0" + "engines": { + "node": ">=0.10.0" } }, - "labeled-stream-splicer": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.2.tgz", - "integrity": "sha512-Ca4LSXFFZUjPScRaqOcFxneA0VpKZr4MMYCljyQr4LIewTLb3Y0IUTIsnBBsVubIeEfxeSZpSjSsRM8APEQaAw==", + "node_modules/keyv": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz", + "integrity": "sha512-5MHbFaKn8cNSmVW7BYnijeAVlE4cYA/SVkifVgrh7yotnfhKmjuXpDKjrABLnT0SfHWV21P8ow07OGfRrNDg8g==", "dev": true, - "requires": { - "inherits": "^2.0.1", - "stream-splicer": "^2.0.0" + "dependencies": { + "json-buffer": "3.0.1" } }, - "lazystream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.0.tgz", - "integrity": "sha1-9plf4PggOS9hOWvolGJAe7dxaOQ=", + "node_modules/lazystream": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lazystream/-/lazystream-1.0.1.tgz", + "integrity": "sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==", "dev": true, - "requires": { + "dependencies": { "readable-stream": "^2.0.5" + }, + "engines": { + "node": ">= 0.6.3" } }, - "levn": { + "node_modules/levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", "dev": true, - "requires": { + "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" } }, - "lighthouse-logger": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.2.0.tgz", - "integrity": "sha512-wzUvdIeJZhRsG6gpZfmSCfysaxNEr43i+QT+Hie94wvHDKFLi4n7C2GqZ4sTC+PH5b5iktmXJvU87rWvhP3lHw==", + "node_modules/lighthouse-logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-1.3.0.tgz", + "integrity": "sha512-BbqAKApLb9ywUli+0a+PcV04SyJ/N1q/8qgCNe6U97KbPCS1BTksEuHFLYdvc8DltuhfxIUBqDZsC0bBGtl3lA==", "dev": true, - "requires": { - "debug": "^2.6.8", - "marky": "^1.2.0" + "dependencies": { + "debug": "^2.6.9", + "marky": "^1.2.2" } }, - "locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, - "requires": { - "p-locate": "^4.1.0" + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "lodash": { - "version": "4.17.20", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", - "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA==", + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "lodash.clonedeep": { + "node_modules/lodash.clonedeep": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", + "integrity": "sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==", "dev": true }, - "lodash.defaults": { + "node_modules/lodash.defaults": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=", + "integrity": "sha512-qjxPLHd3r5DnsdGacqOMU6pb/avJzdh9tFX2ymgoZE27BmjXrNy/y4LoaiTeAb+O3gL8AfpJGtqfX/ae2leYYQ==", "dev": true }, - "lodash.difference": { + "node_modules/lodash.difference": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/lodash.difference/-/lodash.difference-4.5.0.tgz", - "integrity": "sha1-nMtOUF1Ia5FlE0V3KIWi3yf9AXw=", + "integrity": "sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==", "dev": true }, - "lodash.flatten": { + "node_modules/lodash.flatten": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", - "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "integrity": "sha512-C5N2Z3DgnnKr0LOpv/hKCgKdb7ZZwafIrsesve6lmzvZIRZRGaZ/l6Q8+2W7NaT+ZwO3fFlSCzCzrDCFdJfZ4g==", "dev": true }, - "lodash.isobject": { + "node_modules/lodash.isobject": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/lodash.isobject/-/lodash.isobject-3.0.2.tgz", - "integrity": "sha1-PI+41bW/S/kK4G4U8qUwpO2TXh0=", + "integrity": "sha512-3/Qptq2vr7WeJbB4KHUSKlq8Pl7ASXi3UG6CMbBm8WRtXi8+GHm7mKaU3urfpSEzWe2wCIChs6/sdocUsTKJiA==", "dev": true }, - "lodash.isplainobject": { + "node_modules/lodash.isplainobject": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", - "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", - "dev": true - }, - "lodash.memoize": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", - "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", "dev": true }, - "lodash.merge": { + "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", "dev": true }, - "lodash.union": { + "node_modules/lodash.union": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/lodash.union/-/lodash.union-4.6.0.tgz", - "integrity": "sha1-SLtQiECfFvGCFmZkHETdGqrjzYg=", + "integrity": "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw==", "dev": true }, - "lodash.zip": { + "node_modules/lodash.zip": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.zip/-/lodash.zip-4.2.0.tgz", - "integrity": "sha1-7GZi5IlkCO1KtsVCo5kLcswIACA=", + "integrity": "sha512-C7IOaBBK/0gMORRBd8OETNx3kmOkgIWIPvyDpZSCTwUrpYmgZwJkjZeOD8ww4xbOUOs4/attY+pciKvadNfFbg==", "dev": true }, - "log-symbols": { + "node_modules/log-symbols": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.0.0.tgz", "integrity": "sha512-FN8JBzLx6CzeMrB0tg6pqlGU1wCrXW+ZXGH481kfsBqer0hToTIiHdjH4Mq8xJUbvATujKCvaREGWpGUionraA==", "dev": true, - "requires": { + "dependencies": { "chalk": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/log4js": { + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.1.tgz", + "integrity": "sha512-lzbd0Eq1HRdWM2abSD7mk6YIVY0AogGJzb/z+lqzRk+8+XJP+M6L1MS5FUSc3jjGru4dbKjEMJmqlsoYYpuivQ==", + "dev": true, + "dependencies": { + "date-format": "^4.0.14", + "debug": "^4.3.4", + "flatted": "^3.2.7", + "rfdc": "^1.3.0", + "streamroller": "^3.1.3" + }, + "engines": { + "node": ">=8.0" } }, - "log4js": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/log4js/-/log4js-6.3.0.tgz", - "integrity": "sha512-Mc8jNuSFImQUIateBFwdOQcmC6Q5maU0VVvdC2R6XMb66/VnT+7WS4D/0EeNMZu1YODmJe5NIn2XftCzEocUgw==", + "node_modules/log4js/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, - "requires": { - "date-format": "^3.0.0", - "debug": "^4.1.1", - "flatted": "^2.0.1", - "rfdc": "^1.1.4", - "streamroller": "^2.2.4" - }, "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "loglevel": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.7.1.tgz", - "integrity": "sha512-Hesni4s5UkWkwCGJMQGAh71PaLUmKFM60dHvq0zi/vDhhrzuk+4GgNbTXJ12YYQJn6ZKBDNIjYcuQGKudvqrIw==", + "node_modules/log4js/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "loglevel-plugin-prefix": { + "node_modules/loglevel": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/loglevel/-/loglevel-1.8.1.tgz", + "integrity": "sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg==", + "dev": true, + "engines": { + "node": ">= 0.6.0" + }, + "funding": { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/loglevel" + } + }, + "node_modules/loglevel-plugin-prefix": { "version": "0.8.4", "resolved": "https://registry.npmjs.org/loglevel-plugin-prefix/-/loglevel-plugin-prefix-0.8.4.tgz", "integrity": "sha512-WpG9CcFAOjz/FtNht+QJeGpvVl/cdR6P0z6OcXSkr8wFJOsV2GRj2j10JLfjuA4aYkcKCNIEqRGCyTife9R8/g==", "dev": true }, - "loupe": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.0.tgz", - "integrity": "sha512-b6TVXtF01VErh8IxN/MfdiWLQmttrenN98PPGS01kym8kGycJ9tqBXD6D+4sNEDhgE83+H0Mk1cVSl0mD1nNSg==", - "requires": { - "get-func-name": "^2.0.0", - "type-detect": "^4.0.8" + "node_modules/loupe": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.6.tgz", + "integrity": "sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA==", + "dependencies": { + "get-func-name": "^2.0.0" } }, - "lower-case": { + "node_modules/lower-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/lower-case/-/lower-case-2.0.2.tgz", "integrity": "sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==", "dev": true, - "requires": { + "dependencies": { "tslib": "^2.0.3" } }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", - "dev": true + "node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", "dev": true, - "requires": { - "yallist": "^4.0.0" + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" } }, - "make-dir": { + "node_modules/make-dir": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", "dev": true, - "requires": { + "dependencies": { "pify": "^3.0.0" }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } + "engines": { + "node": ">=4" } }, - "marky": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.1.tgz", - "integrity": "sha512-md9k+Gxa3qLH6sUKpeC2CNkJK/Ld+bEz5X96nYwloqphQE0CKCVEKco/6jxEZixinqNdz5RFi/KaCyfbMDMAXQ==", + "node_modules/make-dir/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/marky": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/marky/-/marky-1.2.5.tgz", + "integrity": "sha512-q9JtQJKjpsVxCRVgQ+WapguSbKC3SQ5HEzFGPAJMStgh3QjCawp00UKv3MTTAArTmGmmPUvllHZoNbZ3gs0I+Q==", "dev": true }, - "matcher": { + "node_modules/matcher": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", "dev": true, - "requires": { + "dependencies": { "escape-string-regexp": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "media-typer": { + "node_modules/media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", - "dev": true + "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==", + "dev": true, + "engines": { + "node": ">= 0.6" + } }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "node_modules/mime": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz", + "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==", "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" + "bin": { + "mime": "cli.js" }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } + "engines": { + "node": ">=4.0.0" } }, - "mime": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", - "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", - "dev": true - }, - "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", - "dev": true + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } }, - "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", "dev": true, - "requires": { - "mime-db": "1.46.0" + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" } }, - "mimic-response": { + "node_modules/mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "minimalistic-assert": { + "node_modules/minimalistic-assert": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", "dev": true }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "requires": { + "dependencies": { "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, - "requires": { - "minimist": "^1.2.5" + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" } }, - "mkdirp-classic": { + "node_modules/mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", "dev": true }, - "mocha": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.3.0.tgz", - "integrity": "sha512-TQqyC89V1J/Vxx0DhJIXlq9gbbL9XFNdeLQ1+JsnZsVaSOV1z3tWfw0qZmQJGQRIfkvZcs7snQnZnOCKoldq1Q==", + "node_modules/mocha": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-8.4.0.tgz", + "integrity": "sha512-hJaO0mwDXmZS4ghXsvPVriOhsxQ7ofcpQdm8dE+jISUOKopitvnXFQmpRR7jd2K6VBG6E26gU3IAbXXGIbu4sQ==", "dev": true, - "requires": { + "dependencies": { "@ungap/promise-all-settled": "1.1.2", "ansi-colors": "4.1.1", "browser-stdout": "1.3.1", @@ -3951,674 +4430,787 @@ "yargs-parser": "20.2.4", "yargs-unparser": "2.0.0" }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 10.12.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/mocha/node_modules/chokidar": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.1.tgz", + "integrity": "sha512-9+s+Od+W0VJJzawDma/gvBNQqkTiqYTWLuZoyAsivsI4AaWTCzHG06/TMjsf1cYe9Cb97UCEhjz7HvnPk2p/tw==", + "dev": true, "dependencies": { - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "glob": { - "version": "7.1.6", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", - "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "js-yaml": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", - "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, + "anymatch": "~3.1.1", + "braces": "~3.0.2", + "glob-parent": "~5.1.0", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.5.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.1" + } + }, + "node_modules/mocha/node_modules/debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true + "optional": true } } }, - "module-deps": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-6.2.3.tgz", - "integrity": "sha512-fg7OZaQBcL4/L+AK5f4iVqf9OMbCclXfy/znXRxTVhJSeW5AIlS9AwheYwDaXM3lVW7OBeaeUEY3gbaC6cLlSA==", + "node_modules/mocha/node_modules/debug/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", "dev": true, - "requires": { - "JSONStream": "^1.0.3", - "browser-resolve": "^2.0.0", - "cached-path-relative": "^1.0.2", - "concat-stream": "~1.6.0", - "defined": "^1.0.0", - "detective": "^5.2.0", - "duplexer2": "^0.1.2", - "inherits": "^2.0.1", - "parents": "^1.0.0", - "readable-stream": "^2.0.2", - "resolve": "^1.4.0", - "stream-combiner2": "^1.1.1", - "subarg": "^1.0.0", - "through2": "^2.0.0", - "xtend": "^4.0.0" + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/js-yaml": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.0.0.tgz", + "integrity": "sha512-pqon0s+4ScYUvX30wxQi3PogGFAlUyH0awepWvwkj4jD4v+ova3RiYw8bmA6x2rDrEaj8i/oWKoRxpVNW+Re8Q==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/mocha/node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/readdirp": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "ms": { + "node_modules/ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, - "nanoid": { + "node_modules/nanoid": { "version": "3.1.20", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.20.tgz", "integrity": "sha512-a1cQNyczgKbLX9jwbS/+d7W8fX/RfgYR7lVWwWOGIPNgK2m0MWvrGF6/m4kk6U3QcFMnZf3RIhL0v2Jgh/0Uxw==", - "dev": true + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/negotiator": { + "version": "0.6.3", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", + "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } }, - "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", + "node_modules/neo-async": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", + "integrity": "sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==", "dev": true }, - "nice-try": { + "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "no-case": { + "node_modules/no-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/no-case/-/no-case-3.0.4.tgz", "integrity": "sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==", "dev": true, - "requires": { + "dependencies": { "lower-case": "^2.0.2", "tslib": "^2.0.3" } }, - "node-fetch": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", - "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==", - "dev": true + "node_modules/node-fetch": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.8.tgz", + "integrity": "sha512-RZ6dBYuj8dRSfxpUSu+NsdF1dpPpluJxwOp+6IoDp/sH2QNDSvurYsAa+F1WxY2RjA1iP93xhcsUoYbF2XBqVg==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } }, - "nopt": { + "node_modules/nopt": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz", - "integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=", + "integrity": "sha512-4GUt3kSEYmk4ITxzB/b9vaIDfUVWN/Ml1Fwl11IlnIG2iaJ9O6WXZ9SrYM9NLI8OCBieN2Y8SWC2oJV0RQ7qYg==", "dev": true, - "requires": { + "dependencies": { "abbrev": "1" + }, + "bin": { + "nopt": "bin/nopt.js" } }, - "normalize-path": { + "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "normalize-url": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-2.0.1.tgz", - "integrity": "sha512-D6MUW4K/VzoJ4rJ01JFKxDrtY1v9wrgzCX5f2qj/lzH1m/lW6MhUZFKerVsnyjOhOsYzI9Kqqak+10l4LvLpMw==", + "node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", "dev": true, - "requires": { - "prepend-http": "^2.0.0", - "query-string": "^5.0.1", - "sort-keys": "^2.0.0" + "engines": { + "node": ">=10" }, - "dependencies": { - "sort-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-2.0.0.tgz", - "integrity": "sha1-ZYU1WEhh7JfXMNbPQYIuH1ZoQSg=", - "dev": true, - "requires": { - "is-plain-obj": "^1.0.0" - } - } + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "npm-conf": { + "node_modules/npm-conf": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/npm-conf/-/npm-conf-1.1.3.tgz", "integrity": "sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw==", "dev": true, - "requires": { + "dependencies": { "config-chain": "^1.1.11", "pify": "^3.0.0" }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - } + "engines": { + "node": ">=4" + } + }, + "node_modules/npm-conf/node_modules/pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==", + "dev": true, + "engines": { + "node": ">=4" } }, - "npm-run-path": { + "node_modules/npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "integrity": "sha512-lJxZYlT4DW/bRUtFh1MQIWqmLwQfAxnqWG4HhEdjMlkrJYnJn0Jrr2u3mgxqaWsdiBc76TYkTG/mhrnYTuzfHw==", "dev": true, - "requires": { + "dependencies": { "path-key": "^2.0.0" + }, + "engines": { + "node": ">=4" } }, - "object-assign": { + "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "object-inspect": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", - "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", - "dev": true + "node_modules/object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "object-keys": { + "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true - }, - "object.assign": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", - "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "dev": true, - "requires": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "has-symbols": "^1.0.1", - "object-keys": "^1.1.1" + "engines": { + "node": ">= 0.4" } }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", "dev": true, - "requires": { + "dependencies": { "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" } }, - "once": { + "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, - "requires": { + "dependencies": { "wrappy": "1" } }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "node_modules/optionator": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", + "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - }, "dependencies": { - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - }, - "wordwrap": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", - "dev": true - } - } - }, - "optionator": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", - "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", - "dev": true, - "requires": { "deep-is": "~0.1.3", - "fast-levenshtein": "~2.0.4", + "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", - "wordwrap": "~1.0.0" + "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" } }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "os-filter-obj": { + "node_modules/os-filter-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz", "integrity": "sha512-uksVLsqG3pVdzzPvmAHpBK0wKxYItuzZr7SziusRPoz67tGV8rL1szZ6IdeUrbqLjGDwApBtN29eEE3IqGHOjg==", "dev": true, - "requires": { + "dependencies": { "arch": "^2.1.0" + }, + "engines": { + "node": ">=4" } }, - "p-cancelable": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.4.1.tgz", - "integrity": "sha512-HNa1A8LvB1kie7cERyy21VNeHb2CWJJYqyyC2o3klWFfMGlFmWv2Z7sFgZH8ZiaYL95ydToKTFVXgMV/Os0bBQ==", - "dev": true + "node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true, + "engines": { + "node": ">=8" + } }, - "p-event": { + "node_modules/p-event": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/p-event/-/p-event-2.3.1.tgz", "integrity": "sha512-NQCqOFhbpVTMX4qMe8PF8lbGtzZ+LCiN7pcNrb/413Na7+TRoe1xkKUzuWa/YEJdGQ0FvKtj35EEbDoVPO2kbA==", "dev": true, - "requires": { + "dependencies": { "p-timeout": "^2.0.1" + }, + "engines": { + "node": ">=6" } }, - "p-finally": { + "node_modules/p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true + "integrity": "sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "p-is-promise": { + "node_modules/p-is-promise": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-is-promise/-/p-is-promise-1.1.0.tgz", - "integrity": "sha1-nJRWmJ6fZYgBewQ01WCXZ1w9oF4=", - "dev": true + "integrity": "sha512-zL7VE4JVS2IFSkR2GQKDSPEVxkoH43/p7oEnwpdCndKYJO0HVeRB7fA8TJwuLOTBREtK0ea8eHaxdwcpob5dmg==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, - "requires": { - "p-try": "^2.0.0" + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, - "requires": { - "p-limit": "^2.2.0" + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "p-timeout": { + "node_modules/p-timeout": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", "dev": true, - "requires": { + "dependencies": { "p-finally": "^1.0.0" + }, + "engines": { + "node": ">=4" } }, - "p-try": { + "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true - }, - "pako": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", - "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "param-case": { + "node_modules/param-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/param-case/-/param-case-3.0.4.tgz", "integrity": "sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==", "dev": true, - "requires": { + "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" } }, - "parents": { + "node_modules/parent-module": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", - "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, - "requires": { - "path-platform": "~0.11.15" + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "parse-asn1": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.6.tgz", - "integrity": "sha512-RnZRo1EPU6JBnra2vGHj0yhp6ebyjBZpmUCLHWiFhxlzvBCCpAuZ7elsBp1PVAbQN0/04VD/19rfzlBSwLstMw==", - "dev": true, - "requires": { - "asn1.js": "^5.2.0", - "browserify-aes": "^1.0.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "parseurl": { + "node_modules/parseurl": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.8" + } }, - "pascal-case": { + "node_modules/pascal-case": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pascal-case/-/pascal-case-3.1.2.tgz", "integrity": "sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==", "dev": true, - "requires": { + "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3" } }, - "path-browserify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true - }, - "path-case": { + "node_modules/path-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/path-case/-/path-case-3.0.4.tgz", "integrity": "sha512-qO4qCFjXqVTrcbPt/hQfhTQ+VhFsqNKOPtytgNKkKxSoEp3XPUQ8ObFuePylOIok5gjn69ry8XiULxCwot3Wfg==", "dev": true, - "requires": { + "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" } }, - "path-exists": { + "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "path-is-absolute": { + "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "path-key": { + "node_modules/path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", - "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", - "dev": true + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "path-platform": { - "version": "0.11.15", - "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", - "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", - "dev": true + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } }, - "pathval": { + "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==" - }, - "pbkdf2": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.1.tgz", - "integrity": "sha512-4Ejy1OPxi9f2tt1rRV7Go7zmfDQ+ZectEQz3VGUQhgq62HtIRPDyG/JtnwIxs6x3uNMwo2V7q1fMvKjb+Tnpqg==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "engines": { + "node": "*" } }, - "pend": { + "node_modules/pend": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", "dev": true }, - "picomatch": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.2.tgz", - "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", - "dev": true + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } }, - "pify": { + "node_modules/pify": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "pinkie": { + "node_modules/pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", - "dev": true + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "pinkie-promise": { + "node_modules/pinkie-promise": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", "dev": true, - "requires": { + "dependencies": { "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "pkg-dir": { + "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, - "requires": { + "dependencies": { "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" } }, - "prelude-ls": { + "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", - "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", - "dev": true + "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } }, - "prepend-http": { + "node_modules/prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", - "dev": true - }, - "printj": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/printj/-/printj-1.1.2.tgz", - "integrity": "sha512-zA2SmoLaxZyArQTOPj5LXecR+RagfPSU5Kw1qP+jkWeNlrq+eJZyY2oS68SU1Z/7/myXM4lo9716laOFAVStCQ==", - "dev": true - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true + "integrity": "sha512-ravE6m9Atw9Z/jjttRUZ+clIXogdghyZAuWJ3qEzjT+jI/dL1ifAqhZeC5VHzQp1MSt1+jxKkFNemj/iO7tVUA==", + "dev": true, + "engines": { + "node": ">=4" + } }, - "process-nextick-args": { + "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "dev": true }, - "progress": { + "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.4.0" + } }, - "proto-list": { + "node_modules/proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", + "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", "dev": true }, - "proxy-from-env": { + "node_modules/proxy-from-env": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", "dev": true }, - "pseudomap": { + "node_modules/pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==", "dev": true }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", - "dev": true - } - } - }, - "pump": { + "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "dev": true, - "requires": { + "dependencies": { "end-of-stream": "^1.1.0", "once": "^1.3.1" } }, - "punycode": { + "node_modules/punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "integrity": "sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ==", "dev": true }, - "puppeteer-core": { + "node_modules/puppeteer": { + "version": "19.5.2", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-19.5.2.tgz", + "integrity": "sha512-xlqRyrhXhVH114l79Y0XqYXUVG+Yfw4sKlvN55t8Y9DxtA5fzI1uqF8SVXbWK5DUMbD6Jo4lpixTZCTTZGD05g==", + "dev": true, + "hasInstallScript": true, + "dependencies": { + "cosmiconfig": "8.0.0", + "https-proxy-agent": "5.0.1", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "puppeteer-core": "19.5.2" + }, + "engines": { + "node": ">=14.1.0" + } + }, + "node_modules/puppeteer-core": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-5.5.0.tgz", "integrity": "sha512-tlA+1n+ziW/Db03hVV+bAecDKse8ihFRXYiEypBe9IlLRvOCzYFG6qrCMBYK34HO/Q/Ecjc+tvkHRAfLVH+NgQ==", "dev": true, - "requires": { + "dependencies": { "debug": "^4.1.0", "devtools-protocol": "0.0.818844", "extract-zip": "^2.0.0", @@ -4632,111 +5224,236 @@ "unbzip2-stream": "^1.3.3", "ws": "^7.2.3" }, + "engines": { + "node": ">=10.18.1" + } + }, + "node_modules/puppeteer-core/node_modules/agent-base": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-5.1.1.tgz", + "integrity": "sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g==", + "dev": true, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/puppeteer-core/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer-core/node_modules/https-proxy-agent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz", + "integrity": "sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg==", + "dev": true, + "dependencies": { + "agent-base": "5", + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/puppeteer-core/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/puppeteer-core/node_modules/ws": { + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/puppeteer/node_modules/devtools-protocol": { + "version": "0.0.1068969", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1068969.tgz", + "integrity": "sha512-ATFTrPbY1dKYhPPvpjtwWKSK2mIwGmRwX54UASn9THEuIZCe2n9k3vVuMmt6jWeL+e5QaaguEv/pMyR+JQB7VQ==", + "dev": true + }, + "node_modules/puppeteer/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/puppeteer/node_modules/puppeteer-core": { + "version": "19.5.2", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-19.5.2.tgz", + "integrity": "sha512-Rqk+3kqM+Z2deooTYqcYt8lRtGffJdifWa9td9nbJSjhANWsFouk8kLBNUKycewCCFHM8TZUKS0x28OllavW2A==", + "dev": true, + "dependencies": { + "cross-fetch": "3.1.5", + "debug": "4.3.4", + "devtools-protocol": "0.0.1068969", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.1", + "proxy-from-env": "1.1.0", + "rimraf": "3.0.2", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "ws": "8.11.0" + }, + "engines": { + "node": ">=14.1.0" + } + }, + "node_modules/puppeteer/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "utf-8-validate": { + "optional": true } } }, - "qjobs": { + "node_modules/qjobs": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/qjobs/-/qjobs-1.2.0.tgz", "integrity": "sha512-8YOJEHtxpySA3fFDyCRxA+UUV+fA+rTWnuWvylOK/NCjhY+b4ocCtmu8TtsWb+mYeU+GCHf/S66KZF/AsteKHg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.9" + } + }, + "node_modules/qs": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", + "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "dev": true, + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "query-string": { + "node_modules/query-string": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/query-string/-/query-string-5.1.1.tgz", "integrity": "sha512-gjWOsm2SoGlgLEdAGt7a6slVOk9mGiXmPFMqrEhLQ68rhQuBnpfs3+EmlvqKyxnCo9/PPlF+9MtY02S1aFg+Jw==", "dev": true, - "requires": { + "dependencies": { "decode-uri-component": "^0.2.0", "object-assign": "^4.1.0", "strict-uri-encode": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "quick-lru": { + "node_modules/quick-lru": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "randombytes": { + "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", + "dependencies": { "safe-buffer": "^5.1.0" } }, - "range-parser": { + "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", - "dev": true - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", "dev": true, - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" + "engines": { + "node": ">= 0.6" } }, - "read-only-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", - "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", + "node_modules/raw-body": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.1.tgz", + "integrity": "sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig==", "dev": true, - "requires": { - "readable-stream": "^2.0.2" + "dependencies": { + "bytes": "3.1.2", + "http-errors": "2.0.0", + "iconv-lite": "0.4.24", + "unpipe": "1.0.0" + }, + "engines": { + "node": ">= 0.8" } }, - "readable-stream": { + "node_modules/readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", "dev": true, - "requires": { + "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", "isarray": "~1.0.0", @@ -4744,126 +5461,149 @@ "safe-buffer": "~5.1.1", "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" - }, + } + }, + "node_modules/readable-stream/node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/readable-stream/node_modules/string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.0" + } + }, + "node_modules/readdir-glob": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.2.tgz", + "integrity": "sha512-6RLVvwJtVwEDfPdn6X6Ille4/lxGl0ATOY4FN/B9nxQcgOazvvI0nodiD19ScKq0PvA/29VpaOQML36o5IzZWA==", + "dev": true, + "dependencies": { + "minimatch": "^5.1.0" + } + }, + "node_modules/readdir-glob/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } - } + "balanced-match": "^1.0.0" } }, - "readdir-glob": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/readdir-glob/-/readdir-glob-1.1.1.tgz", - "integrity": "sha512-91/k1EzZwDx6HbERR+zucygRFfiPl2zkIYZtv3Jjr6Mn7SkKcVct8aVO+sSRiGMc6fLf72du3d92/uY63YPdEA==", + "node_modules/readdir-glob/node_modules/minimatch": { + "version": "5.1.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", + "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", "dev": true, - "requires": { - "minimatch": "^3.0.4" + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" } }, - "readdirp": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", - "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", "dev": true, - "requires": { + "dependencies": { "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" } }, - "require-directory": { + "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "requires-port": { + "node_modules/requires-port": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==", + "dev": true + }, + "node_modules/resolve-alpn": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.2.1.tgz", + "integrity": "sha512-0a1F4l73/ZFZOakJnQ3FvkJ2+gSTQWz/r2KE5OdDY0TxPm5h4GkqkWWfM47T7HsbnOtcJVEF4epCVy6u7Q3K+g==", "dev": true }, - "resolve": { - "version": "1.20.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", - "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true, - "requires": { - "is-core-module": "^2.2.0", - "path-parse": "^1.0.6" + "engines": { + "node": ">=4" } }, - "resolve-alpn": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-alpn/-/resolve-alpn-1.0.0.tgz", - "integrity": "sha512-rTuiIEqFmGxne4IovivKSDzld2lWW9QCjqv80SYjPgf+gS35eaCAjaP54CCwGAwBtnCsvNLYtqxe1Nw+i6JEmA==", - "dev": true - }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", + "node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", "dev": true, - "requires": { - "lowercase-keys": "^1.0.0" + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "resq": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/resq/-/resq-1.10.0.tgz", - "integrity": "sha512-hCUd0xMalqtPDz4jXIqs0M5Wnv/LZXN8h7unFOo4/nvExT9dDPbhwd3udRxLlp0HgBnHcV009UlduE9NZi7A6w==", + "node_modules/resq": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/resq/-/resq-1.11.0.tgz", + "integrity": "sha512-G10EBz+zAAy3zUd/CDoBbXRL6ia9kOo3xRHrMDsHljI0GDkhYlyjwoCx5+3eCC4swi1uCoZQhskuJkj7Gp57Bw==", "dev": true, - "requires": { + "dependencies": { "fast-deep-equal": "^2.0.1" } }, - "rfdc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.2.0.tgz", - "integrity": "sha512-ijLyszTMmUrXvjSooucVQwimGUk84eRcmCuLV8Xghe3UO85mjUtRAHRyoMM6XtyqbECaXuBWx18La3523sXINA==", + "node_modules/rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", "dev": true }, - "rgb2hex": { + "node_modules/rgb2hex": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/rgb2hex/-/rgb2hex-0.2.3.tgz", "integrity": "sha512-clEe0m1xv+Tva1B/TOepuIcvLAxP0U+sCDfgt1SX1HmI2Ahr5/Cd/nzJM1e78NKVtWdoo0s33YehpFA8UfIShQ==", "dev": true }, - "rimraf": { + "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", "dev": true, - "requires": { + "dependencies": { "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "roarr": { + "node_modules/roarr": { "version": "2.15.4", "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", "dev": true, - "requires": { + "dependencies": { "boolean": "^3.0.1", "detect-node": "^2.0.4", "globalthis": "^1.0.1", @@ -4871,33 +5611,48 @@ "semver-compare": "^1.0.0", "sprintf-js": "^1.1.2" }, - "dependencies": { - "sprintf-js": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", - "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", - "dev": true - } + "engines": { + "node": ">=8.0" } }, - "safe-buffer": { + "node_modules/roarr/node_modules/sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + }, + "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "safer-buffer": { + "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "saucelabs": { - "version": "4.6.6", - "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-4.6.6.tgz", - "integrity": "sha512-sTVjbdO4OWGy5s611DzWYYaXZb1oOF1Xkx63gcxiV6TYN2rtwxEmtNn8Y9koKTal5flzMicg4YSJKrhLN+sdAA==", + "node_modules/saucelabs": { + "version": "4.7.8", + "resolved": "https://registry.npmjs.org/saucelabs/-/saucelabs-4.7.8.tgz", + "integrity": "sha512-K2qaRUixc7+8JiAwpTvEsIQVzzUkYwa0mAfs0akGagRlWXUR1JrsmgJRyz28qkwpERW1KDuByn3Ju96BuW1V7Q==", "dev": true, - "requires": { + "dependencies": { "bin-wrapper": "^4.1.0", "change-case": "^4.1.1", "form-data": "^3.0.0", @@ -4905,575 +5660,544 @@ "hash.js": "^1.1.7", "tunnel": "0.0.6", "yargs": "^16.0.3" + }, + "bin": { + "sl": "bin/sl" } }, - "seek-bzip": { + "node_modules/seek-bzip": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.6.tgz", "integrity": "sha512-e1QtP3YL5tWww8uKaOCQ18UxIT2laNBXHjV/S2WYCiK4udiv8lkG89KRIoCjUagnAmCBurjF4zEVX2ByBbnCjQ==", "dev": true, - "requires": { + "dependencies": { "commander": "^2.8.1" + }, + "bin": { + "seek-bunzip": "bin/seek-bunzip", + "seek-table": "bin/seek-bzip-table" } }, - "semver": { + "node_modules/semver": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/semver/-/semver-3.0.1.tgz", - "integrity": "sha1-cgrAElFaJS+R+w3S6ZpWpw1s8Hg=", - "dev": true + "integrity": "sha512-MrF9mHWFtD/0eV4t3IheoXnGWTdw17axm5xqzOWyPsOMVnTtRAZT6uwPwslQXH5SsiaBLiMuu8NX8DtXWZfDwg==", + "dev": true, + "bin": { + "semver": "bin/semver" + } }, - "semver-compare": { + "node_modules/semver-compare": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", - "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "integrity": "sha512-YM3/ITh2MJ5MtzaM429anh+x2jiLVjqILF4m4oyQB18W7Ggea7BfqdH/wGMK7dDiMghv/6WG7znWMwUDzJiXow==", "dev": true }, - "semver-regex": { + "node_modules/semver-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "semver-truncate": { + "node_modules/semver-truncate": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/semver-truncate/-/semver-truncate-1.1.2.tgz", - "integrity": "sha1-V/Qd5pcHpicJp+AQS6IRcQnqR+g=", + "integrity": "sha512-V1fGg9i4CL3qesB6U0L6XAm4xOJiHmt4QAacazumuasc03BvtFGIMCduv01JWQ69Nv+JST9TqhSCiJoxoY031w==", "dev": true, - "requires": { + "dependencies": { "semver": "^5.3.0" }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/semver-truncate/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" } }, - "sentence-case": { + "node_modules/sentence-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/sentence-case/-/sentence-case-3.0.4.tgz", "integrity": "sha512-8LS0JInaQMCRoQ7YUytAo/xUu5W2XnQxV2HI/6uM6U7CITS1RqPElr30V6uIqyMKM9lJGRVFy5/4CuzcixNYSg==", "dev": true, - "requires": { + "dependencies": { "no-case": "^3.0.4", "tslib": "^2.0.3", "upper-case-first": "^2.0.2" } }, - "serialize-error": { + "node_modules/serialize-error": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", "dev": true, - "requires": { + "dependencies": { "type-fest": "^0.13.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "serialize-javascript": { + "node_modules/serialize-javascript": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", "dev": true, - "requires": { + "dependencies": { "randombytes": "^2.1.0" } }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==", + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", "dev": true }, - "sha.js": { - "version": "2.4.11", - "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shasum-object": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shasum-object/-/shasum-object-1.0.0.tgz", - "integrity": "sha512-Iqo5rp/3xVi6M4YheapzZhhGPVs0yZwHj7wvwQ1B9z8H6zk+FEnI7y3Teq7qwnekfEhu8WmG2z0z4iWZaxLWVg==", - "dev": true, - "requires": { - "fast-safe-stringify": "^2.0.7" - } - }, - "shebang-command": { + "node_modules/shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", "dev": true, - "requires": { + "dependencies": { "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "shebang-regex": { + "node_modules/shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shell-quote": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.2.tgz", - "integrity": "sha512-mRz/m/JVscCrkMyPqHc/bczi3OQHkLTqXHEFu0zDhK/qfv3UcOA4SVmRCLmos4bhjr9ekVQubj/R7waKapmiQg==", - "dev": true + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "signal-exit": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", - "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", - "dev": true + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "snake-case": { + "node_modules/snake-case": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/snake-case/-/snake-case-3.0.4.tgz", "integrity": "sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg==", "dev": true, - "requires": { + "dependencies": { "dot-case": "^3.0.4", "tslib": "^2.0.3" } }, - "socket.io": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-3.1.2.tgz", - "integrity": "sha512-JubKZnTQ4Z8G4IZWtaAZSiRP3I/inpy8c/Bsx2jrwGrTbKeVU5xd6qkKMHpChYeM3dWZSO0QACiGK+obhBNwYw==", + "node_modules/socket.io": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/socket.io/-/socket.io-4.5.4.tgz", + "integrity": "sha512-m3GC94iK9MfIEeIBfbhJs5BqFibMtkRk8ZpKwG2QwxV0m/eEhPIV4ara6XCF1LWNAus7z58RodiZlAH71U3EhQ==", "dev": true, - "requires": { - "@types/cookie": "^0.4.0", - "@types/cors": "^2.8.8", - "@types/node": ">=10.0.0", + "dependencies": { "accepts": "~1.3.4", "base64id": "~2.0.0", - "debug": "~4.3.1", - "engine.io": "~4.1.0", - "socket.io-adapter": "~2.1.0", - "socket.io-parser": "~4.0.3" + "debug": "~4.3.2", + "engine.io": "~6.2.1", + "socket.io-adapter": "~2.4.0", + "socket.io-parser": "~4.2.1" }, - "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } + "engines": { + "node": ">=10.0.0" } }, - "socket.io-adapter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.1.0.tgz", - "integrity": "sha512-+vDov/aTsLjViYTwS9fPy5pEtTkrbEKsw2M+oVSoFGw6OD1IpvlV1VPhUzNbofCQ8oyMbdYJqDtGdmHQK6TdPg==", + "node_modules/socket.io-adapter": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/socket.io-adapter/-/socket.io-adapter-2.4.0.tgz", + "integrity": "sha512-W4N+o69rkMEGVuk2D/cvca3uYsvGlMwsySWV447y99gUPghxq42BxqLNMndb+a1mm/5/7NeXVQS7RLa2XyXvYg==", "dev": true }, - "socket.io-parser": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.0.4.tgz", - "integrity": "sha512-t+b0SS+IxG7Rxzda2EVvyBZbvFPBCjJoyHuE0P//7OAsN23GItzDRdWa6ALxZI/8R5ygK7jAR6t028/z+7295g==", + "node_modules/socket.io-parser": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-4.2.2.tgz", + "integrity": "sha512-DJtziuKypFkMMHCm2uIshOYC7QaylbtzQwiMYDuCKy3OPkjLzu4B2vAhTlqipRHHzrI0NJeBAizTK7X+6m1jVw==", "dev": true, - "requires": { - "@types/component-emitter": "^1.2.10", - "component-emitter": "~1.3.0", + "dependencies": { + "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1" }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/socket.io-parser/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/socket.io-parser/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/socket.io/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "sort-keys": { + "node_modules/socket.io/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/sort-keys": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", - "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "integrity": "sha512-vzn8aSqKgytVik0iwdBEi+zevbTYZogewTUM6dtpmGwEcdzbub/TX4bCzRhebDCRC3QzXgJsLRKB2V/Oof7HXg==", "dev": true, - "requires": { + "dependencies": { "is-plain-obj": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "sort-keys-length": { + "node_modules/sort-keys-length": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sort-keys-length/-/sort-keys-length-1.0.1.tgz", - "integrity": "sha1-nLb09OnkgVWmqgZx7dM2/xR5oYg=", + "integrity": "sha512-GRbEOUqCxemTAk/b32F2xa8wDTs+Z1QHOkbhJDQTvv/6G3ZkbJ+frYWsTcc7cBB3Fu4wy4XlLCuNtJuMn7Gsvw==", "dev": true, - "requires": { + "dependencies": { "sort-keys": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "sprintf-js": { + "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "statuses": { + "node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", - "dev": true - }, - "stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "dev": true, - "requires": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "stream-combiner2": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", - "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", + "integrity": "sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==", "dev": true, - "requires": { - "duplexer2": "~0.1.0", - "readable-stream": "^2.0.2" + "engines": { + "node": ">= 0.6" } }, - "stream-events": { + "node_modules/stream-events": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", "dev": true, - "requires": { + "dependencies": { "stubs": "^3.0.0" } }, - "stream-http": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-3.1.1.tgz", - "integrity": "sha512-S7OqaYu0EkFpgeGFb/NPOoPLxFko7TPqtEeFg5DXPB4v/KETHG0Ln6fRFrNezoelpaDKmycEmmZ81cC9DAwgYg==", + "node_modules/streamroller": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.4.tgz", + "integrity": "sha512-Ha1Ccw2/N5C/IF8Do6zgNe8F3jQo8MPBnMBGvX0QjNv/I97BcNRzK6/mzOpZHHK7DjMLTI3c7Xw7Y1KvdChkvw==", "dev": true, - "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "xtend": "^4.0.2" - }, "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } - } - }, - "stream-splicer": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.1.tgz", - "integrity": "sha512-Xizh4/NPuYSyAXyT7g8IvdJ9HJpxIGL9PjyhtywCZvvP0OPIdqyrr4dMikeuvY8xahpdKEBlBTySe583totajg==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.2" + "date-format": "^4.0.14", + "debug": "^4.3.4", + "fs-extra": "^8.1.0" + }, + "engines": { + "node": ">=8.0" } }, - "streamroller": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/streamroller/-/streamroller-2.2.4.tgz", - "integrity": "sha512-OG79qm3AujAM9ImoqgWEY1xG4HX+Lw+yY6qZj9R1K2mhF5bEmQ849wvrb+4vt4jLMLzwXttJlQbOdPOQVRv7DQ==", + "node_modules/streamroller/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, - "requires": { - "date-format": "^2.1.0", - "debug": "^4.1.1", - "fs-extra": "^8.1.0" - }, "dependencies": { - "date-format": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/date-format/-/date-format-2.1.0.tgz", - "integrity": "sha512-bYQuGLeFxhkxNOF3rcMtiZxvCBAquGzZm6oWA1oZ0g2THUzivaRhv8uOhdr19LmoobSOLoIAxeUK2RdbM8IFTA==", - "dev": true - }, - "debug": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", - "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true } } }, - "strict-uri-encode": { + "node_modules/streamroller/node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", - "integrity": "sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=", - "dev": true + "integrity": "sha512-R3f198pcvnB+5IpnBlRkphuE9n46WyVl8I39W/ZUTZLz4nqSP/oLYUrcnJrw462Ds8he4YKMov2efsTIw1BDGQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "string-width": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", - "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.0" + "dependencies": { + "safe-buffer": "~5.2.0" } }, - "string.prototype.trimend": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", - "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "node_modules/string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "dependencies": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "engines": { + "node": ">=4" } }, - "string.prototype.trimstart": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", - "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "node_modules/string-width/node_modules/ansi-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.1.tgz", + "integrity": "sha512-+O9Jct8wf++lXxxFc4hc8LsjaSq0HFzzL7cVsw8pRDIPdjKD2mT4ytDZlLuSBZ4cLKZFXIrMGO7DbQCtMJJMKw==", "dev": true, - "requires": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" + "engines": { + "node": ">=4" } }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "node_modules/string-width/node_modules/strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha512-4XaJ2zQdCzROZDivEVIDPkcQn8LMFSa8kj8Gxb/Lnwzv9A8VctNZ+lfivC/sV3ivW8ElJTERXZoPBRrZKkNKow==", "dev": true, - "requires": { - "safe-buffer": "~5.2.0" + "dependencies": { + "ansi-regex": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "strip-ansi": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", - "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "requires": { - "ansi-regex": "^5.0.0" + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "strip-dirs": { + "node_modules/strip-dirs": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", "dev": true, - "requires": { + "dependencies": { "is-natural-number": "^4.0.1" } }, - "strip-eof": { + "node_modules/strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true + "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "strip-json-comments": { + "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "strip-outer": { + "node_modules/strip-outer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", "dev": true, - "requires": { + "dependencies": { "escape-string-regexp": "^1.0.2" }, - "dependencies": { - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - } + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-outer/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" } }, - "stubs": { + "node_modules/stubs": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", - "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=", + "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==", "dev": true }, - "subarg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", - "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", - "dev": true, - "requires": { - "minimist": "^1.1.0" - } - }, - "supports-color": { + "node_modules/supports-color": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", - "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "integrity": "sha512-Jds2VIYDrlp5ui7t8abHN2bjAu4LV/q4N2KivFPpGH0lrka0BMq/33AmECUXlKPcHigkNaqfXRENFju+rlcy+A==", "dev": true, - "requires": { + "dependencies": { "has-flag": "^1.0.0" + }, + "engines": { + "node": ">=0.8.0" } }, - "syntax-error": { - "version": "1.4.0", - "resolved": "http://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", - "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", - "dev": true, - "requires": { - "acorn-node": "^1.2.0" - } - }, - "tar-fs": { + "node_modules/tar-fs": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", "dev": true, - "requires": { + "dependencies": { "chownr": "^1.1.1", "mkdirp-classic": "^0.5.2", "pump": "^3.0.0", "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-fs/node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/tar-fs/node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/tar-fs/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/tar-fs/node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, "dependencies": { - "bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "requires": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - } - } - }, - "buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", - "dev": true, - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", - "dev": true, - "requires": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" - } - } + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" } }, - "tar-stream": { + "node_modules/tar-stream": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", "dev": true, - "requires": { + "dependencies": { "bl": "^1.0.0", "buffer-alloc": "^1.2.0", "end-of-stream": "^1.0.0", @@ -5481,396 +6205,353 @@ "readable-stream": "^2.3.0", "to-buffer": "^1.1.1", "xtend": "^4.0.0" + }, + "engines": { + "node": ">= 0.8.0" } }, - "teeny-request": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-6.0.1.tgz", - "integrity": "sha512-TAK0c9a00ELOqLrZ49cFxvPVogMUFaWY8dUsQc/0CuQPGF+BOxOQzXfE413BAk2kLomwNplvdtMpeaeGWmoc2g==", + "node_modules/teeny-request": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-7.1.1.tgz", + "integrity": "sha512-iwY6rkW5DDGq8hE2YgNQlKbptYpY5Nn2xecjQiNjOXWbKzPGUfmeUBCSQbbr306d7Z7U2N0TPl+/SwYRfua1Dg==", "dev": true, - "requires": { + "dependencies": { "http-proxy-agent": "^4.0.0", - "https-proxy-agent": "^4.0.0", - "node-fetch": "^2.2.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.1", "stream-events": "^1.0.5", - "uuid": "^3.3.2" + "uuid": "^8.0.0" + }, + "engines": { + "node": ">=10" } }, - "through": { + "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "dev": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, - "timed-out": { + "node_modules/timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", - "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", - "dev": true - }, - "timers-browserify": { - "version": "1.4.2", - "resolved": "http://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", - "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", + "integrity": "sha512-G7r3AhovYtr5YKOWQkta8RKAPb+J9IsO4uVmzjl8AZwfhs8UcUwTiD6gcJYSgOtzyjvQKrKYn41syHbUWMkafA==", "dev": true, - "requires": { - "process": "~0.11.0" + "engines": { + "node": ">=0.10.0" } }, - "tmp": { + "node_modules/tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", "dev": true, - "requires": { + "dependencies": { "rimraf": "^3.0.0" }, - "dependencies": { - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } + "engines": { + "node": ">=8.17.0" } }, - "to-buffer": { + "node_modules/to-buffer": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", "dev": true }, - "to-regex-range": { + "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", "dev": true, - "requires": { + "dependencies": { "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" } }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "dev": true, + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, - "trim-repeated": { + "node_modules/trim-repeated": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", - "integrity": "sha1-42RqLqTokTEr9+rObPsFOAvAHCE=", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", "dev": true, - "requires": { + "dependencies": { "escape-string-regexp": "^1.0.2" }, - "dependencies": { - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - } + "engines": { + "node": ">=0.10.0" } }, - "tslib": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", - "integrity": "sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==", - "dev": true + "node_modules/trim-repeated/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } }, - "tty-browserify": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", - "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "node_modules/tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", "dev": true }, - "tunnel": { + "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.6.11 <=0.7.0 || >=0.7.3" + } }, - "tunnel-agent": { + "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", "dev": true, - "requires": { + "dependencies": { "safe-buffer": "^5.0.1" + }, + "engines": { + "node": "*" } }, - "type-check": { + "node_modules/type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", - "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", "dev": true, - "requires": { + "dependencies": { "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" } }, - "type-detect": { + "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "engines": { + "node": ">=4" + } }, - "type-fest": { + "node_modules/type-fest": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", - "dev": true + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "type-is": { + "node_modules/type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", "dev": true, - "requires": { + "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" }, - "dependencies": { - "mime-db": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.46.0.tgz", - "integrity": "sha512-svXaP8UQRZ5K7or+ZmfNhg2xX3yKDMUzqadsSqi4NCH/KomcH75MAMYAGVlvXn4+b/xOPhS3I2uHKRUzvjY7BQ==", - "dev": true - }, - "mime-types": { - "version": "2.1.29", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.29.tgz", - "integrity": "sha512-Y/jMt/S5sR9OaqteJtslsFZKWOIIqMACsJSiHghlCAyhf7jfVYjKBmLiX8OgpWeW+fjJ2b+Az69aPFPkUOY6xQ==", - "dev": true, - "requires": { - "mime-db": "1.46.0" - } - } + "engines": { + "node": ">= 0.6" } }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", - "dev": true - }, - "ua-parser-js": { - "version": "0.7.24", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.24.tgz", - "integrity": "sha512-yo+miGzQx5gakzVK3QFfN0/L9uVhosXBBO7qmnk7c2iw1IhL212wfA3zbnI54B0obGwC/5NWub/iT9sReMx+Fw==", - "dev": true - }, - "uglify-js": { - "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", - "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "node_modules/ua-parser-js": { + "version": "0.7.32", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.32.tgz", + "integrity": "sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==", "dev": true, - "optional": true, - "requires": { - "commander": "~2.17.1", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, - "optional": true + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" } + ], + "engines": { + "node": "*" } }, - "umd": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", - "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", - "dev": true - }, - "unbox-primitive": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", - "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "node_modules/uglify-js": { + "version": "3.17.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.17.4.tgz", + "integrity": "sha512-T9q82TJI9e/C1TAxYvfb16xO120tMVFZrGA3f9/P4424DNu6ypK103y0GPFVa17yotwSyZW5iYXgjYHkGrJW/g==", "dev": true, - "requires": { - "function-bind": "^1.1.1", - "has-bigints": "^1.0.0", - "has-symbols": "^1.0.0", - "which-boxed-primitive": "^1.0.1" + "optional": true, + "bin": { + "uglifyjs": "bin/uglifyjs" + }, + "engines": { + "node": ">=0.8.0" } }, - "unbzip2-stream": { + "node_modules/unbzip2-stream": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.4.3.tgz", "integrity": "sha512-mlExGW4w71ebDJviH16lQLtZS32VKqsSfk80GCfUlwT/4/hNRFsoscrF/c++9xinkMzECL1uL9DDwXqFWkruPg==", "dev": true, - "requires": { + "dependencies": { "buffer": "^5.2.1", "through": "^2.3.8" } }, - "undeclared-identifiers": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz", - "integrity": "sha512-pJOW4nxjlmfwKApE4zvxLScM/njmwj/DiUBv7EabwE4O8kRUy+HIwxQtZLBPll/jx1LJyBcqNfB3/cpv9EZwOw==", - "dev": true, - "requires": { - "acorn-node": "^1.3.0", - "dash-ast": "^1.0.0", - "get-assigned-identifiers": "^1.2.0", - "simple-concat": "^1.0.0", - "xtend": "^4.0.1" - } - }, - "universalify": { + "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true + "dev": true, + "engines": { + "node": ">= 4.0.0" + } }, - "unpipe": { + "node_modules/unpipe": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", - "dev": true + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "dev": true, + "engines": { + "node": ">= 0.8" + } }, - "upper-case": { + "node_modules/upper-case": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case/-/upper-case-2.0.2.tgz", "integrity": "sha512-KgdgDGJt2TpuwBUIjgG6lzw2GWFRCW9Qkfkiv0DxqHHLYJHmtmdUIKcZd8rHgFSjopVTlw6ggzCm1b8MFQwikg==", "dev": true, - "requires": { + "dependencies": { "tslib": "^2.0.3" } }, - "upper-case-first": { + "node_modules/upper-case-first": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/upper-case-first/-/upper-case-first-2.0.2.tgz", "integrity": "sha512-514ppYHBaKwfJRK/pNC6c/OxfGa0obSnAl106u97Ed0I625Nin96KAjttZF6ZL3e1XLtphxnqrOi9iWgm+u+bg==", "dev": true, - "requires": { - "tslib": "^2.0.3" - } - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } + "tslib": "^2.0.3" } }, - "url-parse-lax": { + "node_modules/url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", + "integrity": "sha512-NjFKA0DidqPa5ciFcSrXnAltTtzz84ogy+NebPvfEgAck0+TNg4UJ4IN+fB7zRZfbgUf0syOo9MDxFkDSMuFaQ==", "dev": true, - "requires": { + "dependencies": { "prepend-http": "^2.0.0" + }, + "engines": { + "node": ">=4" } }, - "url-to-options": { + "node_modules/url-to-options": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", - "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=", - "dev": true - }, - "urlgrey": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-0.4.4.tgz", - "integrity": "sha1-iS/pWWCAXoVRnxzUOJ8stMu3ZS8=", - "dev": true + "integrity": "sha512-0kQLIzG4fdk/G5NONku64rSH/x32NOA39LVQqlK8Le6lvTF6GGRJpqaQFGgU+CLwySIqBSMdwYM0sYcW9f6P4A==", + "dev": true, + "engines": { + "node": ">= 4" + } }, - "util": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", - "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", + "node_modules/urlgrey": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-1.0.0.tgz", + "integrity": "sha512-hJfIzMPJmI9IlLkby8QrsCykQ+SXDeO2W5Q9QTW3QpqZVTx4a/K7p8/5q+/isD8vsbVaFgql/gvAoQCRQ2Cb5w==", "dev": true, - "requires": { - "inherits": "^2.0.3", - "is-arguments": "^1.0.4", - "is-generator-function": "^1.0.7", - "is-typed-array": "^1.1.3", - "safe-buffer": "^5.1.2", - "which-typed-array": "^1.1.2" + "dependencies": { + "fast-url-parser": "^1.1.3" } }, - "util-deprecate": { + "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, - "utils-merge": { + "node_modules/utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", - "dev": true + "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==", + "dev": true, + "engines": { + "node": ">= 0.4.0" + } }, - "uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "dev": true + "node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } }, - "vary": { + "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", - "dev": true - }, - "vm-browserify": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", - "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", - "dev": true + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "dev": true, + "engines": { + "node": ">= 0.8" + } }, - "void-elements": { + "node_modules/void-elements": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", - "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", - "dev": true + "integrity": "sha512-qZKX4RnBzH2ugr8Lxa7x+0V6XD9Sb/ouARtiasEQCHB1EVU4NXtmHsDDrx1dO4ne5fc3J6EW05BP1Dl0z0iung==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "webdriver": { + "node_modules/webdriver": { "version": "6.12.1", "resolved": "https://registry.npmjs.org/webdriver/-/webdriver-6.12.1.tgz", "integrity": "sha512-3rZgAj9o2XHp16FDTzvUYaHelPMSPbO1TpLIMUT06DfdZjNYIzZiItpIb/NbQDTPmNhzd9cuGmdI56WFBGY2BA==", "dev": true, - "requires": { + "dependencies": { "@wdio/config": "6.12.1", "@wdio/logger": "6.10.10", "@wdio/protocols": "6.12.0", "@wdio/utils": "6.11.0", "got": "^11.0.2", "lodash.merge": "^4.6.1" + }, + "engines": { + "node": ">=10.0.0" } }, - "webdriverio": { + "node_modules/webdriverio": { "version": "6.12.1", "resolved": "https://registry.npmjs.org/webdriverio/-/webdriverio-6.12.1.tgz", "integrity": "sha512-Nx7ge0vTWHVIRUbZCT+IuMwB5Q0Q5nLlYdgnmmJviUKLuc3XtaEBkYPTbhHWHgSBXsPZMIc023vZKNkn+6iyeQ==", "dev": true, - "requires": { + "dependencies": { "@types/puppeteer-core": "^5.4.0", "@wdio/config": "6.12.1", "@wdio/logger": "6.10.10", @@ -5895,190 +6576,228 @@ "serialize-error": "^8.0.0", "webdriver": "6.12.1" }, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/webdriverio/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/webdriverio/node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, "dependencies": { - "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "requires": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "serialize-error": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.0.1.tgz", - "integrity": "sha512-r5o60rWFS+8/b49DNAbB+GXZA0SpDpuWE758JxDKgRTga05r3U5lwyksE91dYKDhXSmnu36RALj615E6Aj5pSg==", - "dev": true, - "requires": { - "type-fest": "^0.20.2" - } - }, - "type-fest": { - "version": "0.20.2", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", - "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", - "dev": true - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true - } + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" } }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "node_modules/webdriverio/node_modules/serialize-error": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-8.1.0.tgz", + "integrity": "sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ==", "dev": true, - "requires": { - "isexe": "^2.0.0" + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "which-boxed-primitive": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", - "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "node_modules/webdriverio/node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "dev": true, - "requires": { - "is-bigint": "^1.0.1", - "is-boolean-object": "^1.1.0", - "is-number-object": "^1.0.4", - "is-string": "^1.0.5", - "is-symbol": "^1.0.3" + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "which-typed-array": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.4.tgz", - "integrity": "sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA==", + "node_modules/webdriverio/node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", "dev": true, - "requires": { - "available-typed-arrays": "^1.0.2", - "call-bind": "^1.0.0", - "es-abstract": "^1.18.0-next.1", - "foreach": "^2.0.5", - "function-bind": "^1.1.1", - "has-symbols": "^1.0.1", - "is-typed-array": "^1.1.3" + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" } }, - "wide-align": { + "node_modules/wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", "dev": true, - "requires": { - "string-width": "^1.0.2 || 2" - }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } + "string-width": "^1.0.2 || 2" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, - "wordwrap": { + "node_modules/wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", - "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==", "dev": true }, - "workerpool": { + "node_modules/workerpool": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.0.tgz", "integrity": "sha512-toV7q9rWNYha963Pl/qyeZ6wG+3nnsyvolaNUS8+R5Wtw6qJPTxIlOP1ZSvcGhEJw+l3HMMmtiNo9Gl61G4GVg==", "dev": true }, - "wrap-ansi": { + "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "dev": true, - "requires": { + "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" } }, - "wrappy": { + "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, - "ws": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", - "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==", - "dev": true + "node_modules/ws": { + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz", + "integrity": "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==", + "dev": true, + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } }, - "xtend": { + "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.4" + } }, - "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", - "dev": true + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "node_modules/yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha512-ncTzHV7NvsQZkYe1DW7cbDLm0YpzHmZF5r/iyP3ZnQtMiJ+pjzisCiMNI+Sj+xQF5pXhSHxSB3uDbsBTzY/c2A==", "dev": true }, - "yargs": { + "node_modules/yargs": { "version": "16.2.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", "dev": true, - "requires": { + "dependencies": { "cliui": "^7.0.2", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", @@ -6086,72 +6805,115 @@ "string-width": "^4.2.0", "y18n": "^5.0.5", "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" } }, - "yargs-parser": { - "version": "20.2.6", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.6.tgz", - "integrity": "sha512-AP1+fQIWSM/sMiET8fyayjx/J+JmTPt2Mr0FkrgqB4todtfa53sOsrSAcIrJRD5XS20bKUwaDIuMkWKCEiQLKA==", - "dev": true + "node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } }, - "yargs-unparser": { + "node_modules/yargs-unparser": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", "dev": true, - "requires": { + "dependencies": { "camelcase": "^6.0.0", "decamelize": "^4.0.0", "flat": "^5.0.2", "is-plain-obj": "^2.1.0" }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser/node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - } + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" } }, - "yauzl": { + "node_modules/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", "dev": true, - "requires": { + "dependencies": { "buffer-crc32": "~0.2.3", "fd-slicer": "~1.1.0" } }, - "yocto-queue": { + "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "zip-stream": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.0.4.tgz", - "integrity": "sha512-a65wQ3h5gcQ/nQGWV1mSZCEzCML6EK/vyVPcrPNynySP1j3VBbQKh3nhC8CbORb+jfl2vXvh56Ul5odP1bAHqw==", + "node_modules/zip-stream": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.0.tgz", + "integrity": "sha512-zshzwQW7gG7hjpBlgeQP9RuyPGNxvJdzR8SUM3QhxCnLjWN2E7j3dOvpeDcQoETfHx0urRS7EtmVToql7YpU4A==", "dev": true, - "requires": { + "dependencies": { "archiver-utils": "^2.1.0", - "compress-commons": "^4.0.2", + "compress-commons": "^4.1.0", "readable-stream": "^3.6.0" }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/zip-stream/node_modules/readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "dev": true, "dependencies": { - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - } + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } } } diff --git a/package.json b/package.json index 6a0873995..c0dae07d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "author": "Jake Luer ", "name": "chai", + "type": "module", "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", "keywords": [ "test", @@ -25,23 +26,26 @@ "bugs": { "url": "https://github.com/chaijs/chai/issues" }, - "main": "./index", + "main": "./chai.js", "exports": { ".": { - "require": "./index.js", - "import": "./index.mjs" + "require": "./chai.cjs", + "import": "./chai.js" }, - "./*": "./*.js" + "./*": "./*" }, "scripts": { "prebuild": "npm run clean", - "build": "browserify --bare --outfile chai.js --standalone chai --entry index.js", + "build": "npm run build:cjs && npm run build:esm", + "build:cjs": "esbuild --bundle --format=cjs --keep-names --outfile=chai.cjs index.js", + "build:esm": "esbuild --bundle --format=esm --keep-names --outfile=chai.js index.js", "pretest": "npm run build", - "test": "npm run test-node && npm run test-chrome", - "test-node": "mocha --require ./test/bootstrap/index.js --reporter dot test/*.js test/*.mjs", - "test-chrome": "karma start karma.conf.js --single-run --browsers HeadlessChrome", - "test-firefox": "karma start karma.conf.js --browsers Firefox", - "test-cov": "istanbul cover ./node_modules/.bin/_mocha -- --require ./test/bootstrap/index.js test/*.js test/*.mjs", + "test": "npm run test-node && npm run test-cjs && npm run test-chrome", + "test-node": "mocha --require ./test/bootstrap/index.js --reporter dot test/*.js", + "test-cjs": "mocha --require ./test/bootstrap/index.js --reporter dot test/*.cjs", + "test-chrome": "karma start karma.conf.cjs --single-run --browsers HeadlessChrome", + "test-firefox": "karma start karma.conf.cjs --browsers Firefox", + "test-cov": "istanbul cover ./node_modules/.bin/_mocha -- --require ./test/bootstrap/index.js test/*.js", "clean": "rm -f chai.js coverage" }, "engines": { @@ -51,14 +55,14 @@ "assertion-error": "^1.1.0", "check-error": "^1.0.2", "deep-eql": "^4.1.2", - "loupe": "^2.3.0", + "loupe": "^2.3.1", "pathval": "^1.1.1", "type-detect": "^4.0.5" }, "devDependencies": { - "browserify": "^17.0.0", "bump-cli": "^1.1.3", "codecov": "^3.8.1", + "esbuild": "^0.17.3", "istanbul": "^0.4.3", "karma": "^6.1.1", "karma-chrome-launcher": "^3.1.0", diff --git a/register-assert.cjs b/register-assert.cjs new file mode 100644 index 000000000..85949392c --- /dev/null +++ b/register-assert.cjs @@ -0,0 +1,3 @@ +const {assert} = require('./chai.cjs'); + +globalThis.assert = assert; diff --git a/register-assert.js b/register-assert.js index f80cb4ded..f593717e0 100644 --- a/register-assert.js +++ b/register-assert.js @@ -1 +1,3 @@ -global.assert = require('./').assert; +import {assert} from './index.js'; + +globalThis.assert = assert; diff --git a/register-expect.cjs b/register-expect.cjs new file mode 100644 index 000000000..03a92e995 --- /dev/null +++ b/register-expect.cjs @@ -0,0 +1,3 @@ +const {expect} = require('./chai.cjs'); + +globalThis.expect = expect; diff --git a/register-expect.js b/register-expect.js index f905c3a20..2807b89be 100644 --- a/register-expect.js +++ b/register-expect.js @@ -1 +1,3 @@ -global.expect = require('./').expect; +import {expect} from './index.js'; + +globalThis.expect = expect; diff --git a/register-should.cjs b/register-should.cjs new file mode 100644 index 000000000..f935dccdb --- /dev/null +++ b/register-should.cjs @@ -0,0 +1,3 @@ +const {should} = require('./chai.cjs'); + +globalThis.should = should(); diff --git a/register-should.js b/register-should.js index 5dab96fc5..1339ee4c4 100644 --- a/register-should.js +++ b/register-should.js @@ -1 +1,3 @@ -global.should = require('./').should(); +import {should} from './index.js'; + +globalThis.should = should(); diff --git a/test/bootstrap/index.js b/test/bootstrap/index.js index 6e4cf5a91..4338b7efb 100644 --- a/test/bootstrap/index.js +++ b/test/bootstrap/index.js @@ -1,8 +1,6 @@ -if (typeof window === 'object') { - global = window; -} else { - global.chai = require('../..'); -} +import * as chai from '../../chai.js'; + +globalThis.chai = chai; var isStackSupported = false; if (typeof Error.captureStackTrace !== 'undefined') { @@ -31,7 +29,7 @@ if (typeof Error.captureStackTrace !== 'undefined') { * @param {Boolean} skipStackTest if truthy, don't validate stack trace */ -global.err = function globalErr (fn, val, skipStackTest) { +globalThis.err = function globalErr (fn, val, skipStackTest) { if (chai.util.type(fn) !== 'function') throw new chai.AssertionError('Invalid fn'); diff --git a/test/commonjs.cjs b/test/commonjs.cjs new file mode 100644 index 000000000..ff4b15f46 --- /dev/null +++ b/test/commonjs.cjs @@ -0,0 +1,11 @@ +const {expect, should} = require('chai'); +const chai = require('chai'); +require('chai/register-assert.cjs'); +should() + +it('expect and should are CJS named exports and chai is a default export', () => { + expect(4).to.equal(4); + "s".should.equal("s"); + chai.expect(4).to.equal(4); + assert.equal(4, 4); +}) diff --git a/test/esm.mjs b/test/esm.mjs deleted file mode 100644 index fc4838c5a..000000000 --- a/test/esm.mjs +++ /dev/null @@ -1,11 +0,0 @@ -import {expect, should} from 'chai'; -import chai from 'chai'; -import 'chai/register-assert.js'; -should() - -it('expect and should are ESM named exports and chai is a default export', () => { - expect(4).to.equal(4); - "s".should.equal("s"); - chai.expect(4).to.equal(4); - assert.equal(4, 4); -}) \ No newline at end of file diff --git a/test/utilities.js b/test/utilities.js index 0d8ba0737..97c758bb6 100644 --- a/test/utilities.js +++ b/test/utilities.js @@ -756,6 +756,16 @@ describe('utilities', function () { }); }); + it('inspect BigInt', function () { + if (typeof BigInt !== 'function') return; + + chai.use(function (_chai, _) { + expect(_.inspect(BigInt(0))).to.equal('0n'); + expect(_.inspect(BigInt(1234))).to.equal('1234n'); + expect(_.inspect(BigInt(-1234))).to.equal('-1234n'); + }); + }); + it('inspect every kind of available TypedArray', function () { chai.use(function (_chai, _) { var arr = [1, 2, 3]