bs-typed-array

0.1.1 • Public • Published

bs-typed-array

Fairly similar binding to the TypedArray classes.

See BsTypedArray_TypedArray.rei for available bindings.

See the MDN web docs for the javascript interfaces these are based off. The interfaces are very similar to standard arrays.

Installation

npm install --save bs-typed-array

Then add bs-typed-array to bs-dependencies in your bsconfig.json:

{
  ...
  "bs-dependencies": ["bs-typed-array", ...]
}

Example

 
open BsTypedArray;
 
let array = TypedArray.from(TypedArray.Uint16, [|1, 3, 5, 6|]);
 
let copy = TypedArray.copyFromTypedArray(TypedArray.Int16, array);
 
let mapped = TypedArray.map(copy, (. a, _index) => - a);
 
Js.log(array);
Js.log(copy);
Js.log(mapped);
/**
 * Uint16Array [ 1, 3, 5, 6 ]
 * Int16Array [ 1, 3, 5, 6 ]
 * Int16Array [ -1, -3, -5, -6 ]
 */;
 

Package Sidebar

Install

npm i bs-typed-array

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

20.9 kB

Total Files

9

Last publish

Collaborators

  • tomp4l