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: #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>
  • Loading branch information
Trott authored and MylesBorins committed Jun 6, 2018
1 parent c8ee379 commit 90d8658
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 90d8658

Please sign in to comment.