Skip to content

feat(js): add typed array toArray - #70

Merged
spiral-ladder merged 1 commit into
mainfrom
bing/typed-array-to-array
Jul 31, 2026
Merged

feat(js): add typed array toArray#70
spiral-ladder merged 1 commit into
mainfrom
bing/typed-array-to-array

Conversation

@spiral-ladder

Copy link
Copy Markdown
Member

closes #69

Comment thread examples/js_dsl/mod.zig
}

/// Sum exactly four bytes copied from a Uint8Array into a Zig array.
pub fn uint8Array4Sum(data: Uint8Array) !Number {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this fn for? Did this get committed accidentally?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, it's just an example usage of toArray (like the rest of the fn in this file)

but honestly im not a fan of the entire examples/ dir to begin with but not sure of a better alternative at this time

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, sorry, my sloppy review. I didn't see that this was an example.

Comment thread src/js/typed_arrays.zig
/// Returns:
/// 1) `error.LengthMismatch` when the TypedArray length differs from
/// `len`, or
/// 2) `error.TypeMismatch` when its element type is wrong.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, best for a separate PR: it would be nice to define the error sets for consumer use and use explicit error sets in return types.

@spiral-ladder
spiral-ladder merged commit ab42ab0 into main Jul 31, 2026
5 checks passed
@spiral-ladder
spiral-ladder deleted the bing/typed-array-to-array branch July 31, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

feature request: toArray

2 participants