There are currently 11 kinds of Typed Array in the language.
Stage: 1
I'd like to dynamically dispatch to DataView methods based on the "type" of the Typed Array. This works great for all of the types except Uint8Clamped.
Only 10 of them have DataView get/set methods.
Here's a matrix representing the consistently available functionality for each of them:
Name | constructor | shared prototype | ArrayBuffers | DataView get method | DataView set method |
---|---|---|---|---|---|
Int8Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Uint8Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Uint8ClampedArray | ✅ | ✅ | ✅ | ❌ | ❌ |
Int16Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Uint16Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Int32Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Uint32Array | ✅ | ✅ | ✅ | ✅ | ✅ |
BigInt64Array | ✅ | ✅ | ✅ | ✅ | ✅ |
BigUint64Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Float32Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Float64Array | ✅ | ✅ | ✅ | ✅ | ✅ |
Add the get and set methods to round out Typed Array support.
- dynamic dispatch based on Typed Array type: https://github.com/esfx/esfx/blob/main/packages/struct-type/src/internal/numbers.ts#L122-L133