Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 3 additions & 7 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const { compare } = process.binding('buffer');
const util = require('util');
const { isSet, isMap } = process.binding('util');
const { objectToString } = require('internal/util');
const { Buffer } = require('buffer');
const errors = require('internal/errors');

// The assert module provides functions that throw
Expand Down Expand Up @@ -124,6 +123,7 @@ function areSimilarRegExps(a, b) {
// The c++ barrier takes the advantage of the faster compare otherwise.
// 300 was the number after which compare became faster.
function areSimilarTypedArrays(a, b) {
const { from } = require('buffer').Buffer;
const len = a.byteLength;
if (len !== b.byteLength) {
return false;
Expand All @@ -136,12 +136,8 @@ function areSimilarTypedArrays(a, b) {
}
return true;
}
return compare(Buffer.from(a.buffer,
a.byteOffset,
len),
Buffer.from(b.buffer,
b.byteOffset,
b.byteLength)) === 0;
return compare(from(a.buffer, a.byteOffset, len),
from(b.buffer, b.byteOffset, b.byteLength)) === 0;
}

function isFloatTypedArrayTag(tag) {
Expand Down
Loading