Repository navigation
fix: avoid mutating source array - #16346
Merged
kgryte merged 2 commits intoOct 29, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: sarthakkaushik927 <sarthakkaushik927@gmail.com>
kgryte
reviewed
Oct 29, 2026
kgryte
reviewed
Oct 29, 2026
Copy the underlying bytes directly instead of copying element-by-element via accessors, and avoid testing private properties. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: sarthakkaushik927 <sarthakkaushik927@gmail.com>
kgryte
approved these changes
Oct 29, 2026
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
Member
|
As the CI failure is not due to changes introduced in this PR, I'll go ahead and merge. |
array/fixed-endian-factory#with
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
fixes the
withmethod inarray/fixed-endian-factory, which created the returned array from the same underlyingArrayBufferas the source array. As a consequence, (1) setting the new value mutated the source array and (2) for arrays which are views on a buffer having a non-zero byte offset and/or a shorter length, the returned array had the wrong length and the new value was written at the wrong position.copies the source elements into a newly allocated array before setting the provided value, and adds regression tests for source mutation, views on a buffer, and byte order preservation.
Related Issues
No.
Reference Packages
This pull request followed these packages:
array/fixed-endian-factory(existingfilterandmapmethods)Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
I used Claude Code to help generate the tests and documentation. I reviewed all changes and ran the package tests locally.
@stdlib-js/reviewers