chai 4.3.5 → 4.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chai.js +841 -1215
- package/package.json +2 -2
package/chai.js
CHANGED
|
@@ -9920,1224 +9920,850 @@ module.exports = getFuncName;
|
|
|
9920
9920
|
|
|
9921
9921
|
},{}],37:[function(require,module,exports){
|
|
9922
9922
|
(function (global, factory) {
|
|
9923
|
-
|
|
9924
|
-
|
|
9925
|
-
|
|
9923
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
9924
|
+
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
|
9925
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.loupe = {}));
|
|
9926
9926
|
}(this, (function (exports) { 'use strict';
|
|
9927
9927
|
|
|
9928
|
-
|
|
9929
|
-
|
|
9930
|
-
function createCommonjsModule(fn) {
|
|
9931
|
-
var module = { exports: {} };
|
|
9932
|
-
return fn(module, module.exports), module.exports;
|
|
9933
|
-
}
|
|
9934
|
-
|
|
9935
|
-
var typeDetect = createCommonjsModule(function (module, exports) {
|
|
9936
|
-
(function (global, factory) {
|
|
9937
|
-
module.exports = factory() ;
|
|
9938
|
-
}(commonjsGlobal, (function () {
|
|
9939
|
-
/* !
|
|
9940
|
-
* type-detect
|
|
9941
|
-
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
|
9942
|
-
* MIT Licensed
|
|
9943
|
-
*/
|
|
9944
|
-
var promiseExists = typeof Promise === 'function';
|
|
9945
|
-
|
|
9946
|
-
/* eslint-disable no-undef */
|
|
9947
|
-
var globalObject = typeof self === 'object' ? self : commonjsGlobal; // eslint-disable-line id-blacklist
|
|
9948
|
-
|
|
9949
|
-
var symbolExists = typeof Symbol !== 'undefined';
|
|
9950
|
-
var mapExists = typeof Map !== 'undefined';
|
|
9951
|
-
var setExists = typeof Set !== 'undefined';
|
|
9952
|
-
var weakMapExists = typeof WeakMap !== 'undefined';
|
|
9953
|
-
var weakSetExists = typeof WeakSet !== 'undefined';
|
|
9954
|
-
var dataViewExists = typeof DataView !== 'undefined';
|
|
9955
|
-
var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
|
|
9956
|
-
var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
|
|
9957
|
-
var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
|
|
9958
|
-
var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
|
|
9959
|
-
var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
|
|
9960
|
-
var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
|
|
9961
|
-
var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
|
|
9962
|
-
var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
|
|
9963
|
-
var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
|
|
9964
|
-
var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
|
|
9965
|
-
var toStringLeftSliceLength = 8;
|
|
9966
|
-
var toStringRightSliceLength = -1;
|
|
9967
|
-
/**
|
|
9968
|
-
* ### typeOf (obj)
|
|
9969
|
-
*
|
|
9970
|
-
* Uses `Object.prototype.toString` to determine the type of an object,
|
|
9971
|
-
* normalising behaviour across engine versions & well optimised.
|
|
9972
|
-
*
|
|
9973
|
-
* @param {Mixed} object
|
|
9974
|
-
* @return {String} object type
|
|
9975
|
-
* @api public
|
|
9976
|
-
*/
|
|
9977
|
-
function typeDetect(obj) {
|
|
9978
|
-
/* ! Speed optimisation
|
|
9979
|
-
* Pre:
|
|
9980
|
-
* string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
|
|
9981
|
-
* boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
|
|
9982
|
-
* number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
|
|
9983
|
-
* undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
|
|
9984
|
-
* function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
|
|
9985
|
-
* Post:
|
|
9986
|
-
* string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
|
|
9987
|
-
* boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
|
|
9988
|
-
* number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
|
|
9989
|
-
* undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
|
|
9990
|
-
* function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
|
|
9991
|
-
*/
|
|
9992
|
-
var typeofObj = typeof obj;
|
|
9993
|
-
if (typeofObj !== 'object') {
|
|
9994
|
-
return typeofObj;
|
|
9995
|
-
}
|
|
9996
|
-
|
|
9997
|
-
/* ! Speed optimisation
|
|
9998
|
-
* Pre:
|
|
9999
|
-
* null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
|
|
10000
|
-
* Post:
|
|
10001
|
-
* null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
|
|
10002
|
-
*/
|
|
10003
|
-
if (obj === null) {
|
|
10004
|
-
return 'null';
|
|
10005
|
-
}
|
|
10006
|
-
|
|
10007
|
-
/* ! Spec Conformance
|
|
10008
|
-
* Test: `Object.prototype.toString.call(window)``
|
|
10009
|
-
* - Node === "[object global]"
|
|
10010
|
-
* - Chrome === "[object global]"
|
|
10011
|
-
* - Firefox === "[object Window]"
|
|
10012
|
-
* - PhantomJS === "[object Window]"
|
|
10013
|
-
* - Safari === "[object Window]"
|
|
10014
|
-
* - IE 11 === "[object Window]"
|
|
10015
|
-
* - IE Edge === "[object Window]"
|
|
10016
|
-
* Test: `Object.prototype.toString.call(this)``
|
|
10017
|
-
* - Chrome Worker === "[object global]"
|
|
10018
|
-
* - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
|
|
10019
|
-
* - Safari Worker === "[object DedicatedWorkerGlobalScope]"
|
|
10020
|
-
* - IE 11 Worker === "[object WorkerGlobalScope]"
|
|
10021
|
-
* - IE Edge Worker === "[object WorkerGlobalScope]"
|
|
10022
|
-
*/
|
|
10023
|
-
if (obj === globalObject) {
|
|
10024
|
-
return 'global';
|
|
10025
|
-
}
|
|
10026
|
-
|
|
10027
|
-
/* ! Speed optimisation
|
|
10028
|
-
* Pre:
|
|
10029
|
-
* array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
|
|
10030
|
-
* Post:
|
|
10031
|
-
* array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
|
|
10032
|
-
*/
|
|
10033
|
-
if (
|
|
10034
|
-
Array.isArray(obj) &&
|
|
10035
|
-
(symbolToStringTagExists === false || !(Symbol.toStringTag in obj))
|
|
10036
|
-
) {
|
|
10037
|
-
return 'Array';
|
|
10038
|
-
}
|
|
10039
|
-
|
|
10040
|
-
// Not caching existence of `window` and related properties due to potential
|
|
10041
|
-
// for `window` to be unset before tests in quasi-browser environments.
|
|
10042
|
-
if (typeof window === 'object' && window !== null) {
|
|
10043
|
-
/* ! Spec Conformance
|
|
10044
|
-
* (https://html.spec.whatwg.org/multipage/browsers.html#location)
|
|
10045
|
-
* WhatWG HTML$7.7.3 - The `Location` interface
|
|
10046
|
-
* Test: `Object.prototype.toString.call(window.location)``
|
|
10047
|
-
* - IE <=11 === "[object Object]"
|
|
10048
|
-
* - IE Edge <=13 === "[object Object]"
|
|
10049
|
-
*/
|
|
10050
|
-
if (typeof window.location === 'object' && obj === window.location) {
|
|
10051
|
-
return 'Location';
|
|
10052
|
-
}
|
|
10053
|
-
|
|
10054
|
-
/* ! Spec Conformance
|
|
10055
|
-
* (https://html.spec.whatwg.org/#document)
|
|
10056
|
-
* WhatWG HTML$3.1.1 - The `Document` object
|
|
10057
|
-
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
|
|
10058
|
-
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)
|
|
10059
|
-
* which suggests that browsers should use HTMLTableCellElement for
|
|
10060
|
-
* both TD and TH elements. WhatWG separates these.
|
|
10061
|
-
* WhatWG HTML states:
|
|
10062
|
-
* > For historical reasons, Window objects must also have a
|
|
10063
|
-
* > writable, configurable, non-enumerable property named
|
|
10064
|
-
* > HTMLDocument whose value is the Document interface object.
|
|
10065
|
-
* Test: `Object.prototype.toString.call(document)``
|
|
10066
|
-
* - Chrome === "[object HTMLDocument]"
|
|
10067
|
-
* - Firefox === "[object HTMLDocument]"
|
|
10068
|
-
* - Safari === "[object HTMLDocument]"
|
|
10069
|
-
* - IE <=10 === "[object Document]"
|
|
10070
|
-
* - IE 11 === "[object HTMLDocument]"
|
|
10071
|
-
* - IE Edge <=13 === "[object HTMLDocument]"
|
|
10072
|
-
*/
|
|
10073
|
-
if (typeof window.document === 'object' && obj === window.document) {
|
|
10074
|
-
return 'Document';
|
|
10075
|
-
}
|
|
10076
|
-
|
|
10077
|
-
if (typeof window.navigator === 'object') {
|
|
10078
|
-
/* ! Spec Conformance
|
|
10079
|
-
* (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)
|
|
10080
|
-
* WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray
|
|
10081
|
-
* Test: `Object.prototype.toString.call(navigator.mimeTypes)``
|
|
10082
|
-
* - IE <=10 === "[object MSMimeTypesCollection]"
|
|
10083
|
-
*/
|
|
10084
|
-
if (typeof window.navigator.mimeTypes === 'object' &&
|
|
10085
|
-
obj === window.navigator.mimeTypes) {
|
|
10086
|
-
return 'MimeTypeArray';
|
|
10087
|
-
}
|
|
10088
|
-
|
|
10089
|
-
/* ! Spec Conformance
|
|
10090
|
-
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
|
|
10091
|
-
* WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray
|
|
10092
|
-
* Test: `Object.prototype.toString.call(navigator.plugins)``
|
|
10093
|
-
* - IE <=10 === "[object MSPluginsCollection]"
|
|
10094
|
-
*/
|
|
10095
|
-
if (typeof window.navigator.plugins === 'object' &&
|
|
10096
|
-
obj === window.navigator.plugins) {
|
|
10097
|
-
return 'PluginArray';
|
|
10098
|
-
}
|
|
10099
|
-
}
|
|
10100
|
-
|
|
10101
|
-
if ((typeof window.HTMLElement === 'function' ||
|
|
10102
|
-
typeof window.HTMLElement === 'object') &&
|
|
10103
|
-
obj instanceof window.HTMLElement) {
|
|
10104
|
-
/* ! Spec Conformance
|
|
10105
|
-
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
|
|
10106
|
-
* WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`
|
|
10107
|
-
* Test: `Object.prototype.toString.call(document.createElement('blockquote'))``
|
|
10108
|
-
* - IE <=10 === "[object HTMLBlockElement]"
|
|
10109
|
-
*/
|
|
10110
|
-
if (obj.tagName === 'BLOCKQUOTE') {
|
|
10111
|
-
return 'HTMLQuoteElement';
|
|
10112
|
-
}
|
|
10113
|
-
|
|
10114
|
-
/* ! Spec Conformance
|
|
10115
|
-
* (https://html.spec.whatwg.org/#htmltabledatacellelement)
|
|
10116
|
-
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
|
|
10117
|
-
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
|
|
10118
|
-
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
|
|
10119
|
-
* which suggests that browsers should use HTMLTableCellElement for
|
|
10120
|
-
* both TD and TH elements. WhatWG separates these.
|
|
10121
|
-
* Test: Object.prototype.toString.call(document.createElement('td'))
|
|
10122
|
-
* - Chrome === "[object HTMLTableCellElement]"
|
|
10123
|
-
* - Firefox === "[object HTMLTableCellElement]"
|
|
10124
|
-
* - Safari === "[object HTMLTableCellElement]"
|
|
10125
|
-
*/
|
|
10126
|
-
if (obj.tagName === 'TD') {
|
|
10127
|
-
return 'HTMLTableDataCellElement';
|
|
10128
|
-
}
|
|
10129
|
-
|
|
10130
|
-
/* ! Spec Conformance
|
|
10131
|
-
* (https://html.spec.whatwg.org/#htmltableheadercellelement)
|
|
10132
|
-
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
|
|
10133
|
-
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
|
|
10134
|
-
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
|
|
10135
|
-
* which suggests that browsers should use HTMLTableCellElement for
|
|
10136
|
-
* both TD and TH elements. WhatWG separates these.
|
|
10137
|
-
* Test: Object.prototype.toString.call(document.createElement('th'))
|
|
10138
|
-
* - Chrome === "[object HTMLTableCellElement]"
|
|
10139
|
-
* - Firefox === "[object HTMLTableCellElement]"
|
|
10140
|
-
* - Safari === "[object HTMLTableCellElement]"
|
|
10141
|
-
*/
|
|
10142
|
-
if (obj.tagName === 'TH') {
|
|
10143
|
-
return 'HTMLTableHeaderCellElement';
|
|
10144
|
-
}
|
|
10145
|
-
}
|
|
10146
|
-
}
|
|
10147
|
-
|
|
10148
|
-
/* ! Speed optimisation
|
|
10149
|
-
* Pre:
|
|
10150
|
-
* Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
|
|
10151
|
-
* Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
|
|
10152
|
-
* Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
|
|
10153
|
-
* Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
|
|
10154
|
-
* Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
|
|
10155
|
-
* Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
|
|
10156
|
-
* Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
|
|
10157
|
-
* Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
|
|
10158
|
-
* Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
|
|
10159
|
-
* Post:
|
|
10160
|
-
* Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
|
|
10161
|
-
* Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
|
|
10162
|
-
* Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
|
|
10163
|
-
* Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
|
|
10164
|
-
* Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
|
|
10165
|
-
* Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
|
|
10166
|
-
* Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
|
|
10167
|
-
* Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
|
|
10168
|
-
* Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
|
|
10169
|
-
*/
|
|
10170
|
-
var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
|
|
10171
|
-
if (typeof stringTag === 'string') {
|
|
10172
|
-
return stringTag;
|
|
10173
|
-
}
|
|
10174
|
-
|
|
10175
|
-
var objPrototype = Object.getPrototypeOf(obj);
|
|
10176
|
-
/* ! Speed optimisation
|
|
10177
|
-
* Pre:
|
|
10178
|
-
* regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)
|
|
10179
|
-
* regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)
|
|
10180
|
-
* Post:
|
|
10181
|
-
* regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)
|
|
10182
|
-
* regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)
|
|
10183
|
-
*/
|
|
10184
|
-
if (objPrototype === RegExp.prototype) {
|
|
10185
|
-
return 'RegExp';
|
|
10186
|
-
}
|
|
10187
|
-
|
|
10188
|
-
/* ! Speed optimisation
|
|
10189
|
-
* Pre:
|
|
10190
|
-
* date x 2,130,074 ops/sec ±4.42% (68 runs sampled)
|
|
10191
|
-
* Post:
|
|
10192
|
-
* date x 3,953,779 ops/sec ±1.35% (77 runs sampled)
|
|
10193
|
-
*/
|
|
10194
|
-
if (objPrototype === Date.prototype) {
|
|
10195
|
-
return 'Date';
|
|
10196
|
-
}
|
|
10197
|
-
|
|
10198
|
-
/* ! Spec Conformance
|
|
10199
|
-
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)
|
|
10200
|
-
* ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise":
|
|
10201
|
-
* Test: `Object.prototype.toString.call(Promise.resolve())``
|
|
10202
|
-
* - Chrome <=47 === "[object Object]"
|
|
10203
|
-
* - Edge <=20 === "[object Object]"
|
|
10204
|
-
* - Firefox 29-Latest === "[object Promise]"
|
|
10205
|
-
* - Safari 7.1-Latest === "[object Promise]"
|
|
10206
|
-
*/
|
|
10207
|
-
if (promiseExists && objPrototype === Promise.prototype) {
|
|
10208
|
-
return 'Promise';
|
|
10209
|
-
}
|
|
10210
|
-
|
|
10211
|
-
/* ! Speed optimisation
|
|
10212
|
-
* Pre:
|
|
10213
|
-
* set x 2,222,186 ops/sec ±1.31% (82 runs sampled)
|
|
10214
|
-
* Post:
|
|
10215
|
-
* set x 4,545,879 ops/sec ±1.13% (83 runs sampled)
|
|
10216
|
-
*/
|
|
10217
|
-
if (setExists && objPrototype === Set.prototype) {
|
|
10218
|
-
return 'Set';
|
|
10219
|
-
}
|
|
10220
|
-
|
|
10221
|
-
/* ! Speed optimisation
|
|
10222
|
-
* Pre:
|
|
10223
|
-
* map x 2,396,842 ops/sec ±1.59% (81 runs sampled)
|
|
10224
|
-
* Post:
|
|
10225
|
-
* map x 4,183,945 ops/sec ±6.59% (82 runs sampled)
|
|
10226
|
-
*/
|
|
10227
|
-
if (mapExists && objPrototype === Map.prototype) {
|
|
10228
|
-
return 'Map';
|
|
10229
|
-
}
|
|
10230
|
-
|
|
10231
|
-
/* ! Speed optimisation
|
|
10232
|
-
* Pre:
|
|
10233
|
-
* weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)
|
|
10234
|
-
* Post:
|
|
10235
|
-
* weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)
|
|
10236
|
-
*/
|
|
10237
|
-
if (weakSetExists && objPrototype === WeakSet.prototype) {
|
|
10238
|
-
return 'WeakSet';
|
|
10239
|
-
}
|
|
10240
|
-
|
|
10241
|
-
/* ! Speed optimisation
|
|
10242
|
-
* Pre:
|
|
10243
|
-
* weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)
|
|
10244
|
-
* Post:
|
|
10245
|
-
* weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)
|
|
10246
|
-
*/
|
|
10247
|
-
if (weakMapExists && objPrototype === WeakMap.prototype) {
|
|
10248
|
-
return 'WeakMap';
|
|
10249
|
-
}
|
|
10250
|
-
|
|
10251
|
-
/* ! Spec Conformance
|
|
10252
|
-
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)
|
|
10253
|
-
* ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView":
|
|
10254
|
-
* Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``
|
|
10255
|
-
* - Edge <=13 === "[object Object]"
|
|
10256
|
-
*/
|
|
10257
|
-
if (dataViewExists && objPrototype === DataView.prototype) {
|
|
10258
|
-
return 'DataView';
|
|
10259
|
-
}
|
|
10260
|
-
|
|
10261
|
-
/* ! Spec Conformance
|
|
10262
|
-
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)
|
|
10263
|
-
* ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator":
|
|
10264
|
-
* Test: `Object.prototype.toString.call(new Map().entries())``
|
|
10265
|
-
* - Edge <=13 === "[object Object]"
|
|
10266
|
-
*/
|
|
10267
|
-
if (mapExists && objPrototype === mapIteratorPrototype) {
|
|
10268
|
-
return 'Map Iterator';
|
|
10269
|
-
}
|
|
10270
|
-
|
|
10271
|
-
/* ! Spec Conformance
|
|
10272
|
-
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)
|
|
10273
|
-
* ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator":
|
|
10274
|
-
* Test: `Object.prototype.toString.call(new Set().entries())``
|
|
10275
|
-
* - Edge <=13 === "[object Object]"
|
|
10276
|
-
*/
|
|
10277
|
-
if (setExists && objPrototype === setIteratorPrototype) {
|
|
10278
|
-
return 'Set Iterator';
|
|
10279
|
-
}
|
|
10280
|
-
|
|
10281
|
-
/* ! Spec Conformance
|
|
10282
|
-
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)
|
|
10283
|
-
* ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator":
|
|
10284
|
-
* Test: `Object.prototype.toString.call([][Symbol.iterator]())``
|
|
10285
|
-
* - Edge <=13 === "[object Object]"
|
|
10286
|
-
*/
|
|
10287
|
-
if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
|
|
10288
|
-
return 'Array Iterator';
|
|
10289
|
-
}
|
|
10290
|
-
|
|
10291
|
-
/* ! Spec Conformance
|
|
10292
|
-
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)
|
|
10293
|
-
* ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator":
|
|
10294
|
-
* Test: `Object.prototype.toString.call(''[Symbol.iterator]())``
|
|
10295
|
-
* - Edge <=13 === "[object Object]"
|
|
10296
|
-
*/
|
|
10297
|
-
if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
|
|
10298
|
-
return 'String Iterator';
|
|
10299
|
-
}
|
|
10300
|
-
|
|
10301
|
-
/* ! Speed optimisation
|
|
10302
|
-
* Pre:
|
|
10303
|
-
* object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)
|
|
10304
|
-
* Post:
|
|
10305
|
-
* object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)
|
|
10306
|
-
*/
|
|
10307
|
-
if (objPrototype === null) {
|
|
10308
|
-
return 'Object';
|
|
10309
|
-
}
|
|
10310
|
-
|
|
10311
|
-
return Object
|
|
10312
|
-
.prototype
|
|
10313
|
-
.toString
|
|
10314
|
-
.call(obj)
|
|
10315
|
-
.slice(toStringLeftSliceLength, toStringRightSliceLength);
|
|
10316
|
-
}
|
|
10317
|
-
|
|
10318
|
-
return typeDetect;
|
|
10319
|
-
|
|
10320
|
-
})));
|
|
10321
|
-
});
|
|
10322
|
-
|
|
10323
|
-
function _slicedToArray(arr, i) {
|
|
10324
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
10325
|
-
}
|
|
10326
|
-
|
|
10327
|
-
function _arrayWithHoles(arr) {
|
|
10328
|
-
if (Array.isArray(arr)) return arr;
|
|
10329
|
-
}
|
|
10330
|
-
|
|
10331
|
-
function _iterableToArrayLimit(arr, i) {
|
|
10332
|
-
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
10333
|
-
var _arr = [];
|
|
10334
|
-
var _n = true;
|
|
10335
|
-
var _d = false;
|
|
10336
|
-
var _e = undefined;
|
|
10337
|
-
|
|
10338
|
-
try {
|
|
10339
|
-
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
10340
|
-
_arr.push(_s.value);
|
|
10341
|
-
|
|
10342
|
-
if (i && _arr.length === i) break;
|
|
10343
|
-
}
|
|
10344
|
-
} catch (err) {
|
|
10345
|
-
_d = true;
|
|
10346
|
-
_e = err;
|
|
10347
|
-
} finally {
|
|
10348
|
-
try {
|
|
10349
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
10350
|
-
} finally {
|
|
10351
|
-
if (_d) throw _e;
|
|
10352
|
-
}
|
|
10353
|
-
}
|
|
10354
|
-
|
|
10355
|
-
return _arr;
|
|
10356
|
-
}
|
|
10357
|
-
|
|
10358
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
10359
|
-
if (!o) return;
|
|
10360
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
10361
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
10362
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
10363
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
10364
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
10365
|
-
}
|
|
10366
|
-
|
|
10367
|
-
function _arrayLikeToArray(arr, len) {
|
|
10368
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
10369
|
-
|
|
10370
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
10371
|
-
|
|
10372
|
-
return arr2;
|
|
10373
|
-
}
|
|
10374
|
-
|
|
10375
|
-
function _nonIterableRest() {
|
|
10376
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
10377
|
-
}
|
|
10378
|
-
|
|
10379
|
-
var ansiColors = {
|
|
10380
|
-
bold: ['1', '22'],
|
|
10381
|
-
dim: ['2', '22'],
|
|
10382
|
-
italic: ['3', '23'],
|
|
10383
|
-
underline: ['4', '24'],
|
|
10384
|
-
// 5 & 6 are blinking
|
|
10385
|
-
inverse: ['7', '27'],
|
|
10386
|
-
hidden: ['8', '28'],
|
|
10387
|
-
strike: ['9', '29'],
|
|
10388
|
-
// 10-20 are fonts
|
|
10389
|
-
// 21-29 are resets for 1-9
|
|
10390
|
-
black: ['30', '39'],
|
|
10391
|
-
red: ['31', '39'],
|
|
10392
|
-
green: ['32', '39'],
|
|
10393
|
-
yellow: ['33', '39'],
|
|
10394
|
-
blue: ['34', '39'],
|
|
10395
|
-
magenta: ['35', '39'],
|
|
10396
|
-
cyan: ['36', '39'],
|
|
10397
|
-
white: ['37', '39'],
|
|
10398
|
-
brightblack: ['30;1', '39'],
|
|
10399
|
-
brightred: ['31;1', '39'],
|
|
10400
|
-
brightgreen: ['32;1', '39'],
|
|
10401
|
-
brightyellow: ['33;1', '39'],
|
|
10402
|
-
brightblue: ['34;1', '39'],
|
|
10403
|
-
brightmagenta: ['35;1', '39'],
|
|
10404
|
-
brightcyan: ['36;1', '39'],
|
|
10405
|
-
brightwhite: ['37;1', '39'],
|
|
10406
|
-
grey: ['90', '39']
|
|
10407
|
-
};
|
|
10408
|
-
var styles = {
|
|
10409
|
-
special: 'cyan',
|
|
10410
|
-
number: 'yellow',
|
|
10411
|
-
bigint: 'yellow',
|
|
10412
|
-
boolean: 'yellow',
|
|
10413
|
-
undefined: 'grey',
|
|
10414
|
-
null: 'bold',
|
|
10415
|
-
string: 'green',
|
|
10416
|
-
symbol: 'green',
|
|
10417
|
-
date: 'magenta',
|
|
10418
|
-
regexp: 'red'
|
|
10419
|
-
};
|
|
10420
|
-
var truncator = '…';
|
|
10421
|
-
|
|
10422
|
-
function colorise(value, styleType) {
|
|
10423
|
-
var color = ansiColors[styles[styleType]] || ansiColors[styleType];
|
|
10424
|
-
|
|
10425
|
-
if (!color) {
|
|
10426
|
-
return String(value);
|
|
10427
|
-
}
|
|
10428
|
-
|
|
10429
|
-
return "\x1B[".concat(color[0], "m").concat(String(value), "\x1B[").concat(color[1], "m");
|
|
10430
|
-
}
|
|
10431
|
-
|
|
10432
|
-
function normaliseOptions() {
|
|
10433
|
-
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
10434
|
-
_ref$showHidden = _ref.showHidden,
|
|
10435
|
-
showHidden = _ref$showHidden === void 0 ? false : _ref$showHidden,
|
|
10436
|
-
_ref$depth = _ref.depth,
|
|
10437
|
-
depth = _ref$depth === void 0 ? 2 : _ref$depth,
|
|
10438
|
-
_ref$colors = _ref.colors,
|
|
10439
|
-
colors = _ref$colors === void 0 ? false : _ref$colors,
|
|
10440
|
-
_ref$customInspect = _ref.customInspect,
|
|
10441
|
-
customInspect = _ref$customInspect === void 0 ? true : _ref$customInspect,
|
|
10442
|
-
_ref$showProxy = _ref.showProxy,
|
|
10443
|
-
showProxy = _ref$showProxy === void 0 ? false : _ref$showProxy,
|
|
10444
|
-
_ref$maxArrayLength = _ref.maxArrayLength,
|
|
10445
|
-
maxArrayLength = _ref$maxArrayLength === void 0 ? Infinity : _ref$maxArrayLength,
|
|
10446
|
-
_ref$breakLength = _ref.breakLength,
|
|
10447
|
-
breakLength = _ref$breakLength === void 0 ? Infinity : _ref$breakLength,
|
|
10448
|
-
_ref$seen = _ref.seen,
|
|
10449
|
-
seen = _ref$seen === void 0 ? [] : _ref$seen,
|
|
10450
|
-
_ref$truncate = _ref.truncate,
|
|
10451
|
-
truncate = _ref$truncate === void 0 ? Infinity : _ref$truncate,
|
|
10452
|
-
_ref$stylize = _ref.stylize,
|
|
10453
|
-
stylize = _ref$stylize === void 0 ? String : _ref$stylize;
|
|
10454
|
-
|
|
10455
|
-
var options = {
|
|
10456
|
-
showHidden: Boolean(showHidden),
|
|
10457
|
-
depth: Number(depth),
|
|
10458
|
-
colors: Boolean(colors),
|
|
10459
|
-
customInspect: Boolean(customInspect),
|
|
10460
|
-
showProxy: Boolean(showProxy),
|
|
10461
|
-
maxArrayLength: Number(maxArrayLength),
|
|
10462
|
-
breakLength: Number(breakLength),
|
|
10463
|
-
truncate: Number(truncate),
|
|
10464
|
-
seen: seen,
|
|
10465
|
-
stylize: stylize
|
|
10466
|
-
};
|
|
10467
|
-
|
|
10468
|
-
if (options.colors) {
|
|
10469
|
-
options.stylize = colorise;
|
|
10470
|
-
}
|
|
10471
|
-
|
|
10472
|
-
return options;
|
|
10473
|
-
}
|
|
10474
|
-
function truncate(string, length) {
|
|
10475
|
-
var tail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : truncator;
|
|
10476
|
-
string = String(string);
|
|
10477
|
-
var tailLength = tail.length;
|
|
10478
|
-
var stringLength = string.length;
|
|
10479
|
-
|
|
10480
|
-
if (tailLength > length && stringLength > tailLength) {
|
|
10481
|
-
return tail;
|
|
10482
|
-
}
|
|
10483
|
-
|
|
10484
|
-
if (stringLength > length && stringLength > tailLength) {
|
|
10485
|
-
return "".concat(string.slice(0, length - tailLength)).concat(tail);
|
|
10486
|
-
}
|
|
10487
|
-
|
|
10488
|
-
return string;
|
|
10489
|
-
} // eslint-disable-next-line complexity
|
|
10490
|
-
|
|
10491
|
-
function inspectList(list, options, inspectItem) {
|
|
10492
|
-
var separator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', ';
|
|
10493
|
-
inspectItem = inspectItem || options.inspect;
|
|
10494
|
-
var size = list.length;
|
|
10495
|
-
if (size === 0) return '';
|
|
10496
|
-
var originalLength = options.truncate;
|
|
10497
|
-
var output = '';
|
|
10498
|
-
var peek = '';
|
|
10499
|
-
var truncated = '';
|
|
10500
|
-
|
|
10501
|
-
for (var i = 0; i < size; i += 1) {
|
|
10502
|
-
var last = i + 1 === list.length;
|
|
10503
|
-
var secondToLast = i + 2 === list.length;
|
|
10504
|
-
truncated = "".concat(truncator, "(").concat(list.length - i, ")");
|
|
10505
|
-
var value = list[i]; // If there is more than one remaining we need to account for a separator of `, `
|
|
10506
|
-
|
|
10507
|
-
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
10508
|
-
var string = peek || inspectItem(value, options) + (last ? '' : separator);
|
|
10509
|
-
var nextLength = output.length + string.length;
|
|
10510
|
-
var truncatedLength = nextLength + truncated.length; // If this is the last element, and adding it would
|
|
10511
|
-
// take us over length, but adding the truncator wouldn't - then break now
|
|
10512
|
-
|
|
10513
|
-
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
10514
|
-
break;
|
|
10515
|
-
} // If this isn't the last or second to last element to scan,
|
|
10516
|
-
// but the string is already over length then break here
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
10520
|
-
break;
|
|
10521
|
-
} // Peek at the next string to determine if we should
|
|
10522
|
-
// break early before adding this item to the output
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
peek = last ? '' : inspectItem(list[i + 1], options) + (secondToLast ? '' : separator); // If we have one element left, but this element and
|
|
10526
|
-
// the next takes over length, the break early
|
|
10527
|
-
|
|
10528
|
-
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
10529
|
-
break;
|
|
10530
|
-
}
|
|
10531
|
-
|
|
10532
|
-
output += string; // If the next element takes us to length -
|
|
10533
|
-
// but there are more after that, then we should truncate now
|
|
10534
|
-
|
|
10535
|
-
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
10536
|
-
truncated = "".concat(truncator, "(").concat(list.length - i - 1, ")");
|
|
10537
|
-
break;
|
|
10538
|
-
}
|
|
10539
|
-
|
|
10540
|
-
truncated = '';
|
|
10541
|
-
}
|
|
10542
|
-
|
|
10543
|
-
return "".concat(output).concat(truncated);
|
|
10544
|
-
}
|
|
10545
|
-
|
|
10546
|
-
function quoteComplexKey(key) {
|
|
10547
|
-
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
10548
|
-
return key;
|
|
10549
|
-
}
|
|
10550
|
-
|
|
10551
|
-
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
10552
|
-
}
|
|
10553
|
-
|
|
10554
|
-
function inspectProperty(_ref2, options) {
|
|
10555
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
10556
|
-
key = _ref3[0],
|
|
10557
|
-
value = _ref3[1];
|
|
10558
|
-
|
|
10559
|
-
options.truncate -= 2;
|
|
10560
|
-
|
|
10561
|
-
if (typeof key === 'string') {
|
|
10562
|
-
key = quoteComplexKey(key);
|
|
10563
|
-
} else if (typeof key !== 'number') {
|
|
10564
|
-
key = "[".concat(options.inspect(key, options), "]");
|
|
10565
|
-
}
|
|
10566
|
-
|
|
10567
|
-
options.truncate -= key.length;
|
|
10568
|
-
value = options.inspect(value, options);
|
|
10569
|
-
return "".concat(key, ": ").concat(value);
|
|
10570
|
-
}
|
|
10571
|
-
|
|
10572
|
-
function inspectArray(array, options) {
|
|
10573
|
-
// Object.keys will always output the Array indices first, so we can slice by
|
|
10574
|
-
// `array.length` to get non-index properties
|
|
10575
|
-
var nonIndexProperties = Object.keys(array).slice(array.length);
|
|
10576
|
-
if (!array.length && !nonIndexProperties.length) return '[]';
|
|
10577
|
-
options.truncate -= 4;
|
|
10578
|
-
var listContents = inspectList(array, options);
|
|
10579
|
-
options.truncate -= listContents.length;
|
|
10580
|
-
var propertyContents = '';
|
|
10581
|
-
|
|
10582
|
-
if (nonIndexProperties.length) {
|
|
10583
|
-
propertyContents = inspectList(nonIndexProperties.map(function (key) {
|
|
10584
|
-
return [key, array[key]];
|
|
10585
|
-
}), options, inspectProperty);
|
|
10586
|
-
}
|
|
10587
|
-
|
|
10588
|
-
return "[ ".concat(listContents).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]");
|
|
10589
|
-
}
|
|
10590
|
-
|
|
10591
|
-
/* !
|
|
10592
|
-
* Chai - getFuncName utility
|
|
10593
|
-
* Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>
|
|
10594
|
-
* MIT Licensed
|
|
10595
|
-
*/
|
|
10596
|
-
|
|
10597
|
-
/**
|
|
10598
|
-
* ### .getFuncName(constructorFn)
|
|
10599
|
-
*
|
|
10600
|
-
* Returns the name of a function.
|
|
10601
|
-
* When a non-function instance is passed, returns `null`.
|
|
10602
|
-
* This also includes a polyfill function if `aFunc.name` is not defined.
|
|
10603
|
-
*
|
|
10604
|
-
* @name getFuncName
|
|
10605
|
-
* @param {Function} funct
|
|
10606
|
-
* @namespace Utils
|
|
10607
|
-
* @api public
|
|
10608
|
-
*/
|
|
10609
|
-
|
|
10610
|
-
var toString = Function.prototype.toString;
|
|
10611
|
-
var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
|
|
10612
|
-
function getFuncName(aFunc) {
|
|
10613
|
-
if (typeof aFunc !== 'function') {
|
|
10614
|
-
return null;
|
|
10615
|
-
}
|
|
10616
|
-
|
|
10617
|
-
var name = '';
|
|
10618
|
-
if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {
|
|
10619
|
-
// Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined
|
|
10620
|
-
var match = toString.call(aFunc).match(functionNameMatch);
|
|
10621
|
-
if (match) {
|
|
10622
|
-
name = match[1];
|
|
10623
|
-
}
|
|
10624
|
-
} else {
|
|
10625
|
-
// If we've got a `name` property we just use it
|
|
10626
|
-
name = aFunc.name;
|
|
10627
|
-
}
|
|
10628
|
-
|
|
10629
|
-
return name;
|
|
10630
|
-
}
|
|
10631
|
-
|
|
10632
|
-
var getFuncName_1 = getFuncName;
|
|
10633
|
-
|
|
10634
|
-
var getArrayName = function getArrayName(array) {
|
|
10635
|
-
// We need to special case Node.js' Buffers, which report to be Uint8Array
|
|
10636
|
-
if (typeof Buffer === 'function' && array instanceof Buffer) {
|
|
10637
|
-
return 'Buffer';
|
|
10638
|
-
}
|
|
10639
|
-
|
|
10640
|
-
if (array[Symbol.toStringTag]) {
|
|
10641
|
-
return array[Symbol.toStringTag];
|
|
10642
|
-
}
|
|
10643
|
-
|
|
10644
|
-
return getFuncName_1(array.constructor);
|
|
10645
|
-
};
|
|
10646
|
-
|
|
10647
|
-
function inspectTypedArray(array, options) {
|
|
10648
|
-
var name = getArrayName(array);
|
|
10649
|
-
options.truncate -= name.length + 4; // Object.keys will always output the Array indices first, so we can slice by
|
|
10650
|
-
// `array.length` to get non-index properties
|
|
10651
|
-
|
|
10652
|
-
var nonIndexProperties = Object.keys(array).slice(array.length);
|
|
10653
|
-
if (!array.length && !nonIndexProperties.length) return "".concat(name, "[]"); // As we know TypedArrays only contain Unsigned Integers, we can skip inspecting each one and simply
|
|
10654
|
-
// stylise the toString() value of them
|
|
10655
|
-
|
|
10656
|
-
var output = '';
|
|
10657
|
-
|
|
10658
|
-
for (var i = 0; i < array.length; i++) {
|
|
10659
|
-
var string = "".concat(options.stylize(truncate(array[i], options.truncate), 'number')).concat(i === array.length - 1 ? '' : ', ');
|
|
10660
|
-
options.truncate -= string.length;
|
|
10661
|
-
|
|
10662
|
-
if (array[i] !== array.length && options.truncate <= 3) {
|
|
10663
|
-
output += "".concat(truncator, "(").concat(array.length - array[i] + 1, ")");
|
|
10664
|
-
break;
|
|
10665
|
-
}
|
|
10666
|
-
|
|
10667
|
-
output += string;
|
|
10668
|
-
}
|
|
10669
|
-
|
|
10670
|
-
var propertyContents = '';
|
|
10671
|
-
|
|
10672
|
-
if (nonIndexProperties.length) {
|
|
10673
|
-
propertyContents = inspectList(nonIndexProperties.map(function (key) {
|
|
10674
|
-
return [key, array[key]];
|
|
10675
|
-
}), options, inspectProperty);
|
|
10676
|
-
}
|
|
10677
|
-
|
|
10678
|
-
return "".concat(name, "[ ").concat(output).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]");
|
|
10679
|
-
}
|
|
10680
|
-
|
|
10681
|
-
function inspectDate(dateObject, options) {
|
|
10682
|
-
// If we need to - truncate the time portion, but never the date
|
|
10683
|
-
var split = dateObject.toJSON().split('T');
|
|
10684
|
-
var date = split[0];
|
|
10685
|
-
return options.stylize("".concat(date, "T").concat(truncate(split[1], options.truncate - date.length - 1)), 'date');
|
|
10686
|
-
}
|
|
10687
|
-
|
|
10688
|
-
function inspectFunction(func, options) {
|
|
10689
|
-
var name = getFuncName_1(func);
|
|
10690
|
-
|
|
10691
|
-
if (!name) {
|
|
10692
|
-
return options.stylize('[Function]', 'special');
|
|
10693
|
-
}
|
|
10694
|
-
|
|
10695
|
-
return options.stylize("[Function ".concat(truncate(name, options.truncate - 11), "]"), 'special');
|
|
10696
|
-
}
|
|
10697
|
-
|
|
10698
|
-
function inspectMapEntry(_ref, options) {
|
|
10699
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
10700
|
-
key = _ref2[0],
|
|
10701
|
-
value = _ref2[1];
|
|
10702
|
-
|
|
10703
|
-
options.truncate -= 4;
|
|
10704
|
-
key = options.inspect(key, options);
|
|
10705
|
-
options.truncate -= key.length;
|
|
10706
|
-
value = options.inspect(value, options);
|
|
10707
|
-
return "".concat(key, " => ").concat(value);
|
|
10708
|
-
} // IE11 doesn't support `map.entries()`
|
|
10709
|
-
|
|
10710
|
-
|
|
10711
|
-
function mapToEntries(map) {
|
|
10712
|
-
var entries = [];
|
|
10713
|
-
map.forEach(function (value, key) {
|
|
10714
|
-
entries.push([key, value]);
|
|
10715
|
-
});
|
|
10716
|
-
return entries;
|
|
10717
|
-
}
|
|
10718
|
-
|
|
10719
|
-
function inspectMap(map, options) {
|
|
10720
|
-
var size = map.size - 1;
|
|
10721
|
-
|
|
10722
|
-
if (size <= 0) {
|
|
10723
|
-
return 'Map{}';
|
|
10724
|
-
}
|
|
10725
|
-
|
|
10726
|
-
options.truncate -= 7;
|
|
10727
|
-
return "Map{ ".concat(inspectList(mapToEntries(map), options, inspectMapEntry), " }");
|
|
10728
|
-
}
|
|
10729
|
-
|
|
10730
|
-
var isNaN = Number.isNaN || function (i) {
|
|
10731
|
-
return i !== i;
|
|
10732
|
-
}; // eslint-disable-line no-self-compare
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
function inspectNumber(number, options) {
|
|
10736
|
-
if (isNaN(number)) {
|
|
10737
|
-
return options.stylize('NaN', 'number');
|
|
10738
|
-
}
|
|
10739
|
-
|
|
10740
|
-
if (number === Infinity) {
|
|
10741
|
-
return options.stylize('Infinity', 'number');
|
|
10742
|
-
}
|
|
10743
|
-
|
|
10744
|
-
if (number === -Infinity) {
|
|
10745
|
-
return options.stylize('-Infinity', 'number');
|
|
10746
|
-
}
|
|
10747
|
-
|
|
10748
|
-
if (number === 0) {
|
|
10749
|
-
return options.stylize(1 / number === Infinity ? '+0' : '-0', 'number');
|
|
10750
|
-
}
|
|
10751
|
-
|
|
10752
|
-
return options.stylize(truncate(number, options.truncate), 'number');
|
|
10753
|
-
}
|
|
10754
|
-
|
|
10755
|
-
function inspectBigInt(number, options) {
|
|
10756
|
-
var nums = truncate(number.toString(), options.truncate - 1);
|
|
10757
|
-
if (nums !== truncator) nums += 'n';
|
|
10758
|
-
return options.stylize(nums, 'bigint');
|
|
10759
|
-
}
|
|
10760
|
-
|
|
10761
|
-
function inspectRegExp(value, options) {
|
|
10762
|
-
var flags = value.toString().split('/')[2];
|
|
10763
|
-
var sourceLength = options.truncate - (2 + flags.length);
|
|
10764
|
-
var source = value.source;
|
|
10765
|
-
return options.stylize("/".concat(truncate(source, sourceLength), "/").concat(flags), 'regexp');
|
|
10766
|
-
}
|
|
10767
|
-
|
|
10768
|
-
function arrayFromSet(set) {
|
|
10769
|
-
var values = [];
|
|
10770
|
-
set.forEach(function (value) {
|
|
10771
|
-
values.push(value);
|
|
10772
|
-
});
|
|
10773
|
-
return values;
|
|
10774
|
-
}
|
|
10775
|
-
|
|
10776
|
-
function inspectSet(set, options) {
|
|
10777
|
-
if (set.size === 0) return 'Set{}';
|
|
10778
|
-
options.truncate -= 7;
|
|
10779
|
-
return "Set{ ".concat(inspectList(arrayFromSet(set), options), " }");
|
|
10780
|
-
}
|
|
10781
|
-
|
|
10782
|
-
var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" + "\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", 'g');
|
|
10783
|
-
var escapeCharacters = {
|
|
10784
|
-
'\b': '\\b',
|
|
10785
|
-
'\t': '\\t',
|
|
10786
|
-
'\n': '\\n',
|
|
10787
|
-
'\f': '\\f',
|
|
10788
|
-
'\r': '\\r',
|
|
10789
|
-
"'": "\\'",
|
|
10790
|
-
'\\': '\\\\'
|
|
10791
|
-
};
|
|
10792
|
-
var hex = 16;
|
|
10793
|
-
var unicodeLength = 4;
|
|
10794
|
-
|
|
10795
|
-
function escape(char) {
|
|
10796
|
-
return escapeCharacters[char] || "\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength));
|
|
10797
|
-
}
|
|
10798
|
-
|
|
10799
|
-
function inspectString(string, options) {
|
|
10800
|
-
if (stringEscapeChars.test(string)) {
|
|
10801
|
-
string = string.replace(stringEscapeChars, escape);
|
|
10802
|
-
}
|
|
10803
|
-
|
|
10804
|
-
return options.stylize("'".concat(truncate(string, options.truncate - 2), "'"), 'string');
|
|
10805
|
-
}
|
|
10806
|
-
|
|
10807
|
-
function inspectSymbol(value) {
|
|
10808
|
-
if ('description' in Symbol.prototype) {
|
|
10809
|
-
return value.description ? "Symbol(".concat(value.description, ")") : 'Symbol()';
|
|
10810
|
-
}
|
|
10811
|
-
|
|
10812
|
-
return value.toString();
|
|
10813
|
-
}
|
|
10814
|
-
|
|
10815
|
-
var getPromiseValue = function getPromiseValue() {
|
|
10816
|
-
return 'Promise{…}';
|
|
10817
|
-
};
|
|
10818
|
-
|
|
10819
|
-
try {
|
|
10820
|
-
var _process$binding = process.binding('util'),
|
|
10821
|
-
getPromiseDetails = _process$binding.getPromiseDetails,
|
|
10822
|
-
kPending = _process$binding.kPending,
|
|
10823
|
-
kRejected = _process$binding.kRejected;
|
|
10824
|
-
|
|
10825
|
-
getPromiseValue = function getPromiseValue(value, options) {
|
|
10826
|
-
var _getPromiseDetails = getPromiseDetails(value),
|
|
10827
|
-
_getPromiseDetails2 = _slicedToArray(_getPromiseDetails, 2),
|
|
10828
|
-
state = _getPromiseDetails2[0],
|
|
10829
|
-
innerValue = _getPromiseDetails2[1];
|
|
10830
|
-
|
|
10831
|
-
if (state === kPending) {
|
|
10832
|
-
return 'Promise{<pending>}';
|
|
10833
|
-
}
|
|
10834
|
-
|
|
10835
|
-
return "Promise".concat(state === kRejected ? '!' : '', "{").concat(options.inspect(innerValue, options), "}");
|
|
10836
|
-
};
|
|
10837
|
-
} catch (notNode) {
|
|
10838
|
-
/* ignore */
|
|
10839
|
-
}
|
|
10840
|
-
|
|
10841
|
-
var inspectPromise = getPromiseValue;
|
|
10842
|
-
|
|
10843
|
-
function inspectObject(object, options) {
|
|
10844
|
-
var properties = Object.getOwnPropertyNames(object);
|
|
10845
|
-
var symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
|
10846
|
-
|
|
10847
|
-
if (properties.length === 0 && symbols.length === 0) {
|
|
10848
|
-
return '{}';
|
|
10849
|
-
}
|
|
10850
|
-
|
|
10851
|
-
options.truncate -= 4;
|
|
10852
|
-
options.seen = options.seen || [];
|
|
10853
|
-
|
|
10854
|
-
if (options.seen.indexOf(object) >= 0) {
|
|
10855
|
-
return '[Circular]';
|
|
10856
|
-
}
|
|
10857
|
-
|
|
10858
|
-
options.seen.push(object);
|
|
10859
|
-
var propertyContents = inspectList(properties.map(function (key) {
|
|
10860
|
-
return [key, object[key]];
|
|
10861
|
-
}), options, inspectProperty);
|
|
10862
|
-
var symbolContents = inspectList(symbols.map(function (key) {
|
|
10863
|
-
return [key, object[key]];
|
|
10864
|
-
}), options, inspectProperty);
|
|
10865
|
-
options.seen.pop();
|
|
10866
|
-
var sep = '';
|
|
10867
|
-
|
|
10868
|
-
if (propertyContents && symbolContents) {
|
|
10869
|
-
sep = ', ';
|
|
10870
|
-
}
|
|
10871
|
-
|
|
10872
|
-
return "{ ".concat(propertyContents).concat(sep).concat(symbolContents, " }");
|
|
10873
|
-
}
|
|
10874
|
-
|
|
10875
|
-
var toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
10876
|
-
function inspectClass(value, options) {
|
|
10877
|
-
var name = '';
|
|
10878
|
-
|
|
10879
|
-
if (toStringTag && toStringTag in value) {
|
|
10880
|
-
name = value[toStringTag];
|
|
10881
|
-
}
|
|
10882
|
-
|
|
10883
|
-
name = name || getFuncName_1(value.constructor); // Babel transforms anonymous classes to the name `_class`
|
|
10884
|
-
|
|
10885
|
-
if (!name || name === '_class') {
|
|
10886
|
-
name = '<Anonymous Class>';
|
|
10887
|
-
}
|
|
10888
|
-
|
|
10889
|
-
options.truncate -= name.length;
|
|
10890
|
-
return "".concat(name).concat(inspectObject(value, options));
|
|
10891
|
-
}
|
|
10892
|
-
|
|
10893
|
-
function inspectArguments(args, options) {
|
|
10894
|
-
if (args.length === 0) return 'Arguments[]';
|
|
10895
|
-
options.truncate -= 13;
|
|
10896
|
-
return "Arguments[ ".concat(inspectList(args, options), " ]");
|
|
10897
|
-
}
|
|
10898
|
-
|
|
10899
|
-
var errorKeys = ['stack', 'line', 'column', 'name', 'message', 'fileName', 'lineNumber', 'columnNumber', 'number', 'description'];
|
|
10900
|
-
function inspectObject$1(error, options) {
|
|
10901
|
-
var properties = Object.getOwnPropertyNames(error).filter(function (key) {
|
|
10902
|
-
return errorKeys.indexOf(key) === -1;
|
|
10903
|
-
});
|
|
10904
|
-
var name = error.name;
|
|
10905
|
-
options.truncate -= name.length;
|
|
10906
|
-
var message = '';
|
|
10907
|
-
|
|
10908
|
-
if (typeof error.message === 'string') {
|
|
10909
|
-
message = truncate(error.message, options.truncate);
|
|
10910
|
-
} else {
|
|
10911
|
-
properties.unshift('message');
|
|
10912
|
-
}
|
|
10913
|
-
|
|
10914
|
-
message = message ? ": ".concat(message) : '';
|
|
10915
|
-
options.truncate -= message.length + 5;
|
|
10916
|
-
var propertyContents = inspectList(properties.map(function (key) {
|
|
10917
|
-
return [key, error[key]];
|
|
10918
|
-
}), options, inspectProperty);
|
|
10919
|
-
return "".concat(name).concat(message).concat(propertyContents ? " { ".concat(propertyContents, " }") : '');
|
|
10920
|
-
}
|
|
10921
|
-
|
|
10922
|
-
function inspectAttribute(_ref, options) {
|
|
10923
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
10924
|
-
key = _ref2[0],
|
|
10925
|
-
value = _ref2[1];
|
|
10926
|
-
|
|
10927
|
-
options.truncate -= 3;
|
|
10928
|
-
|
|
10929
|
-
if (!value) {
|
|
10930
|
-
return "".concat(options.stylize(key, 'yellow'));
|
|
10931
|
-
}
|
|
10932
|
-
|
|
10933
|
-
return "".concat(options.stylize(key, 'yellow'), "=").concat(options.stylize("\"".concat(value, "\""), 'string'));
|
|
10934
|
-
}
|
|
10935
|
-
function inspectHTMLCollection(collection, options) {
|
|
10936
|
-
// eslint-disable-next-line no-use-before-define
|
|
10937
|
-
return inspectList(collection, options, inspectHTML, '\n');
|
|
10938
|
-
}
|
|
10939
|
-
function inspectHTML(element, options) {
|
|
10940
|
-
var properties = element.getAttributeNames();
|
|
10941
|
-
var name = element.tagName.toLowerCase();
|
|
10942
|
-
var head = options.stylize("<".concat(name), 'special');
|
|
10943
|
-
var headClose = options.stylize(">", 'special');
|
|
10944
|
-
var tail = options.stylize("</".concat(name, ">"), 'special');
|
|
10945
|
-
options.truncate -= name.length * 2 + 5;
|
|
10946
|
-
var propertyContents = '';
|
|
10947
|
-
|
|
10948
|
-
if (properties.length > 0) {
|
|
10949
|
-
propertyContents += ' ';
|
|
10950
|
-
propertyContents += inspectList(properties.map(function (key) {
|
|
10951
|
-
return [key, element.getAttribute(key)];
|
|
10952
|
-
}), options, inspectAttribute, ' ');
|
|
10953
|
-
}
|
|
10954
|
-
|
|
10955
|
-
options.truncate -= propertyContents.length;
|
|
10956
|
-
var truncate = options.truncate;
|
|
10957
|
-
var children = inspectHTMLCollection(element.children, options);
|
|
10958
|
-
|
|
10959
|
-
if (children && children.length > truncate) {
|
|
10960
|
-
children = "".concat(truncator, "(").concat(element.children.length, ")");
|
|
10961
|
-
}
|
|
10962
|
-
|
|
10963
|
-
return "".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail);
|
|
10964
|
-
}
|
|
10965
|
-
|
|
10966
|
-
/* !
|
|
10967
|
-
* loupe
|
|
10968
|
-
* Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
|
|
10969
|
-
* MIT Licensed
|
|
10970
|
-
*/
|
|
10971
|
-
var symbolsSupported = typeof Symbol === 'function' && typeof Symbol.for === 'function';
|
|
10972
|
-
var chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/inspect';
|
|
10973
|
-
var nodeInspect = false;
|
|
10974
|
-
|
|
10975
|
-
try {
|
|
10976
|
-
// eslint-disable-next-line global-require
|
|
10977
|
-
nodeInspect = require('util').inspect.custom;
|
|
10978
|
-
} catch (noNodeInspect) {
|
|
10979
|
-
nodeInspect = false;
|
|
10980
|
-
}
|
|
10981
|
-
|
|
10982
|
-
var constructorMap = new WeakMap();
|
|
10983
|
-
var stringTagMap = {};
|
|
10984
|
-
var baseTypesMap = {
|
|
10985
|
-
undefined: function undefined$1(value, options) {
|
|
10986
|
-
return options.stylize('undefined', 'undefined');
|
|
10987
|
-
},
|
|
10988
|
-
null: function _null(value, options) {
|
|
10989
|
-
return options.stylize(null, 'null');
|
|
10990
|
-
},
|
|
10991
|
-
boolean: function boolean(value, options) {
|
|
10992
|
-
return options.stylize(value, 'boolean');
|
|
10993
|
-
},
|
|
10994
|
-
Boolean: function Boolean(value, options) {
|
|
10995
|
-
return options.stylize(value, 'boolean');
|
|
10996
|
-
},
|
|
10997
|
-
number: inspectNumber,
|
|
10998
|
-
Number: inspectNumber,
|
|
10999
|
-
bigint: inspectBigInt,
|
|
11000
|
-
BigInt: inspectBigInt,
|
|
11001
|
-
string: inspectString,
|
|
11002
|
-
String: inspectString,
|
|
11003
|
-
function: inspectFunction,
|
|
11004
|
-
Function: inspectFunction,
|
|
11005
|
-
symbol: inspectSymbol,
|
|
11006
|
-
// A Symbol polyfill will return `Symbol` not `symbol` from typedetect
|
|
11007
|
-
Symbol: inspectSymbol,
|
|
11008
|
-
Array: inspectArray,
|
|
11009
|
-
Date: inspectDate,
|
|
11010
|
-
Map: inspectMap,
|
|
11011
|
-
Set: inspectSet,
|
|
11012
|
-
RegExp: inspectRegExp,
|
|
11013
|
-
Promise: inspectPromise,
|
|
11014
|
-
// WeakSet, WeakMap are totally opaque to us
|
|
11015
|
-
WeakSet: function WeakSet(value, options) {
|
|
11016
|
-
return options.stylize('WeakSet{…}', 'special');
|
|
11017
|
-
},
|
|
11018
|
-
WeakMap: function WeakMap(value, options) {
|
|
11019
|
-
return options.stylize('WeakMap{…}', 'special');
|
|
11020
|
-
},
|
|
11021
|
-
Arguments: inspectArguments,
|
|
11022
|
-
Int8Array: inspectTypedArray,
|
|
11023
|
-
Uint8Array: inspectTypedArray,
|
|
11024
|
-
Uint8ClampedArray: inspectTypedArray,
|
|
11025
|
-
Int16Array: inspectTypedArray,
|
|
11026
|
-
Uint16Array: inspectTypedArray,
|
|
11027
|
-
Int32Array: inspectTypedArray,
|
|
11028
|
-
Uint32Array: inspectTypedArray,
|
|
11029
|
-
Float32Array: inspectTypedArray,
|
|
11030
|
-
Float64Array: inspectTypedArray,
|
|
11031
|
-
Generator: function Generator() {
|
|
11032
|
-
return '';
|
|
11033
|
-
},
|
|
11034
|
-
DataView: function DataView() {
|
|
11035
|
-
return '';
|
|
11036
|
-
},
|
|
11037
|
-
ArrayBuffer: function ArrayBuffer() {
|
|
11038
|
-
return '';
|
|
11039
|
-
},
|
|
11040
|
-
Error: inspectObject$1,
|
|
11041
|
-
HTMLCollection: inspectHTMLCollection,
|
|
11042
|
-
NodeList: inspectHTMLCollection
|
|
11043
|
-
}; // eslint-disable-next-line complexity
|
|
11044
|
-
|
|
11045
|
-
var inspectCustom = function inspectCustom(value, options, type) {
|
|
11046
|
-
if (chaiInspect in value && typeof value[chaiInspect] === 'function') {
|
|
11047
|
-
return value[chaiInspect](options);
|
|
11048
|
-
}
|
|
11049
|
-
|
|
11050
|
-
if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === 'function') {
|
|
11051
|
-
return value[nodeInspect](options.depth, options);
|
|
11052
|
-
}
|
|
11053
|
-
|
|
11054
|
-
if ('inspect' in value && typeof value.inspect === 'function') {
|
|
11055
|
-
return value.inspect(options.depth, options);
|
|
11056
|
-
}
|
|
11057
|
-
|
|
11058
|
-
if ('constructor' in value && constructorMap.has(value.constructor)) {
|
|
11059
|
-
return constructorMap.get(value.constructor)(value, options);
|
|
11060
|
-
}
|
|
11061
|
-
|
|
11062
|
-
if (stringTagMap[type]) {
|
|
11063
|
-
return stringTagMap[type](value, options);
|
|
11064
|
-
}
|
|
11065
|
-
|
|
11066
|
-
return '';
|
|
11067
|
-
}; // eslint-disable-next-line complexity
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
function inspect(value, options) {
|
|
11071
|
-
options = normaliseOptions(options);
|
|
11072
|
-
options.inspect = inspect;
|
|
11073
|
-
var _options = options,
|
|
11074
|
-
customInspect = _options.customInspect;
|
|
11075
|
-
var type = typeDetect(value); // If it is a base value that we already support, then use Loupe's inspector
|
|
11076
|
-
|
|
11077
|
-
if (baseTypesMap[type]) {
|
|
11078
|
-
return baseTypesMap[type](value, options);
|
|
11079
|
-
} // If `options.customInspect` is set to true then try to use the custom inspector
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
if (customInspect && value) {
|
|
11083
|
-
var output = inspectCustom(value, options, type);
|
|
11084
|
-
|
|
11085
|
-
if (output) {
|
|
11086
|
-
if (typeof output === 'string') return output;
|
|
11087
|
-
return inspect(output, options);
|
|
11088
|
-
}
|
|
11089
|
-
}
|
|
11090
|
-
|
|
11091
|
-
var proto = value ? Object.getPrototypeOf(value) : false; // If it's a plain Object then use Loupe's inspector
|
|
11092
|
-
|
|
11093
|
-
if (proto === Object.prototype || proto === null) {
|
|
11094
|
-
return inspectObject(value, options);
|
|
11095
|
-
} // Specifically account for HTMLElements
|
|
11096
|
-
// eslint-disable-next-line no-undef
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
if (value && typeof HTMLElement === 'function' && value instanceof HTMLElement) {
|
|
11100
|
-
return inspectHTML(value, options);
|
|
11101
|
-
}
|
|
11102
|
-
|
|
11103
|
-
if ('constructor' in value) {
|
|
11104
|
-
// If it is a class, inspect it like an object but add the constructor name
|
|
11105
|
-
if (value.constructor !== Object) {
|
|
11106
|
-
return inspectClass(value, options);
|
|
11107
|
-
} // If it is an object with an anonymous prototype, display it as an object.
|
|
11108
|
-
|
|
11109
|
-
|
|
11110
|
-
return inspectObject(value, options);
|
|
11111
|
-
} // We have run out of options! Just stringify the value
|
|
11112
|
-
|
|
11113
|
-
|
|
11114
|
-
return options.stylize(String(value), type);
|
|
11115
|
-
}
|
|
11116
|
-
function registerConstructor(constructor, inspector) {
|
|
11117
|
-
if (constructorMap.has(constructor)) {
|
|
11118
|
-
return false;
|
|
11119
|
-
}
|
|
11120
|
-
|
|
11121
|
-
constructorMap.add(constructor, inspector);
|
|
11122
|
-
return true;
|
|
11123
|
-
}
|
|
11124
|
-
function registerStringTag(stringTag, inspector) {
|
|
11125
|
-
if (stringTag in stringTagMap) {
|
|
11126
|
-
return false;
|
|
11127
|
-
}
|
|
11128
|
-
|
|
11129
|
-
stringTagMap[stringTag] = inspector;
|
|
11130
|
-
return true;
|
|
11131
|
-
}
|
|
11132
|
-
var custom = chaiInspect;
|
|
11133
|
-
|
|
11134
|
-
exports.custom = custom;
|
|
11135
|
-
exports.default = inspect;
|
|
11136
|
-
exports.inspect = inspect;
|
|
11137
|
-
exports.registerConstructor = registerConstructor;
|
|
11138
|
-
exports.registerStringTag = registerStringTag;
|
|
9928
|
+
function _typeof(obj) {
|
|
9929
|
+
"@babel/helpers - typeof";
|
|
11139
9930
|
|
|
11140
|
-
|
|
9931
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
9932
|
+
_typeof = function (obj) {
|
|
9933
|
+
return typeof obj;
|
|
9934
|
+
};
|
|
9935
|
+
} else {
|
|
9936
|
+
_typeof = function (obj) {
|
|
9937
|
+
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
9938
|
+
};
|
|
9939
|
+
}
|
|
9940
|
+
|
|
9941
|
+
return _typeof(obj);
|
|
9942
|
+
}
|
|
9943
|
+
|
|
9944
|
+
function _slicedToArray(arr, i) {
|
|
9945
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
9946
|
+
}
|
|
9947
|
+
|
|
9948
|
+
function _arrayWithHoles(arr) {
|
|
9949
|
+
if (Array.isArray(arr)) return arr;
|
|
9950
|
+
}
|
|
9951
|
+
|
|
9952
|
+
function _iterableToArrayLimit(arr, i) {
|
|
9953
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
9954
|
+
var _arr = [];
|
|
9955
|
+
var _n = true;
|
|
9956
|
+
var _d = false;
|
|
9957
|
+
var _e = undefined;
|
|
9958
|
+
|
|
9959
|
+
try {
|
|
9960
|
+
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
|
|
9961
|
+
_arr.push(_s.value);
|
|
9962
|
+
|
|
9963
|
+
if (i && _arr.length === i) break;
|
|
9964
|
+
}
|
|
9965
|
+
} catch (err) {
|
|
9966
|
+
_d = true;
|
|
9967
|
+
_e = err;
|
|
9968
|
+
} finally {
|
|
9969
|
+
try {
|
|
9970
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
9971
|
+
} finally {
|
|
9972
|
+
if (_d) throw _e;
|
|
9973
|
+
}
|
|
9974
|
+
}
|
|
9975
|
+
|
|
9976
|
+
return _arr;
|
|
9977
|
+
}
|
|
9978
|
+
|
|
9979
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
9980
|
+
if (!o) return;
|
|
9981
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
9982
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
9983
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
9984
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
9985
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
9986
|
+
}
|
|
9987
|
+
|
|
9988
|
+
function _arrayLikeToArray(arr, len) {
|
|
9989
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
9990
|
+
|
|
9991
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
9992
|
+
|
|
9993
|
+
return arr2;
|
|
9994
|
+
}
|
|
9995
|
+
|
|
9996
|
+
function _nonIterableRest() {
|
|
9997
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
9998
|
+
}
|
|
9999
|
+
|
|
10000
|
+
var ansiColors = {
|
|
10001
|
+
bold: ['1', '22'],
|
|
10002
|
+
dim: ['2', '22'],
|
|
10003
|
+
italic: ['3', '23'],
|
|
10004
|
+
underline: ['4', '24'],
|
|
10005
|
+
// 5 & 6 are blinking
|
|
10006
|
+
inverse: ['7', '27'],
|
|
10007
|
+
hidden: ['8', '28'],
|
|
10008
|
+
strike: ['9', '29'],
|
|
10009
|
+
// 10-20 are fonts
|
|
10010
|
+
// 21-29 are resets for 1-9
|
|
10011
|
+
black: ['30', '39'],
|
|
10012
|
+
red: ['31', '39'],
|
|
10013
|
+
green: ['32', '39'],
|
|
10014
|
+
yellow: ['33', '39'],
|
|
10015
|
+
blue: ['34', '39'],
|
|
10016
|
+
magenta: ['35', '39'],
|
|
10017
|
+
cyan: ['36', '39'],
|
|
10018
|
+
white: ['37', '39'],
|
|
10019
|
+
brightblack: ['30;1', '39'],
|
|
10020
|
+
brightred: ['31;1', '39'],
|
|
10021
|
+
brightgreen: ['32;1', '39'],
|
|
10022
|
+
brightyellow: ['33;1', '39'],
|
|
10023
|
+
brightblue: ['34;1', '39'],
|
|
10024
|
+
brightmagenta: ['35;1', '39'],
|
|
10025
|
+
brightcyan: ['36;1', '39'],
|
|
10026
|
+
brightwhite: ['37;1', '39'],
|
|
10027
|
+
grey: ['90', '39']
|
|
10028
|
+
};
|
|
10029
|
+
var styles = {
|
|
10030
|
+
special: 'cyan',
|
|
10031
|
+
number: 'yellow',
|
|
10032
|
+
bigint: 'yellow',
|
|
10033
|
+
boolean: 'yellow',
|
|
10034
|
+
undefined: 'grey',
|
|
10035
|
+
null: 'bold',
|
|
10036
|
+
string: 'green',
|
|
10037
|
+
symbol: 'green',
|
|
10038
|
+
date: 'magenta',
|
|
10039
|
+
regexp: 'red'
|
|
10040
|
+
};
|
|
10041
|
+
var truncator = '…';
|
|
10042
|
+
|
|
10043
|
+
function colorise(value, styleType) {
|
|
10044
|
+
var color = ansiColors[styles[styleType]] || ansiColors[styleType];
|
|
10045
|
+
|
|
10046
|
+
if (!color) {
|
|
10047
|
+
return String(value);
|
|
10048
|
+
}
|
|
10049
|
+
|
|
10050
|
+
return "\x1B[".concat(color[0], "m").concat(String(value), "\x1B[").concat(color[1], "m");
|
|
10051
|
+
}
|
|
10052
|
+
|
|
10053
|
+
function normaliseOptions() {
|
|
10054
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
10055
|
+
_ref$showHidden = _ref.showHidden,
|
|
10056
|
+
showHidden = _ref$showHidden === void 0 ? false : _ref$showHidden,
|
|
10057
|
+
_ref$depth = _ref.depth,
|
|
10058
|
+
depth = _ref$depth === void 0 ? 2 : _ref$depth,
|
|
10059
|
+
_ref$colors = _ref.colors,
|
|
10060
|
+
colors = _ref$colors === void 0 ? false : _ref$colors,
|
|
10061
|
+
_ref$customInspect = _ref.customInspect,
|
|
10062
|
+
customInspect = _ref$customInspect === void 0 ? true : _ref$customInspect,
|
|
10063
|
+
_ref$showProxy = _ref.showProxy,
|
|
10064
|
+
showProxy = _ref$showProxy === void 0 ? false : _ref$showProxy,
|
|
10065
|
+
_ref$maxArrayLength = _ref.maxArrayLength,
|
|
10066
|
+
maxArrayLength = _ref$maxArrayLength === void 0 ? Infinity : _ref$maxArrayLength,
|
|
10067
|
+
_ref$breakLength = _ref.breakLength,
|
|
10068
|
+
breakLength = _ref$breakLength === void 0 ? Infinity : _ref$breakLength,
|
|
10069
|
+
_ref$seen = _ref.seen,
|
|
10070
|
+
seen = _ref$seen === void 0 ? [] : _ref$seen,
|
|
10071
|
+
_ref$truncate = _ref.truncate,
|
|
10072
|
+
truncate = _ref$truncate === void 0 ? Infinity : _ref$truncate,
|
|
10073
|
+
_ref$stylize = _ref.stylize,
|
|
10074
|
+
stylize = _ref$stylize === void 0 ? String : _ref$stylize;
|
|
10075
|
+
|
|
10076
|
+
var options = {
|
|
10077
|
+
showHidden: Boolean(showHidden),
|
|
10078
|
+
depth: Number(depth),
|
|
10079
|
+
colors: Boolean(colors),
|
|
10080
|
+
customInspect: Boolean(customInspect),
|
|
10081
|
+
showProxy: Boolean(showProxy),
|
|
10082
|
+
maxArrayLength: Number(maxArrayLength),
|
|
10083
|
+
breakLength: Number(breakLength),
|
|
10084
|
+
truncate: Number(truncate),
|
|
10085
|
+
seen: seen,
|
|
10086
|
+
stylize: stylize
|
|
10087
|
+
};
|
|
10088
|
+
|
|
10089
|
+
if (options.colors) {
|
|
10090
|
+
options.stylize = colorise;
|
|
10091
|
+
}
|
|
10092
|
+
|
|
10093
|
+
return options;
|
|
10094
|
+
}
|
|
10095
|
+
function truncate(string, length) {
|
|
10096
|
+
var tail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : truncator;
|
|
10097
|
+
string = String(string);
|
|
10098
|
+
var tailLength = tail.length;
|
|
10099
|
+
var stringLength = string.length;
|
|
10100
|
+
|
|
10101
|
+
if (tailLength > length && stringLength > tailLength) {
|
|
10102
|
+
return tail;
|
|
10103
|
+
}
|
|
10104
|
+
|
|
10105
|
+
if (stringLength > length && stringLength > tailLength) {
|
|
10106
|
+
return "".concat(string.slice(0, length - tailLength)).concat(tail);
|
|
10107
|
+
}
|
|
10108
|
+
|
|
10109
|
+
return string;
|
|
10110
|
+
} // eslint-disable-next-line complexity
|
|
10111
|
+
|
|
10112
|
+
function inspectList(list, options, inspectItem) {
|
|
10113
|
+
var separator = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ', ';
|
|
10114
|
+
inspectItem = inspectItem || options.inspect;
|
|
10115
|
+
var size = list.length;
|
|
10116
|
+
if (size === 0) return '';
|
|
10117
|
+
var originalLength = options.truncate;
|
|
10118
|
+
var output = '';
|
|
10119
|
+
var peek = '';
|
|
10120
|
+
var truncated = '';
|
|
10121
|
+
|
|
10122
|
+
for (var i = 0; i < size; i += 1) {
|
|
10123
|
+
var last = i + 1 === list.length;
|
|
10124
|
+
var secondToLast = i + 2 === list.length;
|
|
10125
|
+
truncated = "".concat(truncator, "(").concat(list.length - i, ")");
|
|
10126
|
+
var value = list[i]; // If there is more than one remaining we need to account for a separator of `, `
|
|
10127
|
+
|
|
10128
|
+
options.truncate = originalLength - output.length - (last ? 0 : separator.length);
|
|
10129
|
+
var string = peek || inspectItem(value, options) + (last ? '' : separator);
|
|
10130
|
+
var nextLength = output.length + string.length;
|
|
10131
|
+
var truncatedLength = nextLength + truncated.length; // If this is the last element, and adding it would
|
|
10132
|
+
// take us over length, but adding the truncator wouldn't - then break now
|
|
10133
|
+
|
|
10134
|
+
if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) {
|
|
10135
|
+
break;
|
|
10136
|
+
} // If this isn't the last or second to last element to scan,
|
|
10137
|
+
// but the string is already over length then break here
|
|
10138
|
+
|
|
10139
|
+
|
|
10140
|
+
if (!last && !secondToLast && truncatedLength > originalLength) {
|
|
10141
|
+
break;
|
|
10142
|
+
} // Peek at the next string to determine if we should
|
|
10143
|
+
// break early before adding this item to the output
|
|
10144
|
+
|
|
10145
|
+
|
|
10146
|
+
peek = last ? '' : inspectItem(list[i + 1], options) + (secondToLast ? '' : separator); // If we have one element left, but this element and
|
|
10147
|
+
// the next takes over length, the break early
|
|
10148
|
+
|
|
10149
|
+
if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) {
|
|
10150
|
+
break;
|
|
10151
|
+
}
|
|
10152
|
+
|
|
10153
|
+
output += string; // If the next element takes us to length -
|
|
10154
|
+
// but there are more after that, then we should truncate now
|
|
10155
|
+
|
|
10156
|
+
if (!last && !secondToLast && nextLength + peek.length >= originalLength) {
|
|
10157
|
+
truncated = "".concat(truncator, "(").concat(list.length - i - 1, ")");
|
|
10158
|
+
break;
|
|
10159
|
+
}
|
|
10160
|
+
|
|
10161
|
+
truncated = '';
|
|
10162
|
+
}
|
|
10163
|
+
|
|
10164
|
+
return "".concat(output).concat(truncated);
|
|
10165
|
+
}
|
|
10166
|
+
|
|
10167
|
+
function quoteComplexKey(key) {
|
|
10168
|
+
if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) {
|
|
10169
|
+
return key;
|
|
10170
|
+
}
|
|
10171
|
+
|
|
10172
|
+
return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'");
|
|
10173
|
+
}
|
|
10174
|
+
|
|
10175
|
+
function inspectProperty(_ref2, options) {
|
|
10176
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
10177
|
+
key = _ref3[0],
|
|
10178
|
+
value = _ref3[1];
|
|
10179
|
+
|
|
10180
|
+
options.truncate -= 2;
|
|
10181
|
+
|
|
10182
|
+
if (typeof key === 'string') {
|
|
10183
|
+
key = quoteComplexKey(key);
|
|
10184
|
+
} else if (typeof key !== 'number') {
|
|
10185
|
+
key = "[".concat(options.inspect(key, options), "]");
|
|
10186
|
+
}
|
|
10187
|
+
|
|
10188
|
+
options.truncate -= key.length;
|
|
10189
|
+
value = options.inspect(value, options);
|
|
10190
|
+
return "".concat(key, ": ").concat(value);
|
|
10191
|
+
}
|
|
10192
|
+
|
|
10193
|
+
function inspectArray(array, options) {
|
|
10194
|
+
// Object.keys will always output the Array indices first, so we can slice by
|
|
10195
|
+
// `array.length` to get non-index properties
|
|
10196
|
+
var nonIndexProperties = Object.keys(array).slice(array.length);
|
|
10197
|
+
if (!array.length && !nonIndexProperties.length) return '[]';
|
|
10198
|
+
options.truncate -= 4;
|
|
10199
|
+
var listContents = inspectList(array, options);
|
|
10200
|
+
options.truncate -= listContents.length;
|
|
10201
|
+
var propertyContents = '';
|
|
10202
|
+
|
|
10203
|
+
if (nonIndexProperties.length) {
|
|
10204
|
+
propertyContents = inspectList(nonIndexProperties.map(function (key) {
|
|
10205
|
+
return [key, array[key]];
|
|
10206
|
+
}), options, inspectProperty);
|
|
10207
|
+
}
|
|
10208
|
+
|
|
10209
|
+
return "[ ".concat(listContents).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]");
|
|
10210
|
+
}
|
|
10211
|
+
|
|
10212
|
+
/* !
|
|
10213
|
+
* Chai - getFuncName utility
|
|
10214
|
+
* Copyright(c) 2012-2016 Jake Luer <jake@alogicalparadox.com>
|
|
10215
|
+
* MIT Licensed
|
|
10216
|
+
*/
|
|
10217
|
+
|
|
10218
|
+
/**
|
|
10219
|
+
* ### .getFuncName(constructorFn)
|
|
10220
|
+
*
|
|
10221
|
+
* Returns the name of a function.
|
|
10222
|
+
* When a non-function instance is passed, returns `null`.
|
|
10223
|
+
* This also includes a polyfill function if `aFunc.name` is not defined.
|
|
10224
|
+
*
|
|
10225
|
+
* @name getFuncName
|
|
10226
|
+
* @param {Function} funct
|
|
10227
|
+
* @namespace Utils
|
|
10228
|
+
* @api public
|
|
10229
|
+
*/
|
|
10230
|
+
|
|
10231
|
+
var toString = Function.prototype.toString;
|
|
10232
|
+
var functionNameMatch = /\s*function(?:\s|\s*\/\*[^(?:*\/)]+\*\/\s*)*([^\s\(\/]+)/;
|
|
10233
|
+
function getFuncName(aFunc) {
|
|
10234
|
+
if (typeof aFunc !== 'function') {
|
|
10235
|
+
return null;
|
|
10236
|
+
}
|
|
10237
|
+
|
|
10238
|
+
var name = '';
|
|
10239
|
+
if (typeof Function.prototype.name === 'undefined' && typeof aFunc.name === 'undefined') {
|
|
10240
|
+
// Here we run a polyfill if Function does not support the `name` property and if aFunc.name is not defined
|
|
10241
|
+
var match = toString.call(aFunc).match(functionNameMatch);
|
|
10242
|
+
if (match) {
|
|
10243
|
+
name = match[1];
|
|
10244
|
+
}
|
|
10245
|
+
} else {
|
|
10246
|
+
// If we've got a `name` property we just use it
|
|
10247
|
+
name = aFunc.name;
|
|
10248
|
+
}
|
|
10249
|
+
|
|
10250
|
+
return name;
|
|
10251
|
+
}
|
|
10252
|
+
|
|
10253
|
+
var getFuncName_1 = getFuncName;
|
|
10254
|
+
|
|
10255
|
+
var getArrayName = function getArrayName(array) {
|
|
10256
|
+
// We need to special case Node.js' Buffers, which report to be Uint8Array
|
|
10257
|
+
if (typeof Buffer === 'function' && array instanceof Buffer) {
|
|
10258
|
+
return 'Buffer';
|
|
10259
|
+
}
|
|
10260
|
+
|
|
10261
|
+
if (array[Symbol.toStringTag]) {
|
|
10262
|
+
return array[Symbol.toStringTag];
|
|
10263
|
+
}
|
|
10264
|
+
|
|
10265
|
+
return getFuncName_1(array.constructor);
|
|
10266
|
+
};
|
|
10267
|
+
|
|
10268
|
+
function inspectTypedArray(array, options) {
|
|
10269
|
+
var name = getArrayName(array);
|
|
10270
|
+
options.truncate -= name.length + 4; // Object.keys will always output the Array indices first, so we can slice by
|
|
10271
|
+
// `array.length` to get non-index properties
|
|
10272
|
+
|
|
10273
|
+
var nonIndexProperties = Object.keys(array).slice(array.length);
|
|
10274
|
+
if (!array.length && !nonIndexProperties.length) return "".concat(name, "[]"); // As we know TypedArrays only contain Unsigned Integers, we can skip inspecting each one and simply
|
|
10275
|
+
// stylise the toString() value of them
|
|
10276
|
+
|
|
10277
|
+
var output = '';
|
|
10278
|
+
|
|
10279
|
+
for (var i = 0; i < array.length; i++) {
|
|
10280
|
+
var string = "".concat(options.stylize(truncate(array[i], options.truncate), 'number')).concat(i === array.length - 1 ? '' : ', ');
|
|
10281
|
+
options.truncate -= string.length;
|
|
10282
|
+
|
|
10283
|
+
if (array[i] !== array.length && options.truncate <= 3) {
|
|
10284
|
+
output += "".concat(truncator, "(").concat(array.length - array[i] + 1, ")");
|
|
10285
|
+
break;
|
|
10286
|
+
}
|
|
10287
|
+
|
|
10288
|
+
output += string;
|
|
10289
|
+
}
|
|
10290
|
+
|
|
10291
|
+
var propertyContents = '';
|
|
10292
|
+
|
|
10293
|
+
if (nonIndexProperties.length) {
|
|
10294
|
+
propertyContents = inspectList(nonIndexProperties.map(function (key) {
|
|
10295
|
+
return [key, array[key]];
|
|
10296
|
+
}), options, inspectProperty);
|
|
10297
|
+
}
|
|
10298
|
+
|
|
10299
|
+
return "".concat(name, "[ ").concat(output).concat(propertyContents ? ", ".concat(propertyContents) : '', " ]");
|
|
10300
|
+
}
|
|
10301
|
+
|
|
10302
|
+
function inspectDate(dateObject, options) {
|
|
10303
|
+
// If we need to - truncate the time portion, but never the date
|
|
10304
|
+
var split = dateObject.toJSON().split('T');
|
|
10305
|
+
var date = split[0];
|
|
10306
|
+
return options.stylize("".concat(date, "T").concat(truncate(split[1], options.truncate - date.length - 1)), 'date');
|
|
10307
|
+
}
|
|
10308
|
+
|
|
10309
|
+
function inspectFunction(func, options) {
|
|
10310
|
+
var name = getFuncName_1(func);
|
|
10311
|
+
|
|
10312
|
+
if (!name) {
|
|
10313
|
+
return options.stylize('[Function]', 'special');
|
|
10314
|
+
}
|
|
10315
|
+
|
|
10316
|
+
return options.stylize("[Function ".concat(truncate(name, options.truncate - 11), "]"), 'special');
|
|
10317
|
+
}
|
|
10318
|
+
|
|
10319
|
+
function inspectMapEntry(_ref, options) {
|
|
10320
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
10321
|
+
key = _ref2[0],
|
|
10322
|
+
value = _ref2[1];
|
|
10323
|
+
|
|
10324
|
+
options.truncate -= 4;
|
|
10325
|
+
key = options.inspect(key, options);
|
|
10326
|
+
options.truncate -= key.length;
|
|
10327
|
+
value = options.inspect(value, options);
|
|
10328
|
+
return "".concat(key, " => ").concat(value);
|
|
10329
|
+
} // IE11 doesn't support `map.entries()`
|
|
10330
|
+
|
|
10331
|
+
|
|
10332
|
+
function mapToEntries(map) {
|
|
10333
|
+
var entries = [];
|
|
10334
|
+
map.forEach(function (value, key) {
|
|
10335
|
+
entries.push([key, value]);
|
|
10336
|
+
});
|
|
10337
|
+
return entries;
|
|
10338
|
+
}
|
|
10339
|
+
|
|
10340
|
+
function inspectMap(map, options) {
|
|
10341
|
+
var size = map.size - 1;
|
|
10342
|
+
|
|
10343
|
+
if (size <= 0) {
|
|
10344
|
+
return 'Map{}';
|
|
10345
|
+
}
|
|
10346
|
+
|
|
10347
|
+
options.truncate -= 7;
|
|
10348
|
+
return "Map{ ".concat(inspectList(mapToEntries(map), options, inspectMapEntry), " }");
|
|
10349
|
+
}
|
|
10350
|
+
|
|
10351
|
+
var isNaN = Number.isNaN || function (i) {
|
|
10352
|
+
return i !== i;
|
|
10353
|
+
}; // eslint-disable-line no-self-compare
|
|
10354
|
+
|
|
10355
|
+
|
|
10356
|
+
function inspectNumber(number, options) {
|
|
10357
|
+
if (isNaN(number)) {
|
|
10358
|
+
return options.stylize('NaN', 'number');
|
|
10359
|
+
}
|
|
10360
|
+
|
|
10361
|
+
if (number === Infinity) {
|
|
10362
|
+
return options.stylize('Infinity', 'number');
|
|
10363
|
+
}
|
|
10364
|
+
|
|
10365
|
+
if (number === -Infinity) {
|
|
10366
|
+
return options.stylize('-Infinity', 'number');
|
|
10367
|
+
}
|
|
10368
|
+
|
|
10369
|
+
if (number === 0) {
|
|
10370
|
+
return options.stylize(1 / number === Infinity ? '+0' : '-0', 'number');
|
|
10371
|
+
}
|
|
10372
|
+
|
|
10373
|
+
return options.stylize(truncate(number, options.truncate), 'number');
|
|
10374
|
+
}
|
|
10375
|
+
|
|
10376
|
+
function inspectBigInt(number, options) {
|
|
10377
|
+
var nums = truncate(number.toString(), options.truncate - 1);
|
|
10378
|
+
if (nums !== truncator) nums += 'n';
|
|
10379
|
+
return options.stylize(nums, 'bigint');
|
|
10380
|
+
}
|
|
10381
|
+
|
|
10382
|
+
function inspectRegExp(value, options) {
|
|
10383
|
+
var flags = value.toString().split('/')[2];
|
|
10384
|
+
var sourceLength = options.truncate - (2 + flags.length);
|
|
10385
|
+
var source = value.source;
|
|
10386
|
+
return options.stylize("/".concat(truncate(source, sourceLength), "/").concat(flags), 'regexp');
|
|
10387
|
+
}
|
|
10388
|
+
|
|
10389
|
+
function arrayFromSet(set) {
|
|
10390
|
+
var values = [];
|
|
10391
|
+
set.forEach(function (value) {
|
|
10392
|
+
values.push(value);
|
|
10393
|
+
});
|
|
10394
|
+
return values;
|
|
10395
|
+
}
|
|
10396
|
+
|
|
10397
|
+
function inspectSet(set, options) {
|
|
10398
|
+
if (set.size === 0) return 'Set{}';
|
|
10399
|
+
options.truncate -= 7;
|
|
10400
|
+
return "Set{ ".concat(inspectList(arrayFromSet(set), options), " }");
|
|
10401
|
+
}
|
|
10402
|
+
|
|
10403
|
+
var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" + "\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", 'g');
|
|
10404
|
+
var escapeCharacters = {
|
|
10405
|
+
'\b': '\\b',
|
|
10406
|
+
'\t': '\\t',
|
|
10407
|
+
'\n': '\\n',
|
|
10408
|
+
'\f': '\\f',
|
|
10409
|
+
'\r': '\\r',
|
|
10410
|
+
"'": "\\'",
|
|
10411
|
+
'\\': '\\\\'
|
|
10412
|
+
};
|
|
10413
|
+
var hex = 16;
|
|
10414
|
+
var unicodeLength = 4;
|
|
10415
|
+
|
|
10416
|
+
function escape(char) {
|
|
10417
|
+
return escapeCharacters[char] || "\\u".concat("0000".concat(char.charCodeAt(0).toString(hex)).slice(-unicodeLength));
|
|
10418
|
+
}
|
|
10419
|
+
|
|
10420
|
+
function inspectString(string, options) {
|
|
10421
|
+
if (stringEscapeChars.test(string)) {
|
|
10422
|
+
string = string.replace(stringEscapeChars, escape);
|
|
10423
|
+
}
|
|
10424
|
+
|
|
10425
|
+
return options.stylize("'".concat(truncate(string, options.truncate - 2), "'"), 'string');
|
|
10426
|
+
}
|
|
10427
|
+
|
|
10428
|
+
function inspectSymbol(value) {
|
|
10429
|
+
if ('description' in Symbol.prototype) {
|
|
10430
|
+
return value.description ? "Symbol(".concat(value.description, ")") : 'Symbol()';
|
|
10431
|
+
}
|
|
10432
|
+
|
|
10433
|
+
return value.toString();
|
|
10434
|
+
}
|
|
10435
|
+
|
|
10436
|
+
var getPromiseValue = function getPromiseValue() {
|
|
10437
|
+
return 'Promise{…}';
|
|
10438
|
+
};
|
|
10439
|
+
|
|
10440
|
+
try {
|
|
10441
|
+
var _process$binding = process.binding('util'),
|
|
10442
|
+
getPromiseDetails = _process$binding.getPromiseDetails,
|
|
10443
|
+
kPending = _process$binding.kPending,
|
|
10444
|
+
kRejected = _process$binding.kRejected;
|
|
10445
|
+
|
|
10446
|
+
if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
|
|
10447
|
+
getPromiseValue = function getPromiseValue(value, options) {
|
|
10448
|
+
var _getPromiseDetails = getPromiseDetails(value),
|
|
10449
|
+
_getPromiseDetails2 = _slicedToArray(_getPromiseDetails, 2),
|
|
10450
|
+
state = _getPromiseDetails2[0],
|
|
10451
|
+
innerValue = _getPromiseDetails2[1];
|
|
10452
|
+
|
|
10453
|
+
if (state === kPending) {
|
|
10454
|
+
return 'Promise{<pending>}';
|
|
10455
|
+
}
|
|
10456
|
+
|
|
10457
|
+
return "Promise".concat(state === kRejected ? '!' : '', "{").concat(options.inspect(innerValue, options), "}");
|
|
10458
|
+
};
|
|
10459
|
+
}
|
|
10460
|
+
} catch (notNode) {
|
|
10461
|
+
/* ignore */
|
|
10462
|
+
}
|
|
10463
|
+
|
|
10464
|
+
var inspectPromise = getPromiseValue;
|
|
10465
|
+
|
|
10466
|
+
function inspectObject(object, options) {
|
|
10467
|
+
var properties = Object.getOwnPropertyNames(object);
|
|
10468
|
+
var symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : [];
|
|
10469
|
+
|
|
10470
|
+
if (properties.length === 0 && symbols.length === 0) {
|
|
10471
|
+
return '{}';
|
|
10472
|
+
}
|
|
10473
|
+
|
|
10474
|
+
options.truncate -= 4;
|
|
10475
|
+
options.seen = options.seen || [];
|
|
10476
|
+
|
|
10477
|
+
if (options.seen.indexOf(object) >= 0) {
|
|
10478
|
+
return '[Circular]';
|
|
10479
|
+
}
|
|
10480
|
+
|
|
10481
|
+
options.seen.push(object);
|
|
10482
|
+
var propertyContents = inspectList(properties.map(function (key) {
|
|
10483
|
+
return [key, object[key]];
|
|
10484
|
+
}), options, inspectProperty);
|
|
10485
|
+
var symbolContents = inspectList(symbols.map(function (key) {
|
|
10486
|
+
return [key, object[key]];
|
|
10487
|
+
}), options, inspectProperty);
|
|
10488
|
+
options.seen.pop();
|
|
10489
|
+
var sep = '';
|
|
10490
|
+
|
|
10491
|
+
if (propertyContents && symbolContents) {
|
|
10492
|
+
sep = ', ';
|
|
10493
|
+
}
|
|
10494
|
+
|
|
10495
|
+
return "{ ".concat(propertyContents).concat(sep).concat(symbolContents, " }");
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10498
|
+
var toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false;
|
|
10499
|
+
function inspectClass(value, options) {
|
|
10500
|
+
var name = '';
|
|
10501
|
+
|
|
10502
|
+
if (toStringTag && toStringTag in value) {
|
|
10503
|
+
name = value[toStringTag];
|
|
10504
|
+
}
|
|
10505
|
+
|
|
10506
|
+
name = name || getFuncName_1(value.constructor); // Babel transforms anonymous classes to the name `_class`
|
|
10507
|
+
|
|
10508
|
+
if (!name || name === '_class') {
|
|
10509
|
+
name = '<Anonymous Class>';
|
|
10510
|
+
}
|
|
10511
|
+
|
|
10512
|
+
options.truncate -= name.length;
|
|
10513
|
+
return "".concat(name).concat(inspectObject(value, options));
|
|
10514
|
+
}
|
|
10515
|
+
|
|
10516
|
+
function inspectArguments(args, options) {
|
|
10517
|
+
if (args.length === 0) return 'Arguments[]';
|
|
10518
|
+
options.truncate -= 13;
|
|
10519
|
+
return "Arguments[ ".concat(inspectList(args, options), " ]");
|
|
10520
|
+
}
|
|
10521
|
+
|
|
10522
|
+
var errorKeys = ['stack', 'line', 'column', 'name', 'message', 'fileName', 'lineNumber', 'columnNumber', 'number', 'description'];
|
|
10523
|
+
function inspectObject$1(error, options) {
|
|
10524
|
+
var properties = Object.getOwnPropertyNames(error).filter(function (key) {
|
|
10525
|
+
return errorKeys.indexOf(key) === -1;
|
|
10526
|
+
});
|
|
10527
|
+
var name = error.name;
|
|
10528
|
+
options.truncate -= name.length;
|
|
10529
|
+
var message = '';
|
|
10530
|
+
|
|
10531
|
+
if (typeof error.message === 'string') {
|
|
10532
|
+
message = truncate(error.message, options.truncate);
|
|
10533
|
+
} else {
|
|
10534
|
+
properties.unshift('message');
|
|
10535
|
+
}
|
|
10536
|
+
|
|
10537
|
+
message = message ? ": ".concat(message) : '';
|
|
10538
|
+
options.truncate -= message.length + 5;
|
|
10539
|
+
var propertyContents = inspectList(properties.map(function (key) {
|
|
10540
|
+
return [key, error[key]];
|
|
10541
|
+
}), options, inspectProperty);
|
|
10542
|
+
return "".concat(name).concat(message).concat(propertyContents ? " { ".concat(propertyContents, " }") : '');
|
|
10543
|
+
}
|
|
10544
|
+
|
|
10545
|
+
function inspectAttribute(_ref, options) {
|
|
10546
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
10547
|
+
key = _ref2[0],
|
|
10548
|
+
value = _ref2[1];
|
|
10549
|
+
|
|
10550
|
+
options.truncate -= 3;
|
|
10551
|
+
|
|
10552
|
+
if (!value) {
|
|
10553
|
+
return "".concat(options.stylize(key, 'yellow'));
|
|
10554
|
+
}
|
|
10555
|
+
|
|
10556
|
+
return "".concat(options.stylize(key, 'yellow'), "=").concat(options.stylize("\"".concat(value, "\""), 'string'));
|
|
10557
|
+
}
|
|
10558
|
+
function inspectHTMLCollection(collection, options) {
|
|
10559
|
+
// eslint-disable-next-line no-use-before-define
|
|
10560
|
+
return inspectList(collection, options, inspectHTML, '\n');
|
|
10561
|
+
}
|
|
10562
|
+
function inspectHTML(element, options) {
|
|
10563
|
+
var properties = element.getAttributeNames();
|
|
10564
|
+
var name = element.tagName.toLowerCase();
|
|
10565
|
+
var head = options.stylize("<".concat(name), 'special');
|
|
10566
|
+
var headClose = options.stylize(">", 'special');
|
|
10567
|
+
var tail = options.stylize("</".concat(name, ">"), 'special');
|
|
10568
|
+
options.truncate -= name.length * 2 + 5;
|
|
10569
|
+
var propertyContents = '';
|
|
10570
|
+
|
|
10571
|
+
if (properties.length > 0) {
|
|
10572
|
+
propertyContents += ' ';
|
|
10573
|
+
propertyContents += inspectList(properties.map(function (key) {
|
|
10574
|
+
return [key, element.getAttribute(key)];
|
|
10575
|
+
}), options, inspectAttribute, ' ');
|
|
10576
|
+
}
|
|
10577
|
+
|
|
10578
|
+
options.truncate -= propertyContents.length;
|
|
10579
|
+
var truncate = options.truncate;
|
|
10580
|
+
var children = inspectHTMLCollection(element.children, options);
|
|
10581
|
+
|
|
10582
|
+
if (children && children.length > truncate) {
|
|
10583
|
+
children = "".concat(truncator, "(").concat(element.children.length, ")");
|
|
10584
|
+
}
|
|
10585
|
+
|
|
10586
|
+
return "".concat(head).concat(propertyContents).concat(headClose).concat(children).concat(tail);
|
|
10587
|
+
}
|
|
10588
|
+
|
|
10589
|
+
var symbolsSupported = typeof Symbol === 'function' && typeof Symbol.for === 'function';
|
|
10590
|
+
var chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/inspect';
|
|
10591
|
+
var nodeInspect = false;
|
|
10592
|
+
|
|
10593
|
+
try {
|
|
10594
|
+
// eslint-disable-next-line global-require
|
|
10595
|
+
var nodeUtil = require('util');
|
|
10596
|
+
|
|
10597
|
+
nodeInspect = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
|
|
10598
|
+
} catch (noNodeInspect) {
|
|
10599
|
+
nodeInspect = false;
|
|
10600
|
+
}
|
|
10601
|
+
|
|
10602
|
+
var constructorMap = new WeakMap();
|
|
10603
|
+
var stringTagMap = {};
|
|
10604
|
+
var baseTypesMap = {
|
|
10605
|
+
undefined: function undefined$1(value, options) {
|
|
10606
|
+
return options.stylize('undefined', 'undefined');
|
|
10607
|
+
},
|
|
10608
|
+
null: function _null(value, options) {
|
|
10609
|
+
return options.stylize(null, 'null');
|
|
10610
|
+
},
|
|
10611
|
+
boolean: function boolean(value, options) {
|
|
10612
|
+
return options.stylize(value, 'boolean');
|
|
10613
|
+
},
|
|
10614
|
+
Boolean: function Boolean(value, options) {
|
|
10615
|
+
return options.stylize(value, 'boolean');
|
|
10616
|
+
},
|
|
10617
|
+
number: inspectNumber,
|
|
10618
|
+
Number: inspectNumber,
|
|
10619
|
+
bigint: inspectBigInt,
|
|
10620
|
+
BigInt: inspectBigInt,
|
|
10621
|
+
string: inspectString,
|
|
10622
|
+
String: inspectString,
|
|
10623
|
+
function: inspectFunction,
|
|
10624
|
+
Function: inspectFunction,
|
|
10625
|
+
symbol: inspectSymbol,
|
|
10626
|
+
// A Symbol polyfill will return `Symbol` not `symbol` from typedetect
|
|
10627
|
+
Symbol: inspectSymbol,
|
|
10628
|
+
Array: inspectArray,
|
|
10629
|
+
Date: inspectDate,
|
|
10630
|
+
Map: inspectMap,
|
|
10631
|
+
Set: inspectSet,
|
|
10632
|
+
RegExp: inspectRegExp,
|
|
10633
|
+
Promise: inspectPromise,
|
|
10634
|
+
// WeakSet, WeakMap are totally opaque to us
|
|
10635
|
+
WeakSet: function WeakSet(value, options) {
|
|
10636
|
+
return options.stylize('WeakSet{…}', 'special');
|
|
10637
|
+
},
|
|
10638
|
+
WeakMap: function WeakMap(value, options) {
|
|
10639
|
+
return options.stylize('WeakMap{…}', 'special');
|
|
10640
|
+
},
|
|
10641
|
+
Arguments: inspectArguments,
|
|
10642
|
+
Int8Array: inspectTypedArray,
|
|
10643
|
+
Uint8Array: inspectTypedArray,
|
|
10644
|
+
Uint8ClampedArray: inspectTypedArray,
|
|
10645
|
+
Int16Array: inspectTypedArray,
|
|
10646
|
+
Uint16Array: inspectTypedArray,
|
|
10647
|
+
Int32Array: inspectTypedArray,
|
|
10648
|
+
Uint32Array: inspectTypedArray,
|
|
10649
|
+
Float32Array: inspectTypedArray,
|
|
10650
|
+
Float64Array: inspectTypedArray,
|
|
10651
|
+
Generator: function Generator() {
|
|
10652
|
+
return '';
|
|
10653
|
+
},
|
|
10654
|
+
DataView: function DataView() {
|
|
10655
|
+
return '';
|
|
10656
|
+
},
|
|
10657
|
+
ArrayBuffer: function ArrayBuffer() {
|
|
10658
|
+
return '';
|
|
10659
|
+
},
|
|
10660
|
+
Error: inspectObject$1,
|
|
10661
|
+
HTMLCollection: inspectHTMLCollection,
|
|
10662
|
+
NodeList: inspectHTMLCollection
|
|
10663
|
+
}; // eslint-disable-next-line complexity
|
|
10664
|
+
|
|
10665
|
+
var inspectCustom = function inspectCustom(value, options, type) {
|
|
10666
|
+
if (chaiInspect in value && typeof value[chaiInspect] === 'function') {
|
|
10667
|
+
return value[chaiInspect](options);
|
|
10668
|
+
}
|
|
10669
|
+
|
|
10670
|
+
if (nodeInspect && nodeInspect in value && typeof value[nodeInspect] === 'function') {
|
|
10671
|
+
return value[nodeInspect](options.depth, options);
|
|
10672
|
+
}
|
|
10673
|
+
|
|
10674
|
+
if ('inspect' in value && typeof value.inspect === 'function') {
|
|
10675
|
+
return value.inspect(options.depth, options);
|
|
10676
|
+
}
|
|
10677
|
+
|
|
10678
|
+
if ('constructor' in value && constructorMap.has(value.constructor)) {
|
|
10679
|
+
return constructorMap.get(value.constructor)(value, options);
|
|
10680
|
+
}
|
|
10681
|
+
|
|
10682
|
+
if (stringTagMap[type]) {
|
|
10683
|
+
return stringTagMap[type](value, options);
|
|
10684
|
+
}
|
|
10685
|
+
|
|
10686
|
+
return '';
|
|
10687
|
+
};
|
|
10688
|
+
|
|
10689
|
+
var toString$1 = Object.prototype.toString; // eslint-disable-next-line complexity
|
|
10690
|
+
|
|
10691
|
+
function inspect(value, options) {
|
|
10692
|
+
options = normaliseOptions(options);
|
|
10693
|
+
options.inspect = inspect;
|
|
10694
|
+
var _options = options,
|
|
10695
|
+
customInspect = _options.customInspect;
|
|
10696
|
+
var type = value === null ? 'null' : _typeof(value);
|
|
10697
|
+
|
|
10698
|
+
if (type === 'object') {
|
|
10699
|
+
type = toString$1.call(value).slice(8, -1);
|
|
10700
|
+
} // If it is a base value that we already support, then use Loupe's inspector
|
|
10701
|
+
|
|
10702
|
+
|
|
10703
|
+
if (baseTypesMap[type]) {
|
|
10704
|
+
return baseTypesMap[type](value, options);
|
|
10705
|
+
} // If `options.customInspect` is set to true then try to use the custom inspector
|
|
10706
|
+
|
|
10707
|
+
|
|
10708
|
+
if (customInspect && value) {
|
|
10709
|
+
var output = inspectCustom(value, options, type);
|
|
10710
|
+
|
|
10711
|
+
if (output) {
|
|
10712
|
+
if (typeof output === 'string') return output;
|
|
10713
|
+
return inspect(output, options);
|
|
10714
|
+
}
|
|
10715
|
+
}
|
|
10716
|
+
|
|
10717
|
+
var proto = value ? Object.getPrototypeOf(value) : false; // If it's a plain Object then use Loupe's inspector
|
|
10718
|
+
|
|
10719
|
+
if (proto === Object.prototype || proto === null) {
|
|
10720
|
+
return inspectObject(value, options);
|
|
10721
|
+
} // Specifically account for HTMLElements
|
|
10722
|
+
// eslint-disable-next-line no-undef
|
|
10723
|
+
|
|
10724
|
+
|
|
10725
|
+
if (value && typeof HTMLElement === 'function' && value instanceof HTMLElement) {
|
|
10726
|
+
return inspectHTML(value, options);
|
|
10727
|
+
}
|
|
10728
|
+
|
|
10729
|
+
if ('constructor' in value) {
|
|
10730
|
+
// If it is a class, inspect it like an object but add the constructor name
|
|
10731
|
+
if (value.constructor !== Object) {
|
|
10732
|
+
return inspectClass(value, options);
|
|
10733
|
+
} // If it is an object with an anonymous prototype, display it as an object.
|
|
10734
|
+
|
|
10735
|
+
|
|
10736
|
+
return inspectObject(value, options);
|
|
10737
|
+
} // We have run out of options! Just stringify the value
|
|
10738
|
+
|
|
10739
|
+
|
|
10740
|
+
return options.stylize(String(value), type);
|
|
10741
|
+
}
|
|
10742
|
+
function registerConstructor(constructor, inspector) {
|
|
10743
|
+
if (constructorMap.has(constructor)) {
|
|
10744
|
+
return false;
|
|
10745
|
+
}
|
|
10746
|
+
|
|
10747
|
+
constructorMap.add(constructor, inspector);
|
|
10748
|
+
return true;
|
|
10749
|
+
}
|
|
10750
|
+
function registerStringTag(stringTag, inspector) {
|
|
10751
|
+
if (stringTag in stringTagMap) {
|
|
10752
|
+
return false;
|
|
10753
|
+
}
|
|
10754
|
+
|
|
10755
|
+
stringTagMap[stringTag] = inspector;
|
|
10756
|
+
return true;
|
|
10757
|
+
}
|
|
10758
|
+
var custom = chaiInspect;
|
|
10759
|
+
|
|
10760
|
+
exports.custom = custom;
|
|
10761
|
+
exports.default = inspect;
|
|
10762
|
+
exports.inspect = inspect;
|
|
10763
|
+
exports.registerConstructor = registerConstructor;
|
|
10764
|
+
exports.registerStringTag = registerStringTag;
|
|
10765
|
+
|
|
10766
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11141
10767
|
|
|
11142
10768
|
})));
|
|
11143
10769
|
|