diff options
author | Rich Trott <rtrott@gmail.com> | 2019-05-20 16:27:37 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-05-23 10:23:15 -0700 |
commit | 99268b1e996d13a0aeda7aa112796484fe4e4238 (patch) | |
tree | 54e72b2b51e3cc6a7af99b570d474611a4f24ed9 /lib/internal/assert | |
parent | 60b315c0646aeb0bf4e40d5a7490e9548b714ce2 (diff) | |
download | android-node-v8-99268b1e996d13a0aeda7aa112796484fe4e4238.tar.gz android-node-v8-99268b1e996d13a0aeda7aa112796484fe4e4238.tar.bz2 android-node-v8-99268b1e996d13a0aeda7aa112796484fe4e4238.zip |
assert: remove unreachable code
In lib/internal/assert/assertion_error.js, line 391 assures that
`operator` is 'deepEqual' so there is no need to check the value of
`operator` in a ternary on the next line (line 392). Remove the ternary.
PR-URL: https://github.com/nodejs/node/pull/27786
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/assert')
-rw-r--r-- | lib/internal/assert/assertion_error.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/internal/assert/assertion_error.js b/lib/internal/assert/assertion_error.js index 7b62fca035..29c5c966a1 100644 --- a/lib/internal/assert/assertion_error.js +++ b/lib/internal/assert/assertion_error.js @@ -374,9 +374,9 @@ class AssertionError extends Error { } else { let res = inspectValue(actual); let other = inspectValue(expected); - const knownOperators = kReadableOperator[operator]; + const knownOperator = kReadableOperator[operator]; if (operator === 'notDeepEqual' && res === other) { - res = `${knownOperators}\n\n${res}`; + res = `${knownOperator}\n\n${res}`; if (res.length > 1024) { res = `${res.slice(0, 1021)}...`; } @@ -389,8 +389,7 @@ class AssertionError extends Error { other = `${other.slice(0, 509)}...`; } if (operator === 'deepEqual') { - const eq = operator === 'deepEqual' ? 'deep-equal' : 'equal'; - res = `${knownOperators}\n\n${res}\n\nshould loosely ${eq}\n\n`; + res = `${knownOperator}\n\n${res}\n\nshould loosely deep-equal\n\n`; } else { const newOperator = kReadableOperator[`${operator}Unequal`]; if (newOperator) { |