benchmark: refactor deepequal-typedarrays

This is a minor refactor of benchmark/assert/deepequal-typedarrays.js to
reduce exceptions that need to be made for lint compliance.

PR-URL: https://github.com/nodejs/node/pull/21030
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Rich Trott 2018-05-30 03:53:11 +00:00
parent 9cd4a23b79
commit b8f8ca5702

View File

@ -25,6 +25,8 @@ const bench = common.createBenchmark(main, {
});
function main({ type, n, len, method }) {
if (!method)
method = 'deepEqual';
const clazz = global[type];
const actual = new clazz(len);
const expected = new clazz(len);
@ -32,8 +34,7 @@ function main({ type, n, len, method }) {
const wrongIndex = Math.floor(len / 2);
expectedWrong[wrongIndex] = 123;
// eslint-disable-next-line no-restricted-properties
const fn = method !== '' ? assert[method] : assert.deepEqual;
const fn = assert[method];
const value2 = method.includes('not') ? expectedWrong : expected;
bench.start();