rtfeldman / seamless-immutable

Immutable data structures for JavaScript which are backwards-compatible with normal JS Arrays and Objects.
BSD 3-Clause "New" or "Revised" License
5.37k stars 195 forks source link

Typed arrays (such as Uint8Array) #114

Open jdmunro opened 8 years ago

jdmunro commented 8 years ago

Does seamless-immutable have (or could it have) support for typed arrays such as Uint8Array?

An initial investigation suggests that it does not:

const typedArray = Immutable(new Uint8Array(4096)).filter(() => true); // Immutable(...).filter is not a function
const plainArray = Immutable(new Array(4096)).filter(() => true); // Works fine

If not already supported - is there any technical reason that this couldn't be added?

rtfeldman commented 8 years ago

I honestly don't know. I tend to focus on concrete use cases; is this blocking you on a particular project?

philippotto commented 7 years ago

+1 We use seamless-immutable in combination with redux and have some data in typed arrays for which support would be nice.

skrat commented 7 years ago

This is rather weird, I think seamless-immutable shouldn't be coercing objects with unknown types to either lists or maps. We also need to store typed array in an immutable map but there doesn't seem to be a way.

mikeaustin commented 5 years ago

I just ran into this. I started using a typed array in my Redux store, and it complained about .subarray() not being defined. Is there a way to wrap typed arrays in seamless?