feross / feross/buffer

Implementation of the `equals` method differs from Node.js

Open
#218 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
1.9k
Forks
260
PR merge metrics
No merged PRs in 30d

Description

Node.js Buffers allow the equality comparison with an Uint8Array, but here it throws a `TypeError`

For example, this simple statement :

`Buffer.from([1 , 2, 3]).equals(new Uint8Array([1, 2, 3]))`

returns `true` on Node.js, but throws an error in the browser.

The equivalent Node.js implementation is here : https://github.com/nodejs/node/blob/88105c998ef9d3f54aa8f22b82ec8cc31cbfac95/lib/buffer.js#L671

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.