API / JavaScript / Js / TypedArray-2_uint-16Array

TypedArray2.Uint16Array

Provide bindings to JS typed array Uint16Array.

type elt = int; type typed_array('a); type t = typed_array(elt);
let unsafe_get: (t, int) => elt;
let unsafe_set: (t, int, elt) => unit;
let buffer: t => Js_typed_array2.array_buffer;
let byteLength: t => int;
let byteOffset: t => int;
let setArray: (array(elt), t) => unit;
let setArrayOffset: (array(elt), int, t) => unit;
let length: t => int;
let copyWithin: (~to_: int, t) => t;
let copyWithinFrom: (~to_: int, ~from: int, t) => t;
let copyWithinFromRange: (~to_: int, ~start: int, ~end_: int, t) => t;
let fillInPlace: (elt, t) => t;
let fillFromInPlace: (elt, ~from: int, t) => t;
let fillRangeInPlace: (elt, ~start: int, ~end_: int, t) => t;
let reverseInPlace: t => t;
let sortInPlace: t => t;
let sortInPlaceWith: ((. elt, elt) => int, t) => t;
let includes: (elt, t) => bool;

ES2016

let indexOf: (elt, t) => int;
let indexOfFrom: (elt, ~from: int, t) => int;
let join: t => string;
let joinWith: (string, t) => string;
let lastIndexOf: (elt, t) => int;
let lastIndexOfFrom: (elt, ~from: int, t) => int;
let slice: (~start: int, ~end_: int, t) => t;

start is inclusive, end_ exclusive.

let copy: t => t;
let sliceFrom: (int, t) => t;
let subarray: (~start: int, ~end_: int, t) => t;

start is inclusive, end_ exclusive.

let subarrayFrom: (int, t) => t;
let toString: t => string;
let toLocaleString: t => string;
let every: ((. elt) => bool, t) => bool;
let everyi: ((. elt, int) => bool, t) => bool;
let filter: ((. elt) => bool, t) => t;
let filteri: ((. elt, int) => bool, t) => t;
let find: ((. elt) => bool, t) => Js.undefined(elt);
let findi: ((. elt, int) => bool, t) => Js.undefined(elt);
let findIndex: ((. elt) => bool, t) => int;
let findIndexi: ((. elt, int) => bool, t) => int;
let forEach: ((. elt) => unit, t) => unit;
let forEachi: ((. elt, int) => unit, t) => unit;
let map: ((. elt) => 'b, t) => typed_array('b);
let mapi: ((. elt, int) => 'b, t) => typed_array('b);
let reduce: ((. 'b, elt) => 'b, 'b, t) => 'b;
let reducei: ((. 'b, elt, int) => 'b, 'b, t) => 'b;
let reduceRight: ((. 'b, elt) => 'b, 'b, t) => 'b;
let reduceRighti: ((. 'b, elt, int) => 'b, 'b, t) => 'b;
let some: ((. elt) => bool, t) => bool;
let somei: ((. elt, int) => bool, t) => bool;
let _BYTES_PER_ELEMENT: int;
let make: array(elt) => t;
let fromBuffer: Js_typed_array2.array_buffer => t;
let fromBufferOffset: (Js_typed_array2.array_buffer, int) => t;

Can throw an exception.

let fromBufferRange: (Js_typed_array2.array_buffer, ~offset: int, ~length: int) => t;

Raises Js.Exn.Error raise Js exception.

let fromLength: int => t;

Raises Js.Exn.Error raise Js exception.

let from: Js_typed_array2.array_like(elt) => t;