benchmark: refactor prims-and-objs-big-loop

This is a minor refactor of
benchmark/assert/deepequal-prims-and-objs-big-loop.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:47:41 +00:00
parent 7bfc00d848
commit 30650a62d9

View File

@ -25,13 +25,14 @@ const bench = common.createBenchmark(main, {
});
function main({ n, primitive, method }) {
if (!method)
method = 'deepEqual';
const prim = primValues[primitive];
const actual = prim;
const expected = prim;
const expectedWrong = 'b';
// 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();