Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
  • Loading branch information
Trott committed May 30, 2018
commit 0bc8145f8efb373fbfa92e1543faa34d0a831762
5 changes: 3 additions & 2 deletions benchmark/assert/deepequal-typedarrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ 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);
const expectedWrong = Buffer.alloc(len);
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();
Expand Down