Skip to content

fix: compare DataViews by their effective byte range - #114

Merged
43081j merged 1 commit into
chaijs:mainfrom
spokodev:fix/dataview-effective-bytes
Sep 5, 2026
Merged

fix: compare DataViews by their effective byte range#114
43081j merged 1 commit into
chaijs:mainfrom
spokodev:fix/dataview-effective-bytes

Conversation

@spokodev

@spokodev spokodev commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

deep-eql compares two DataViews by their full backing ArrayBuffers, ignoring byteOffset/byteLength. So two views over the same buffer at different offsets with different bytes compare equal (a false positive — the assertion passes when the payloads differ), and two views over different buffers with identical effective bytes compare unequal. Node's util.isDeepStrictEqual scopes the comparison to the view window; this does the same.

This is the fix suggested by @keithamus in #53 ("slice the ArrayBuffers by the respective byteOffset and byteLength").

Fixes #53.

@43081j
43081j merged commit b94b811 into chaijs:main Sep 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dataview comparison ignores offsets

2 participants