diff options
Diffstat (limited to 'lib/internal/util/inspect.js')
-rw-r--r-- | lib/internal/util/inspect.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 6401e30e92..39cbfd36b7 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -599,10 +599,10 @@ function formatRaw(ctx, value, recurseTimes, typedArray) { // Only list the tag in case it's non-enumerable / not an own property. // Otherwise we'd print this twice. if (typeof tag !== 'string' || - tag !== '' && + (tag !== '' && (ctx.showHidden ? hasOwnProperty : propertyIsEnumerable)( value, Symbol.toStringTag - )) { + ))) { tag = ''; } let base = ''; @@ -686,7 +686,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) { const prefix = getPrefix(constructor, tag, 'RegExp'); if (prefix !== 'RegExp ') base = `${prefix}${base}`; - if (keys.length === 0 || recurseTimes > ctx.depth && ctx.depth !== null) + if (keys.length === 0 || (recurseTimes > ctx.depth && ctx.depth !== null)) return ctx.stylize(base, 'regexp'); } else if (isDate(value)) { // Make dates with properties first say the date @@ -914,14 +914,14 @@ function formatError(err, constructor, tag, ctx) { const name = err.name || 'Error'; let len = name.length; if (constructor === null || - name.endsWith('Error') && + (name.endsWith('Error') && stack.startsWith(name) && - (stack.length === len || stack[len] === ':' || stack[len] === '\n')) { + (stack.length === len || stack[len] === ':' || stack[len] === '\n'))) { let fallback = 'Error'; if (constructor === null) { const start = stack.match(/^([A-Z][a-z_ A-Z0-9[\]()-]+)(?::|\n {4}at)/) || stack.match(/^([a-z_A-Z0-9-]*Error)$/); - fallback = start && start[1] || ''; + fallback = (start && start[1]) || ''; len = fallback.length; fallback = fallback || 'Error'; } @@ -939,7 +939,7 @@ function formatError(err, constructor, tag, ctx) { } } // Ignore the error message if it's contained in the stack. - let pos = err.message && stack.indexOf(err.message) || -1; + let pos = (err.message && stack.indexOf(err.message)) || -1; if (pos !== -1) pos += err.message.length; // Wrap the error in brackets in case it has no stack trace. @@ -1419,8 +1419,8 @@ function formatProperty(ctx, value, recurseTimes, key, type) { const s = ctx.stylize; const sp = 'special'; if (ctx.getters && (ctx.getters === true || - ctx.getters === 'get' && desc.set === undefined || - ctx.getters === 'set' && desc.set !== undefined)) { + (ctx.getters === 'get' && desc.set === undefined) || + (ctx.getters === 'set' && desc.set !== undefined))) { try { const tmp = value[key]; ctx.indentationLvl += 2; @@ -1597,15 +1597,15 @@ function formatWithOptions(inspectOptions, ...args) { let constr; if (typeof tempArg !== 'object' || tempArg === null || - typeof tempArg.toString === 'function' && + (typeof tempArg.toString === 'function' && // A direct own property. (hasOwnProperty(tempArg, 'toString') || // A direct own property on the constructor prototype in // case the constructor is not an built-in object. - (constr = tempArg.constructor) && + ((constr = tempArg.constructor) && !builtInObjects.has(constr.name) && constr.prototype && - hasOwnProperty(constr.prototype, 'toString'))) { + hasOwnProperty(constr.prototype, 'toString'))))) { tempStr = String(tempArg); } else { tempStr = inspect(tempArg, { |