From 739f113ba63367a93e1567032d85573a079b97b5 Mon Sep 17 00:00:00 2001 From: ZYSzys Date: Fri, 4 Oct 2019 00:35:41 +0800 Subject: lib: introduce no-mixed-operators eslint rule to lib PR-URL: https://github.com/nodejs/node/pull/29834 Reviewed-By: Anna Henningsen Reviewed-By: Gus Caplan Reviewed-By: Luigi Pinca Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- lib/assert.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/assert.js') diff --git a/lib/assert.js b/lib/assert.js index 5f9a39abf0..a83dba770e 100644 --- a/lib/assert.js +++ b/lib/assert.js @@ -622,7 +622,7 @@ function expectedException(actual, expected, message, fn) { message = 'The error is expected to be an instance of ' + `"${expected.name}". Received `; if (isError(actual)) { - const name = actual.constructor && actual.constructor.name || + const name = (actual.constructor && actual.constructor.name) || actual.name; if (expected.name === name) { message += 'an error with identical name but a different prototype.'; @@ -685,9 +685,9 @@ function checkIsPromise(obj) { // way. Do not accept thenables that use a function as `obj` and that have no // `catch` handler. return isPromise(obj) || - obj !== null && typeof obj === 'object' && + (obj !== null && typeof obj === 'object' && typeof obj.then === 'function' && - typeof obj.catch === 'function'; + typeof obj.catch === 'function'); } async function waitForActual(promiseFn) { -- cgit v1.2.3