mirror of
https://github.com/chaijs/chai
synced 2024-11-14 15:57:10 +00:00
commit
529d395fa0
3 changed files with 30 additions and 428 deletions
454
chai.js
454
chai.js
|
@ -14,7 +14,7 @@ var used = [];
|
|||
* Chai version
|
||||
*/
|
||||
|
||||
exports.version = '4.1.1';
|
||||
exports.version = '4.1.2';
|
||||
|
||||
/*!
|
||||
* Assertion Error
|
||||
|
@ -6967,7 +6967,7 @@ module.exports = function (chai, util) {
|
|||
}
|
||||
|
||||
/*!
|
||||
* ### .ifError(object, [message])
|
||||
* ### .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
|
||||
|
@ -6978,7 +6978,6 @@ module.exports = function (chai, util) {
|
|||
*
|
||||
* @name ifError
|
||||
* @param {Object} object
|
||||
* @param {String} message _optional_
|
||||
* @namespace Assert
|
||||
* @api public
|
||||
*/
|
||||
|
@ -6990,7 +6989,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isExtensible(object, [message])
|
||||
* ### .isExtensible(object)
|
||||
*
|
||||
* Asserts that `object` is extensible (can have new properties added to it).
|
||||
*
|
||||
|
@ -7009,7 +7008,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isNotExtensible(object, [message])
|
||||
* ### .isNotExtensible(object)
|
||||
*
|
||||
* Asserts that `object` is _not_ extensible.
|
||||
*
|
||||
|
@ -7034,7 +7033,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isSealed(object, [message])
|
||||
* ### .isSealed(object)
|
||||
*
|
||||
* Asserts that `object` is sealed (cannot have new properties added to it
|
||||
* and its existing properties cannot be removed).
|
||||
|
@ -7058,7 +7057,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isNotSealed(object, [message])
|
||||
* ### .isNotSealed(object)
|
||||
*
|
||||
* Asserts that `object` is _not_ sealed.
|
||||
*
|
||||
|
@ -7077,7 +7076,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isFrozen(object, [message])
|
||||
* ### .isFrozen(object)
|
||||
*
|
||||
* Asserts that `object` is frozen (cannot have new properties added to it
|
||||
* and its existing properties cannot be modified).
|
||||
|
@ -7098,7 +7097,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isNotFrozen(object, [message])
|
||||
* ### .isNotFrozen(object)
|
||||
*
|
||||
* Asserts that `object` is _not_ frozen.
|
||||
*
|
||||
|
@ -7117,7 +7116,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isEmpty(target, [message])
|
||||
* ### .isEmpty(target)
|
||||
*
|
||||
* Asserts that the target does not contain any values.
|
||||
* For arrays and strings, it checks the `length` property.
|
||||
|
@ -7143,7 +7142,7 @@ module.exports = function (chai, util) {
|
|||
};
|
||||
|
||||
/**
|
||||
* ### .isNotEmpty(target, [message])
|
||||
* ### .isNotEmpty(target)
|
||||
*
|
||||
* Asserts that the target contains values.
|
||||
* For arrays and strings, it checks the `length` property.
|
||||
|
@ -7759,7 +7758,7 @@ var transferFlags = require('./transferFlags');
|
|||
*/
|
||||
|
||||
module.exports = function addProperty(ctx, name, getter) {
|
||||
getter = getter === undefined ? new Function() : getter;
|
||||
getter = getter === undefined ? function () {} : getter;
|
||||
|
||||
Object.defineProperty(ctx, name,
|
||||
{ get: function propertyGetter() {
|
||||
|
@ -7880,7 +7879,7 @@ module.exports = function expectTypes(obj, types) {
|
|||
}
|
||||
};
|
||||
|
||||
},{"./flag":15,"assertion-error":33,"type-detect":39}],15:[function(require,module,exports){
|
||||
},{"./flag":15,"assertion-error":33,"type-detect":38}],15:[function(require,module,exports){
|
||||
/*!
|
||||
* Chai - flag utility
|
||||
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
||||
|
@ -8290,7 +8289,7 @@ exports.isProxyEnabled = require('./isProxyEnabled');
|
|||
|
||||
exports.isNaN = require('./isNaN');
|
||||
|
||||
},{"./addChainableMethod":9,"./addLengthGuard":10,"./addMethod":11,"./addProperty":12,"./compareByInspect":13,"./expectTypes":14,"./flag":15,"./getActual":16,"./getMessage":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,"get-func-name":37,"pathval":38,"type-detect":39}],23:[function(require,module,exports){
|
||||
},{"./addChainableMethod":9,"./addLengthGuard":10,"./addMethod":11,"./addProperty":12,"./compareByInspect":13,"./expectTypes":14,"./flag":15,"./getActual":16,"./getMessage":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,"get-func-name":36,"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
|
||||
|
||||
|
@ -8675,7 +8674,7 @@ function objectToString(o) {
|
|||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
|
||||
},{"../config":4,"./getEnumerableProperties":17,"./getProperties":21,"get-func-name":37}],24:[function(require,module,exports){
|
||||
},{"../config":4,"./getEnumerableProperties":17,"./getProperties":21,"get-func-name":36}],24:[function(require,module,exports){
|
||||
/*!
|
||||
* Chai - isNaN utility
|
||||
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
||||
|
@ -9538,57 +9537,33 @@ module.exports = {
|
|||
|
||||
},{}],35:[function(require,module,exports){
|
||||
'use strict';
|
||||
/* globals Symbol: true, Uint8Array: true, WeakMap: true */
|
||||
/* globals Symbol: false, Uint8Array: false, WeakMap: false */
|
||||
/*!
|
||||
* deep-eql
|
||||
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Module dependencies
|
||||
*/
|
||||
|
||||
var type = require('type-detect');
|
||||
function FakeMap() {
|
||||
this.clear();
|
||||
this._key = 'chai/deep-eql__' + Math.random() + Date.now();
|
||||
}
|
||||
|
||||
FakeMap.prototype = {
|
||||
clear: function clearMap() {
|
||||
this.keys = [];
|
||||
this.values = [];
|
||||
return this;
|
||||
get: function getMap(key) {
|
||||
return key[this._key];
|
||||
},
|
||||
set: function setMap(key, value) {
|
||||
var index = this.keys.indexOf(key);
|
||||
if (index >= 0) {
|
||||
this.values[index] = value;
|
||||
} else {
|
||||
this.keys.push(key);
|
||||
this.values.push(value);
|
||||
if (!Object.isFrozen(key)) {
|
||||
Object.defineProperty(key, this._key, {
|
||||
value: value,
|
||||
configurable: true,
|
||||
});
|
||||
}
|
||||
return this;
|
||||
},
|
||||
get: function getMap(key) {
|
||||
return this.values[this.keys.indexOf(key)];
|
||||
},
|
||||
delete: function deleteMap(key) {
|
||||
var index = this.keys.indexOf(key);
|
||||
if (index >= 0) {
|
||||
this.values = this.values.slice(0, index).concat(this.values.slice(index + 1));
|
||||
this.keys = this.keys.slice(0, index).concat(this.keys.slice(index + 1));
|
||||
}
|
||||
return this;
|
||||
},
|
||||
};
|
||||
|
||||
var MemoizeMap = null;
|
||||
if (typeof WeakMap === 'function') {
|
||||
MemoizeMap = WeakMap;
|
||||
} else {
|
||||
MemoizeMap = FakeMap;
|
||||
}
|
||||
|
||||
var MemoizeMap = typeof WeakMap === 'function' ? WeakMap : FakeMap;
|
||||
/*!
|
||||
* Check to see if the MemoizeMap has recorded a result of the two operands
|
||||
*
|
||||
|
@ -10017,380 +9992,7 @@ function isPrimitive(value) {
|
|||
return value === null || typeof value !== 'object';
|
||||
}
|
||||
|
||||
},{"type-detect":36}],36:[function(require,module,exports){
|
||||
'use strict';
|
||||
/* !
|
||||
* type-detect
|
||||
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
var getPrototypeOfExists = typeof Object.getPrototypeOf === 'function';
|
||||
var promiseExists = typeof Promise === 'function';
|
||||
var globalObject = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : self; // eslint-disable-line
|
||||
var isDom = 'location' in globalObject && 'document' in globalObject;
|
||||
var htmlElementExists = typeof HTMLElement !== 'undefined';
|
||||
var isArrayExists = typeof Array.isArray === 'function';
|
||||
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 = getPrototypeOfExists && setEntriesExists && Object.getPrototypeOf(new Set().entries());
|
||||
var mapIteratorPrototype = getPrototypeOfExists && 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 Array.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
|
||||
*/
|
||||
module.exports = 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 (isArrayExists && Array.isArray(obj)) {
|
||||
return 'Array';
|
||||
}
|
||||
|
||||
if (isDom) {
|
||||
/* ! 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 (obj === globalObject.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 (obj === globalObject.document) {
|
||||
return 'Document';
|
||||
}
|
||||
|
||||
/* ! 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 (obj === (globalObject.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 (obj === (globalObject.navigator || {}).plugins) {
|
||||
return 'PluginArray';
|
||||
}
|
||||
|
||||
/* ! 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 (htmlElementExists && obj instanceof HTMLElement && 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 (htmlElementExists && obj instanceof HTMLElement && 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 (htmlElementExists && obj instanceof HTMLElement && 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;
|
||||
}
|
||||
|
||||
if (getPrototypeOfExists) {
|
||||
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);
|
||||
};
|
||||
|
||||
module.exports.typeDetect = module.exports;
|
||||
|
||||
},{}],37:[function(require,module,exports){
|
||||
},{"type-detect":38}],36:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
/* !
|
||||
|
@ -10436,7 +10038,7 @@ function getFuncName(aFunc) {
|
|||
|
||||
module.exports = getFuncName;
|
||||
|
||||
},{}],38:[function(require,module,exports){
|
||||
},{}],37:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
/* !
|
||||
|
@ -10729,7 +10331,7 @@ module.exports = {
|
|||
setPathValue: setPathValue,
|
||||
};
|
||||
|
||||
},{}],39:[function(require,module,exports){
|
||||
},{}],38:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
/* !
|
||||
|
|
|
@ -10,7 +10,7 @@ var used = [];
|
|||
* Chai version
|
||||
*/
|
||||
|
||||
exports.version = '4.1.1';
|
||||
exports.version = '4.1.2';
|
||||
|
||||
/*!
|
||||
* Assertion Error
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
"Veselin Todorov <hi@vesln.com>",
|
||||
"John Firebaugh <john.firebaugh@gmail.com>"
|
||||
],
|
||||
"version": "4.1.1",
|
||||
"version": "4.1.2",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/chaijs/chai"
|
||||
|
|
Loading…
Reference in a new issue