Skip to content

Commit

Permalink
benchmark: refactor deepequal-buffer
Browse files Browse the repository at this point in the history
This is a minor refactor of benchmark/assert/deepequal-buffer.js to
reduce exceptions that need to be made for lint compliance.

PR-URL: nodejs#21030
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
  • Loading branch information
Trott committed Jun 2, 2018
1 parent 6168959 commit 206b19c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions benchmark/assert/deepequal-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const bench = common.createBenchmark(main, {
});

function main({ len, n, method }) {
if (!method)
method = 'deepEqual';
const data = Buffer.allocUnsafe(len + 1);
const actual = Buffer.alloc(len);
const expected = Buffer.alloc(len);
Expand All @@ -22,8 +24,7 @@ function main({ len, n, method }) {
data.copy(expected);
data.copy(expectedWrong);

// 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();
Expand Down

0 comments on commit 206b19c

Please sign in to comment.