🔧 npm update
This commit is contained in:
42
node_modules/object-inspect/index.js
generated
vendored
42
node_modules/object-inspect/index.js
generated
vendored
@@ -69,10 +69,21 @@ var utilInspect = require('./util.inspect');
|
||||
var inspectCustom = utilInspect.custom;
|
||||
var inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;
|
||||
|
||||
var quotes = {
|
||||
__proto__: null,
|
||||
'double': '"',
|
||||
single: "'"
|
||||
};
|
||||
var quoteREs = {
|
||||
__proto__: null,
|
||||
'double': /(["\\])/g,
|
||||
single: /(['\\])/g
|
||||
};
|
||||
|
||||
module.exports = function inspect_(obj, options, depth, seen) {
|
||||
var opts = options || {};
|
||||
|
||||
if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
|
||||
if (has(opts, 'quoteStyle') && !has(quotes, opts.quoteStyle)) {
|
||||
throw new TypeError('option "quoteStyle" must be "single" or "double"');
|
||||
}
|
||||
if (
|
||||
@@ -244,7 +255,10 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
||||
if (typeof window !== 'undefined' && obj === window) {
|
||||
return '{ [object Window] }';
|
||||
}
|
||||
if (obj === global) {
|
||||
if (
|
||||
(typeof globalThis !== 'undefined' && obj === globalThis)
|
||||
|| (typeof global !== 'undefined' && obj === global)
|
||||
) {
|
||||
return '{ [object globalThis] }';
|
||||
}
|
||||
if (!isDate(obj) && !isRegExp(obj)) {
|
||||
@@ -264,7 +278,8 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
||||
};
|
||||
|
||||
function wrapQuotes(s, defaultStyle, opts) {
|
||||
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
|
||||
var style = opts.quoteStyle || defaultStyle;
|
||||
var quoteChar = quotes[style];
|
||||
return quoteChar + s + quoteChar;
|
||||
}
|
||||
|
||||
@@ -272,13 +287,16 @@ function quote(s) {
|
||||
return $replace.call(String(s), /"/g, '"');
|
||||
}
|
||||
|
||||
function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
||||
function canTrustToString(obj) {
|
||||
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
||||
}
|
||||
function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
||||
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
||||
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
||||
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
||||
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
||||
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
||||
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
||||
|
||||
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
||||
function isSymbol(obj) {
|
||||
@@ -422,8 +440,10 @@ function inspectString(str, opts) {
|
||||
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
||||
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
||||
}
|
||||
var quoteRE = quoteREs[opts.quoteStyle || 'single'];
|
||||
quoteRE.lastIndex = 0;
|
||||
// eslint-disable-next-line no-control-regex
|
||||
var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
||||
var s = $replace.call($replace.call(str, quoteRE, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
||||
return wrapQuotes(s, 'single', opts);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user