Skip to content

as_Array is broken #19

@athanclark

Description

@athanclark

Here's a minimal example:

arr :: DataView
arr = whole (fromArray [12.0, 23.0, 53.0, 0.0]) -- we need one number for each byte

getUint32le arr 0 -- Just 3479308u

getUint32le (dataView (asUint32Array arr)) 0 -- runtime exception - cannot read property `call` of undefined

I noticed that the implementation for fromArray simply builds it out of a Uint8Array, where each Number is one byte. However, asUint32Array builds a new typed array using the previous buffer. I wonder if there's just some faulty logic going on bit-wise in regards to the buffer offset or bytelength or something. If this library is no longer being maintained, I might redesign some of it if that's alright - I'm probably not gonna touch the type designs you have, but I might make the actual functions a little more true to the js api.

Thanks for making this regardless!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions