chai 4.3.4 → 4.3.5
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 +1256 -407
- package/lib/chai/core/assertions.js +1 -1
- package/lib/chai/utils/inspect.js +6 -352
- package/package.json +3 -2
package/chai.js
CHANGED
|
@@ -95,7 +95,7 @@ exports.use(should);
|
|
|
95
95
|
var assert = require('./chai/interface/assert');
|
|
96
96
|
exports.use(assert);
|
|
97
97
|
|
|
98
|
-
},{"./chai/assertion":3,"./chai/config":4,"./chai/core/assertions":5,"./chai/interface/assert":6,"./chai/interface/expect":7,"./chai/interface/should":8,"./chai/utils":
|
|
98
|
+
},{"./chai/assertion":3,"./chai/config":4,"./chai/core/assertions":5,"./chai/interface/assert":6,"./chai/interface/expect":7,"./chai/interface/should":8,"./chai/utils":22,"assertion-error":33}],3:[function(require,module,exports){
|
|
99
99
|
/*!
|
|
100
100
|
* chai
|
|
101
101
|
* http://chaijs.com
|
|
@@ -1951,7 +1951,7 @@ module.exports = function (chai, _) {
|
|
|
1951
1951
|
, errorMessage
|
|
1952
1952
|
, shouldThrow = true
|
|
1953
1953
|
, range = (startType === 'date' && finishType === 'date')
|
|
1954
|
-
? start.
|
|
1954
|
+
? start.toISOString() + '..' + finish.toISOString()
|
|
1955
1955
|
: start + '..' + finish;
|
|
1956
1956
|
|
|
1957
1957
|
if (doLength && objType !== 'map' && objType !== 'set') {
|
|
@@ -7762,7 +7762,7 @@ module.exports = function addChainableMethod(ctx, name, method, chainingBehavior
|
|
|
7762
7762
|
});
|
|
7763
7763
|
};
|
|
7764
7764
|
|
|
7765
|
-
},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":
|
|
7765
|
+
},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":30,"./transferFlags":32}],10:[function(require,module,exports){
|
|
7766
7766
|
var fnLengthDesc = Object.getOwnPropertyDescriptor(function () {}, 'length');
|
|
7767
7767
|
|
|
7768
7768
|
/*!
|
|
@@ -7894,7 +7894,7 @@ module.exports = function addMethod(ctx, name, method) {
|
|
|
7894
7894
|
ctx[name] = proxify(methodWrapper, name);
|
|
7895
7895
|
};
|
|
7896
7896
|
|
|
7897
|
-
},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":
|
|
7897
|
+
},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":30,"./transferFlags":32}],12:[function(require,module,exports){
|
|
7898
7898
|
/*!
|
|
7899
7899
|
* Chai - addProperty utility
|
|
7900
7900
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -7968,7 +7968,7 @@ module.exports = function addProperty(ctx, name, getter) {
|
|
|
7968
7968
|
});
|
|
7969
7969
|
};
|
|
7970
7970
|
|
|
7971
|
-
},{"../../chai":2,"./flag":15,"./isProxyEnabled":
|
|
7971
|
+
},{"../../chai":2,"./flag":15,"./isProxyEnabled":25,"./transferFlags":32}],13:[function(require,module,exports){
|
|
7972
7972
|
/*!
|
|
7973
7973
|
* Chai - compareByInspect utility
|
|
7974
7974
|
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8001,7 +8001,7 @@ module.exports = function compareByInspect(a, b) {
|
|
|
8001
8001
|
return inspect(a) < inspect(b) ? -1 : 1;
|
|
8002
8002
|
};
|
|
8003
8003
|
|
|
8004
|
-
},{"./inspect":
|
|
8004
|
+
},{"./inspect":23}],14:[function(require,module,exports){
|
|
8005
8005
|
/*!
|
|
8006
8006
|
* Chai - expectTypes utility
|
|
8007
8007
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8054,7 +8054,7 @@ module.exports = function expectTypes(obj, types) {
|
|
|
8054
8054
|
}
|
|
8055
8055
|
};
|
|
8056
8056
|
|
|
8057
|
-
},{"./flag":15,"assertion-error":
|
|
8057
|
+
},{"./flag":15,"assertion-error":33,"type-detect":39}],15:[function(require,module,exports){
|
|
8058
8058
|
/*!
|
|
8059
8059
|
* Chai - flag utility
|
|
8060
8060
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8112,34 +8112,6 @@ module.exports = function getActual(obj, args) {
|
|
|
8112
8112
|
};
|
|
8113
8113
|
|
|
8114
8114
|
},{}],17:[function(require,module,exports){
|
|
8115
|
-
/*!
|
|
8116
|
-
* Chai - getEnumerableProperties utility
|
|
8117
|
-
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
8118
|
-
* MIT Licensed
|
|
8119
|
-
*/
|
|
8120
|
-
|
|
8121
|
-
/**
|
|
8122
|
-
* ### .getEnumerableProperties(object)
|
|
8123
|
-
*
|
|
8124
|
-
* This allows the retrieval of enumerable property names of an object,
|
|
8125
|
-
* inherited or not.
|
|
8126
|
-
*
|
|
8127
|
-
* @param {Object} object
|
|
8128
|
-
* @returns {Array}
|
|
8129
|
-
* @namespace Utils
|
|
8130
|
-
* @name getEnumerableProperties
|
|
8131
|
-
* @api public
|
|
8132
|
-
*/
|
|
8133
|
-
|
|
8134
|
-
module.exports = function getEnumerableProperties(object) {
|
|
8135
|
-
var result = [];
|
|
8136
|
-
for (var name in object) {
|
|
8137
|
-
result.push(name);
|
|
8138
|
-
}
|
|
8139
|
-
return result;
|
|
8140
|
-
};
|
|
8141
|
-
|
|
8142
|
-
},{}],18:[function(require,module,exports){
|
|
8143
8115
|
/*!
|
|
8144
8116
|
* Chai - message composition utility
|
|
8145
8117
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8191,7 +8163,7 @@ module.exports = function getMessage(obj, args) {
|
|
|
8191
8163
|
return flagMsg ? flagMsg + ': ' + msg : msg;
|
|
8192
8164
|
};
|
|
8193
8165
|
|
|
8194
|
-
},{"./flag":15,"./getActual":16,"./objDisplay":
|
|
8166
|
+
},{"./flag":15,"./getActual":16,"./objDisplay":26}],18:[function(require,module,exports){
|
|
8195
8167
|
var type = require('type-detect');
|
|
8196
8168
|
|
|
8197
8169
|
var flag = require('./flag');
|
|
@@ -8248,7 +8220,7 @@ module.exports = function getOperator(obj, args) {
|
|
|
8248
8220
|
return isObject ? 'deepStrictEqual' : 'strictEqual';
|
|
8249
8221
|
};
|
|
8250
8222
|
|
|
8251
|
-
},{"./flag":15,"type-detect":39}],
|
|
8223
|
+
},{"./flag":15,"type-detect":39}],19:[function(require,module,exports){
|
|
8252
8224
|
/*!
|
|
8253
8225
|
* Chai - getOwnEnumerableProperties utility
|
|
8254
8226
|
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8279,7 +8251,7 @@ module.exports = function getOwnEnumerableProperties(obj) {
|
|
|
8279
8251
|
return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj));
|
|
8280
8252
|
};
|
|
8281
8253
|
|
|
8282
|
-
},{"./getOwnEnumerablePropertySymbols":
|
|
8254
|
+
},{"./getOwnEnumerablePropertySymbols":20}],20:[function(require,module,exports){
|
|
8283
8255
|
/*!
|
|
8284
8256
|
* Chai - getOwnEnumerablePropertySymbols utility
|
|
8285
8257
|
* Copyright(c) 2011-2016 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8308,7 +8280,7 @@ module.exports = function getOwnEnumerablePropertySymbols(obj) {
|
|
|
8308
8280
|
});
|
|
8309
8281
|
};
|
|
8310
8282
|
|
|
8311
|
-
},{}],
|
|
8283
|
+
},{}],21:[function(require,module,exports){
|
|
8312
8284
|
/*!
|
|
8313
8285
|
* Chai - getProperties utility
|
|
8314
8286
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8346,7 +8318,7 @@ module.exports = function getProperties(object) {
|
|
|
8346
8318
|
return result;
|
|
8347
8319
|
};
|
|
8348
8320
|
|
|
8349
|
-
},{}],
|
|
8321
|
+
},{}],22:[function(require,module,exports){
|
|
8350
8322
|
/*!
|
|
8351
8323
|
* chai
|
|
8352
8324
|
* Copyright(c) 2011 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -8525,13 +8497,12 @@ exports.isNaN = require('./isNaN');
|
|
|
8525
8497
|
*/
|
|
8526
8498
|
|
|
8527
8499
|
exports.getOperator = require('./getOperator');
|
|
8528
|
-
},{"./addChainableMethod":9,"./addLengthGuard":10,"./addMethod":11,"./addProperty":12,"./compareByInspect":13,"./expectTypes":14,"./flag":15,"./getActual":16,"./getMessage":
|
|
8500
|
+
},{"./addChainableMethod":9,"./addLengthGuard":10,"./addMethod":11,"./addProperty":12,"./compareByInspect":13,"./expectTypes":14,"./flag":15,"./getActual":16,"./getMessage":17,"./getOperator":18,"./getOwnEnumerableProperties":19,"./getOwnEnumerablePropertySymbols":20,"./inspect":23,"./isNaN":24,"./isProxyEnabled":25,"./objDisplay":26,"./overwriteChainableMethod":27,"./overwriteMethod":28,"./overwriteProperty":29,"./proxify":30,"./test":31,"./transferFlags":32,"check-error":34,"deep-eql":35,"get-func-name":36,"pathval":38,"type-detect":39}],23:[function(require,module,exports){
|
|
8529
8501
|
// This is (almost) directly from Node.js utils
|
|
8530
8502
|
// https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js
|
|
8531
8503
|
|
|
8532
8504
|
var getName = require('get-func-name');
|
|
8533
|
-
var
|
|
8534
|
-
var getEnumerableProperties = require('./getEnumerableProperties');
|
|
8505
|
+
var loupe = require('loupe');
|
|
8535
8506
|
var config = require('../config');
|
|
8536
8507
|
|
|
8537
8508
|
module.exports = inspect;
|
|
@@ -8552,361 +8523,16 @@ module.exports = inspect;
|
|
|
8552
8523
|
* @name inspect
|
|
8553
8524
|
*/
|
|
8554
8525
|
function inspect(obj, showHidden, depth, colors) {
|
|
8555
|
-
var
|
|
8526
|
+
var options = {
|
|
8527
|
+
colors: colors,
|
|
8528
|
+
depth: (typeof depth === 'undefined' ? 2 : depth),
|
|
8556
8529
|
showHidden: showHidden,
|
|
8557
|
-
|
|
8558
|
-
stylize: function (str) { return str; }
|
|
8530
|
+
truncate: config.truncateThreshold ? config.truncateThreshold : Infinity,
|
|
8559
8531
|
};
|
|
8560
|
-
return
|
|
8561
|
-
}
|
|
8562
|
-
|
|
8563
|
-
// Returns true if object is a DOM element.
|
|
8564
|
-
var isDOMElement = function (object) {
|
|
8565
|
-
if (typeof HTMLElement === 'object') {
|
|
8566
|
-
return object instanceof HTMLElement;
|
|
8567
|
-
} else {
|
|
8568
|
-
return object &&
|
|
8569
|
-
typeof object === 'object' &&
|
|
8570
|
-
'nodeType' in object &&
|
|
8571
|
-
object.nodeType === 1 &&
|
|
8572
|
-
typeof object.nodeName === 'string';
|
|
8573
|
-
}
|
|
8574
|
-
};
|
|
8575
|
-
|
|
8576
|
-
function formatValue(ctx, value, recurseTimes) {
|
|
8577
|
-
// Provide a hook for user-specified inspect functions.
|
|
8578
|
-
// Check that value is an object with an inspect function on it
|
|
8579
|
-
if (value && typeof value.inspect === 'function' &&
|
|
8580
|
-
// Filter out the util module, it's inspect function is special
|
|
8581
|
-
value.inspect !== exports.inspect &&
|
|
8582
|
-
// Also filter out any prototype objects using the circular check.
|
|
8583
|
-
!(value.constructor && value.constructor.prototype === value)) {
|
|
8584
|
-
var ret = value.inspect(recurseTimes, ctx);
|
|
8585
|
-
if (typeof ret !== 'string') {
|
|
8586
|
-
ret = formatValue(ctx, ret, recurseTimes);
|
|
8587
|
-
}
|
|
8588
|
-
return ret;
|
|
8589
|
-
}
|
|
8590
|
-
|
|
8591
|
-
// Primitive types cannot have properties
|
|
8592
|
-
var primitive = formatPrimitive(ctx, value);
|
|
8593
|
-
if (primitive) {
|
|
8594
|
-
return primitive;
|
|
8595
|
-
}
|
|
8596
|
-
|
|
8597
|
-
// If this is a DOM element, try to get the outer HTML.
|
|
8598
|
-
if (isDOMElement(value)) {
|
|
8599
|
-
if ('outerHTML' in value) {
|
|
8600
|
-
return value.outerHTML;
|
|
8601
|
-
// This value does not have an outerHTML attribute,
|
|
8602
|
-
// it could still be an XML element
|
|
8603
|
-
} else {
|
|
8604
|
-
// Attempt to serialize it
|
|
8605
|
-
try {
|
|
8606
|
-
if (document.xmlVersion) {
|
|
8607
|
-
var xmlSerializer = new XMLSerializer();
|
|
8608
|
-
return xmlSerializer.serializeToString(value);
|
|
8609
|
-
} else {
|
|
8610
|
-
// Firefox 11- do not support outerHTML
|
|
8611
|
-
// It does, however, support innerHTML
|
|
8612
|
-
// Use the following to render the element
|
|
8613
|
-
var ns = "http://www.w3.org/1999/xhtml";
|
|
8614
|
-
var container = document.createElementNS(ns, '_');
|
|
8615
|
-
|
|
8616
|
-
container.appendChild(value.cloneNode(false));
|
|
8617
|
-
var html = container.innerHTML
|
|
8618
|
-
.replace('><', '>' + value.innerHTML + '<');
|
|
8619
|
-
container.innerHTML = '';
|
|
8620
|
-
return html;
|
|
8621
|
-
}
|
|
8622
|
-
} catch (err) {
|
|
8623
|
-
// This could be a non-native DOM implementation,
|
|
8624
|
-
// continue with the normal flow:
|
|
8625
|
-
// printing the element as if it is an object.
|
|
8626
|
-
}
|
|
8627
|
-
}
|
|
8628
|
-
}
|
|
8629
|
-
|
|
8630
|
-
// Look up the keys of the object.
|
|
8631
|
-
var visibleKeys = getEnumerableProperties(value);
|
|
8632
|
-
var keys = ctx.showHidden ? getProperties(value) : visibleKeys;
|
|
8633
|
-
|
|
8634
|
-
var name, nameSuffix;
|
|
8635
|
-
|
|
8636
|
-
// Some type of object without properties can be shortcut.
|
|
8637
|
-
// In IE, errors have a single `stack` property, or if they are vanilla `Error`,
|
|
8638
|
-
// a `stack` plus `description` property; ignore those for consistency.
|
|
8639
|
-
if (keys.length === 0 || (isError(value) && (
|
|
8640
|
-
(keys.length === 1 && keys[0] === 'stack') ||
|
|
8641
|
-
(keys.length === 2 && keys[0] === 'description' && keys[1] === 'stack')
|
|
8642
|
-
))) {
|
|
8643
|
-
if (typeof value === 'function') {
|
|
8644
|
-
name = getName(value);
|
|
8645
|
-
nameSuffix = name ? ': ' + name : '';
|
|
8646
|
-
return ctx.stylize('[Function' + nameSuffix + ']', 'special');
|
|
8647
|
-
}
|
|
8648
|
-
if (isRegExp(value)) {
|
|
8649
|
-
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
|
8650
|
-
}
|
|
8651
|
-
if (isDate(value)) {
|
|
8652
|
-
return ctx.stylize(Date.prototype.toUTCString.call(value), 'date');
|
|
8653
|
-
}
|
|
8654
|
-
if (isError(value)) {
|
|
8655
|
-
return formatError(value);
|
|
8656
|
-
}
|
|
8657
|
-
}
|
|
8658
|
-
|
|
8659
|
-
var base = ''
|
|
8660
|
-
, array = false
|
|
8661
|
-
, typedArray = false
|
|
8662
|
-
, braces = ['{', '}'];
|
|
8663
|
-
|
|
8664
|
-
if (isTypedArray(value)) {
|
|
8665
|
-
typedArray = true;
|
|
8666
|
-
braces = ['[', ']'];
|
|
8667
|
-
}
|
|
8668
|
-
|
|
8669
|
-
// Make Array say that they are Array
|
|
8670
|
-
if (isArray(value)) {
|
|
8671
|
-
array = true;
|
|
8672
|
-
braces = ['[', ']'];
|
|
8673
|
-
}
|
|
8674
|
-
|
|
8675
|
-
// Make functions say that they are functions
|
|
8676
|
-
if (typeof value === 'function') {
|
|
8677
|
-
name = getName(value);
|
|
8678
|
-
nameSuffix = name ? ': ' + name : '';
|
|
8679
|
-
base = ' [Function' + nameSuffix + ']';
|
|
8680
|
-
}
|
|
8681
|
-
|
|
8682
|
-
// Make RegExps say that they are RegExps
|
|
8683
|
-
if (isRegExp(value)) {
|
|
8684
|
-
base = ' ' + RegExp.prototype.toString.call(value);
|
|
8685
|
-
}
|
|
8686
|
-
|
|
8687
|
-
// Make dates with properties first say the date
|
|
8688
|
-
if (isDate(value)) {
|
|
8689
|
-
base = ' ' + Date.prototype.toUTCString.call(value);
|
|
8690
|
-
}
|
|
8691
|
-
|
|
8692
|
-
// Make error with message first say the error
|
|
8693
|
-
if (isError(value)) {
|
|
8694
|
-
return formatError(value);
|
|
8695
|
-
}
|
|
8696
|
-
|
|
8697
|
-
if (keys.length === 0 && (!array || value.length == 0)) {
|
|
8698
|
-
return braces[0] + base + braces[1];
|
|
8699
|
-
}
|
|
8700
|
-
|
|
8701
|
-
if (recurseTimes < 0) {
|
|
8702
|
-
if (isRegExp(value)) {
|
|
8703
|
-
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
|
8704
|
-
} else {
|
|
8705
|
-
return ctx.stylize('[Object]', 'special');
|
|
8706
|
-
}
|
|
8707
|
-
}
|
|
8708
|
-
|
|
8709
|
-
ctx.seen.push(value);
|
|
8710
|
-
|
|
8711
|
-
var output;
|
|
8712
|
-
if (array) {
|
|
8713
|
-
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
|
8714
|
-
} else if (typedArray) {
|
|
8715
|
-
return formatTypedArray(value);
|
|
8716
|
-
} else {
|
|
8717
|
-
output = keys.map(function(key) {
|
|
8718
|
-
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
|
8719
|
-
});
|
|
8720
|
-
}
|
|
8721
|
-
|
|
8722
|
-
ctx.seen.pop();
|
|
8723
|
-
|
|
8724
|
-
return reduceToSingleString(output, base, braces);
|
|
8532
|
+
return loupe.inspect(obj, options);
|
|
8725
8533
|
}
|
|
8726
8534
|
|
|
8727
|
-
function
|
|
8728
|
-
switch (typeof value) {
|
|
8729
|
-
case 'undefined':
|
|
8730
|
-
return ctx.stylize('undefined', 'undefined');
|
|
8731
|
-
|
|
8732
|
-
case 'string':
|
|
8733
|
-
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
|
8734
|
-
.replace(/'/g, "\\'")
|
|
8735
|
-
.replace(/\\"/g, '"') + '\'';
|
|
8736
|
-
return ctx.stylize(simple, 'string');
|
|
8737
|
-
|
|
8738
|
-
case 'number':
|
|
8739
|
-
if (value === 0 && (1/value) === -Infinity) {
|
|
8740
|
-
return ctx.stylize('-0', 'number');
|
|
8741
|
-
}
|
|
8742
|
-
return ctx.stylize('' + value, 'number');
|
|
8743
|
-
|
|
8744
|
-
case 'boolean':
|
|
8745
|
-
return ctx.stylize('' + value, 'boolean');
|
|
8746
|
-
|
|
8747
|
-
case 'symbol':
|
|
8748
|
-
return ctx.stylize(value.toString(), 'symbol');
|
|
8749
|
-
|
|
8750
|
-
case 'bigint':
|
|
8751
|
-
return ctx.stylize(value.toString() + 'n', 'bigint');
|
|
8752
|
-
}
|
|
8753
|
-
// For some reason typeof null is "object", so special case here.
|
|
8754
|
-
if (value === null) {
|
|
8755
|
-
return ctx.stylize('null', 'null');
|
|
8756
|
-
}
|
|
8757
|
-
}
|
|
8758
|
-
|
|
8759
|
-
function formatError(value) {
|
|
8760
|
-
return '[' + Error.prototype.toString.call(value) + ']';
|
|
8761
|
-
}
|
|
8762
|
-
|
|
8763
|
-
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
|
8764
|
-
var output = [];
|
|
8765
|
-
for (var i = 0, l = value.length; i < l; ++i) {
|
|
8766
|
-
if (Object.prototype.hasOwnProperty.call(value, String(i))) {
|
|
8767
|
-
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
8768
|
-
String(i), true));
|
|
8769
|
-
} else {
|
|
8770
|
-
output.push('');
|
|
8771
|
-
}
|
|
8772
|
-
}
|
|
8773
|
-
|
|
8774
|
-
keys.forEach(function(key) {
|
|
8775
|
-
if (!key.match(/^\d+$/)) {
|
|
8776
|
-
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
|
8777
|
-
key, true));
|
|
8778
|
-
}
|
|
8779
|
-
});
|
|
8780
|
-
return output;
|
|
8781
|
-
}
|
|
8782
|
-
|
|
8783
|
-
function formatTypedArray(value) {
|
|
8784
|
-
var str = '[ ';
|
|
8785
|
-
|
|
8786
|
-
for (var i = 0; i < value.length; ++i) {
|
|
8787
|
-
if (str.length >= config.truncateThreshold - 7) {
|
|
8788
|
-
str += '...';
|
|
8789
|
-
break;
|
|
8790
|
-
}
|
|
8791
|
-
str += value[i] + ', ';
|
|
8792
|
-
}
|
|
8793
|
-
str += ' ]';
|
|
8794
|
-
|
|
8795
|
-
// Removing trailing `, ` if the array was not truncated
|
|
8796
|
-
if (str.indexOf(', ]') !== -1) {
|
|
8797
|
-
str = str.replace(', ]', ' ]');
|
|
8798
|
-
}
|
|
8799
|
-
|
|
8800
|
-
return str;
|
|
8801
|
-
}
|
|
8802
|
-
|
|
8803
|
-
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
|
8804
|
-
var name;
|
|
8805
|
-
var propDescriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
8806
|
-
var str;
|
|
8807
|
-
|
|
8808
|
-
if (propDescriptor) {
|
|
8809
|
-
if (propDescriptor.get) {
|
|
8810
|
-
if (propDescriptor.set) {
|
|
8811
|
-
str = ctx.stylize('[Getter/Setter]', 'special');
|
|
8812
|
-
} else {
|
|
8813
|
-
str = ctx.stylize('[Getter]', 'special');
|
|
8814
|
-
}
|
|
8815
|
-
} else {
|
|
8816
|
-
if (propDescriptor.set) {
|
|
8817
|
-
str = ctx.stylize('[Setter]', 'special');
|
|
8818
|
-
}
|
|
8819
|
-
}
|
|
8820
|
-
}
|
|
8821
|
-
if (visibleKeys.indexOf(key) < 0) {
|
|
8822
|
-
name = '[' + key + ']';
|
|
8823
|
-
}
|
|
8824
|
-
if (!str) {
|
|
8825
|
-
if (ctx.seen.indexOf(value[key]) < 0) {
|
|
8826
|
-
if (recurseTimes === null) {
|
|
8827
|
-
str = formatValue(ctx, value[key], null);
|
|
8828
|
-
} else {
|
|
8829
|
-
str = formatValue(ctx, value[key], recurseTimes - 1);
|
|
8830
|
-
}
|
|
8831
|
-
if (str.indexOf('\n') > -1) {
|
|
8832
|
-
if (array) {
|
|
8833
|
-
str = str.split('\n').map(function(line) {
|
|
8834
|
-
return ' ' + line;
|
|
8835
|
-
}).join('\n').substr(2);
|
|
8836
|
-
} else {
|
|
8837
|
-
str = '\n' + str.split('\n').map(function(line) {
|
|
8838
|
-
return ' ' + line;
|
|
8839
|
-
}).join('\n');
|
|
8840
|
-
}
|
|
8841
|
-
}
|
|
8842
|
-
} else {
|
|
8843
|
-
str = ctx.stylize('[Circular]', 'special');
|
|
8844
|
-
}
|
|
8845
|
-
}
|
|
8846
|
-
if (typeof name === 'undefined') {
|
|
8847
|
-
if (array && key.match(/^\d+$/)) {
|
|
8848
|
-
return str;
|
|
8849
|
-
}
|
|
8850
|
-
name = JSON.stringify('' + key);
|
|
8851
|
-
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
|
8852
|
-
name = name.substr(1, name.length - 2);
|
|
8853
|
-
name = ctx.stylize(name, 'name');
|
|
8854
|
-
} else {
|
|
8855
|
-
name = name.replace(/'/g, "\\'")
|
|
8856
|
-
.replace(/\\"/g, '"')
|
|
8857
|
-
.replace(/(^"|"$)/g, "'");
|
|
8858
|
-
name = ctx.stylize(name, 'string');
|
|
8859
|
-
}
|
|
8860
|
-
}
|
|
8861
|
-
|
|
8862
|
-
return name + ': ' + str;
|
|
8863
|
-
}
|
|
8864
|
-
|
|
8865
|
-
function reduceToSingleString(output, base, braces) {
|
|
8866
|
-
var length = output.reduce(function(prev, cur) {
|
|
8867
|
-
return prev + cur.length + 1;
|
|
8868
|
-
}, 0);
|
|
8869
|
-
|
|
8870
|
-
if (length > 60) {
|
|
8871
|
-
return braces[0] +
|
|
8872
|
-
(base === '' ? '' : base + '\n ') +
|
|
8873
|
-
' ' +
|
|
8874
|
-
output.join(',\n ') +
|
|
8875
|
-
' ' +
|
|
8876
|
-
braces[1];
|
|
8877
|
-
}
|
|
8878
|
-
|
|
8879
|
-
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
|
8880
|
-
}
|
|
8881
|
-
|
|
8882
|
-
function isTypedArray(ar) {
|
|
8883
|
-
// Unfortunately there's no way to check if an object is a TypedArray
|
|
8884
|
-
// We have to check if it's one of these types
|
|
8885
|
-
return (typeof ar === 'object' && /\w+Array]$/.test(objectToString(ar)));
|
|
8886
|
-
}
|
|
8887
|
-
|
|
8888
|
-
function isArray(ar) {
|
|
8889
|
-
return Array.isArray(ar) ||
|
|
8890
|
-
(typeof ar === 'object' && objectToString(ar) === '[object Array]');
|
|
8891
|
-
}
|
|
8892
|
-
|
|
8893
|
-
function isRegExp(re) {
|
|
8894
|
-
return typeof re === 'object' && objectToString(re) === '[object RegExp]';
|
|
8895
|
-
}
|
|
8896
|
-
|
|
8897
|
-
function isDate(d) {
|
|
8898
|
-
return typeof d === 'object' && objectToString(d) === '[object Date]';
|
|
8899
|
-
}
|
|
8900
|
-
|
|
8901
|
-
function isError(e) {
|
|
8902
|
-
return typeof e === 'object' && objectToString(e) === '[object Error]';
|
|
8903
|
-
}
|
|
8904
|
-
|
|
8905
|
-
function objectToString(o) {
|
|
8906
|
-
return Object.prototype.toString.call(o);
|
|
8907
|
-
}
|
|
8908
|
-
|
|
8909
|
-
},{"../config":4,"./getEnumerableProperties":17,"./getProperties":22,"get-func-name":37}],25:[function(require,module,exports){
|
|
8535
|
+
},{"../config":4,"get-func-name":36,"loupe":37}],24:[function(require,module,exports){
|
|
8910
8536
|
/*!
|
|
8911
8537
|
* Chai - isNaN utility
|
|
8912
8538
|
* Copyright(c) 2012-2015 Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
|
@@ -8934,7 +8560,7 @@ function isNaN(value) {
|
|
|
8934
8560
|
// If ECMAScript 6's Number.isNaN is present, prefer that.
|
|
8935
8561
|
module.exports = Number.isNaN || isNaN;
|
|
8936
8562
|
|
|
8937
|
-
},{}],
|
|
8563
|
+
},{}],25:[function(require,module,exports){
|
|
8938
8564
|
var config = require('../config');
|
|
8939
8565
|
|
|
8940
8566
|
/*!
|
|
@@ -8960,7 +8586,7 @@ module.exports = function isProxyEnabled() {
|
|
|
8960
8586
|
typeof Reflect !== 'undefined';
|
|
8961
8587
|
};
|
|
8962
8588
|
|
|
8963
|
-
},{"../config":4}],
|
|
8589
|
+
},{"../config":4}],26:[function(require,module,exports){
|
|
8964
8590
|
/*!
|
|
8965
8591
|
* Chai - flag utility
|
|
8966
8592
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -9012,7 +8638,7 @@ module.exports = function objDisplay(obj) {
|
|
|
9012
8638
|
}
|
|
9013
8639
|
};
|
|
9014
8640
|
|
|
9015
|
-
},{"../config":4,"./inspect":
|
|
8641
|
+
},{"../config":4,"./inspect":23}],27:[function(require,module,exports){
|
|
9016
8642
|
/*!
|
|
9017
8643
|
* Chai - overwriteChainableMethod utility
|
|
9018
8644
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -9083,7 +8709,7 @@ module.exports = function overwriteChainableMethod(ctx, name, method, chainingBe
|
|
|
9083
8709
|
};
|
|
9084
8710
|
};
|
|
9085
8711
|
|
|
9086
|
-
},{"../../chai":2,"./transferFlags":
|
|
8712
|
+
},{"../../chai":2,"./transferFlags":32}],28:[function(require,module,exports){
|
|
9087
8713
|
/*!
|
|
9088
8714
|
* Chai - overwriteMethod utility
|
|
9089
8715
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -9177,7 +8803,7 @@ module.exports = function overwriteMethod(ctx, name, method) {
|
|
|
9177
8803
|
ctx[name] = proxify(overwritingMethodWrapper, name);
|
|
9178
8804
|
};
|
|
9179
8805
|
|
|
9180
|
-
},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":
|
|
8806
|
+
},{"../../chai":2,"./addLengthGuard":10,"./flag":15,"./proxify":30,"./transferFlags":32}],29:[function(require,module,exports){
|
|
9181
8807
|
/*!
|
|
9182
8808
|
* Chai - overwriteProperty utility
|
|
9183
8809
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -9271,7 +8897,7 @@ module.exports = function overwriteProperty(ctx, name, getter) {
|
|
|
9271
8897
|
});
|
|
9272
8898
|
};
|
|
9273
8899
|
|
|
9274
|
-
},{"../../chai":2,"./flag":15,"./isProxyEnabled":
|
|
8900
|
+
},{"../../chai":2,"./flag":15,"./isProxyEnabled":25,"./transferFlags":32}],30:[function(require,module,exports){
|
|
9275
8901
|
var config = require('../config');
|
|
9276
8902
|
var flag = require('./flag');
|
|
9277
8903
|
var getProperties = require('./getProperties');
|
|
@@ -9420,7 +9046,7 @@ function stringDistanceCapped(strA, strB, cap) {
|
|
|
9420
9046
|
return memo[strA.length][strB.length];
|
|
9421
9047
|
}
|
|
9422
9048
|
|
|
9423
|
-
},{"../config":4,"./flag":15,"./getProperties":
|
|
9049
|
+
},{"../config":4,"./flag":15,"./getProperties":21,"./isProxyEnabled":25}],31:[function(require,module,exports){
|
|
9424
9050
|
/*!
|
|
9425
9051
|
* Chai - test utility
|
|
9426
9052
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -9450,7 +9076,7 @@ module.exports = function test(obj, args) {
|
|
|
9450
9076
|
return negate ? !expr : expr;
|
|
9451
9077
|
};
|
|
9452
9078
|
|
|
9453
|
-
},{"./flag":15}],
|
|
9079
|
+
},{"./flag":15}],32:[function(require,module,exports){
|
|
9454
9080
|
/*!
|
|
9455
9081
|
* Chai - transferFlags utility
|
|
9456
9082
|
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
|
@@ -9497,7 +9123,7 @@ module.exports = function transferFlags(assertion, object, includeAll) {
|
|
|
9497
9123
|
}
|
|
9498
9124
|
};
|
|
9499
9125
|
|
|
9500
|
-
},{}],
|
|
9126
|
+
},{}],33:[function(require,module,exports){
|
|
9501
9127
|
/*!
|
|
9502
9128
|
* assertion-error
|
|
9503
9129
|
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
|
@@ -9615,7 +9241,7 @@ AssertionError.prototype.toJSON = function (stack) {
|
|
|
9615
9241
|
return props;
|
|
9616
9242
|
};
|
|
9617
9243
|
|
|
9618
|
-
},{}],
|
|
9244
|
+
},{}],34:[function(require,module,exports){
|
|
9619
9245
|
'use strict';
|
|
9620
9246
|
|
|
9621
9247
|
/* !
|
|
@@ -9789,7 +9415,7 @@ module.exports = {
|
|
|
9789
9415
|
getConstructorName: getConstructorName,
|
|
9790
9416
|
};
|
|
9791
9417
|
|
|
9792
|
-
},{}],
|
|
9418
|
+
},{}],35:[function(require,module,exports){
|
|
9793
9419
|
'use strict';
|
|
9794
9420
|
/* globals Symbol: false, Uint8Array: false, WeakMap: false */
|
|
9795
9421
|
/*!
|
|
@@ -10246,7 +9872,7 @@ function isPrimitive(value) {
|
|
|
10246
9872
|
return value === null || typeof value !== 'object';
|
|
10247
9873
|
}
|
|
10248
9874
|
|
|
10249
|
-
},{"type-detect":39}],
|
|
9875
|
+
},{"type-detect":39}],36:[function(require,module,exports){
|
|
10250
9876
|
'use strict';
|
|
10251
9877
|
|
|
10252
9878
|
/* !
|
|
@@ -10292,7 +9918,1230 @@ function getFuncName(aFunc) {
|
|
|
10292
9918
|
|
|
10293
9919
|
module.exports = getFuncName;
|
|
10294
9920
|
|
|
10295
|
-
},{}],
|
|
9921
|
+
},{}],37:[function(require,module,exports){
|
|
9922
|
+
(function (global, factory) {
|
|
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
|
+
}(this, (function (exports) { 'use strict';
|
|
9927
|
+
|
|
9928
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
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;
|
|
11139
|
+
|
|
11140
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
11141
|
+
|
|
11142
|
+
})));
|
|
11143
|
+
|
|
11144
|
+
},{"util":undefined}],38:[function(require,module,exports){
|
|
10296
11145
|
'use strict';
|
|
10297
11146
|
|
|
10298
11147
|
/* !
|