diff options
Diffstat (limited to 'lib/internal/util')
-rw-r--r-- | lib/internal/util/comparisons.js | 6 | ||||
-rw-r--r-- | lib/internal/util/inspect.js | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/lib/internal/util/comparisons.js b/lib/internal/util/comparisons.js index a895da2ad1..b3256716c3 100644 --- a/lib/internal/util/comparisons.js +++ b/lib/internal/util/comparisons.js @@ -294,7 +294,7 @@ function keyCheck(val1, val2, strict, memos, iterationType, aKeys) { if (aKeys.length === 0 && (iterationType === kNoIterator || - iterationType === kIsArray && val1.length === 0 || + (iterationType === kIsArray && val1.length === 0) || val1.size === 0)) { return true; } @@ -383,7 +383,7 @@ function mapMightHaveLoosePrim(a, b, prim, item, memo) { return altValue; } const curB = b.get(altValue); - if (curB === undefined && !b.has(altValue) || + if ((curB === undefined && !b.has(altValue)) || !innerDeepEqual(item, curB, false, memo)) { return false; } @@ -470,7 +470,7 @@ function mapEquiv(a, b, strict, memo) { // By directly retrieving the value we prevent another b.has(key) check in // almost all possible cases. const item2 = b.get(key); - if ((item2 === undefined && !b.has(key) || + if (((item2 === undefined && !b.has(key)) || !innerDeepEqual(item1, item2, strict, memo))) { if (strict) return false; 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, { |