Module Js.Array

Bindings to the functions in Array.prototype

JavaScript Array API

type t('a) = array('a);
type array_like('a) = Js.array_like('a);
let from: array_like('a) => array('a);
let fromMap: array_like('a) => f:('a => 'b) => array('b);
let isArray: 'a => bool;
let length: array('a) => int;

Mutating functions

let copyWithin: to_:int => ?start:int => ?end_:int => t('a) => t('a);
let fill: value:'a => ?start:int => ?end_:int => t('a) => t('a);
let pop: t('a) => option('a);

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push

let push: value:'a => t('a) => int;
let pushMany: values:array('a) => t('a) => int;
let reverseInPlace: t('a) => t('a);
let shift: t('a) => option('a);
let sortInPlace: t('a) => t('a);
let sortInPlaceWith: f:('a => 'a => int) => t('a) => t('a);
let spliceInPlace: start:int => remove:int => add:array('a) => t('a) => t('a);
let removeFromInPlace: start:int => t('a) => t('a);
let removeCountInPlace: start:int => count:int => t('a) => t('a);
let unshift: value:'a => t('a) => int;
let unshiftMany: values:array('a) => t('a) => int;
let concat: other:t('a) => t('a) => t('a);
let concatMany: arrays:array(t('a)) => t('a) => t('a);
let includes: value:'a => t('a) => bool;

ES2015

let join: ?sep:string => t('a) => string;

Accessor functions

let indexOf: value:'a => ?start:int => t('a) => int;
let lastIndexOf: value:'a => t('a) => int;
let lastIndexOfFrom: value:'a => start:int => t('a) => int;
let copy: t('a) => t('a);
let slice: ?start:int => ?end_:int => t('a) => t('a);
let toString: t('a) => string;
let toLocaleString: t('a) => string;

Iteration functions

let entries: t('a) => Js.iterator((int, 'a));
let every: f:('a => bool) => t('a) => bool;
let everyi: f:('a => int => bool) => t('a) => bool;
let filter: f:('a => bool) => t('a) => t('a);
let filteri: f:('a => int => bool) => t('a) => t('a);
let find: f:('a => bool) => t('a) => option('a);
let findi: f:('a => int => bool) => t('a) => option('a);
let findIndex: f:('a => bool) => t('a) => int;
let findIndexi: f:('a => int => bool) => t('a) => int;
let forEach: f:('a => unit) => t('a) => unit;
let forEachi: f:('a => int => unit) => t('a) => unit;
let keys: t('a) => Js.iterator(int);
let map: f:('a => 'b) => t('a) => t('b);
let mapi: f:('a => int => 'b) => t('a) => t('b);
let reduce: f:('b => 'a => 'b) => init:'b => t('a) => 'b;
let reducei: f:('b => 'a => int => 'b) => init:'b => t('a) => 'b;
let reduceRight: f:('b => 'a => 'b) => init:'b => t('a) => 'b;
let reduceRighti: f:('b => 'a => int => 'b) => init:'b => t('a) => 'b;
let some: f:('a => bool) => t('a) => bool;
let somei: f:('a => int => bool) => t('a) => bool;
let values: t('a) => Js.iterator('a);
let unsafe_get: array('a) => int => 'a;
let unsafe_set: array('a) => int => 'a => unit;