Module Js_array

JavaScript Array API

type t('a) = array('a);
type array_like('a) = Js_array2.array_like('a);
let from: array_like('a) => array('a);
let fromMap: array_like('a) => ('a => 'b) => array('b);
let isArray: 'a => bool;
let length: array('a) => int;
let copyWithin: to_:int => t('a) as 'this => 'this;
let copyWithinFrom: to_:int => from:int => t('a) as 'this => 'this;
let copyWithinFromRange: to_:int => start:int => end_:int => t('a) as 'this => 'this;
let fillInPlace: 'a => t('a) as 'this => 'this;
let fillFromInPlace: 'a => from:int => t('a) as 'this => 'this;
let fillRangeInPlace: 'a => start:int => end_:int => t('a) as 'this => 'this;
let pop: t('a) as 'this => option('a);

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

let push: 'a => t('a) as 'this => int;
let pushMany: array('a) => t('a) as 'this => int;
let reverseInPlace: t('a) as 'this => 'this;
let shift: t('a) as 'this => option('a);
let sortInPlace: t('a) as 'this => 'this;
let sortInPlaceWith: ('a => 'a => int) => t('a) as 'this => 'this;
let spliceInPlace: pos:int => remove:int => add:array('a) => t('a) as 'this => 'this;
let removeFromInPlace: pos:int => t('a) as 'this => 'this;
let removeCountInPlace: pos:int => count:int => t('a) as 'this => 'this;
let unshift: 'a => t('a) as 'this => int;
let unshiftMany: array('a) => t('a) as 'this => int;
let append: 'a => t('a) as 'this => 'this;
  • deprecated append is not type-safe. Use `concat` instead, and see #1884
let concat: 'this => t('a) as 'this => 'this;
let concatMany: array('this) => t('a) as 'this => 'this;
let includes: 'a => t('a) as 'this => bool;

ES2016

let indexOf: 'a => t('a) as 'this => int;
let indexOfFrom: 'a => from:int => t('a) as 'this => int;
let join: t('a) => string;
  • deprecated please use joinWith instead
let joinWith: string => t('a) as 'this => string;
let lastIndexOf: 'a => t('a) as 'this => int;
let lastIndexOfFrom: 'a => from:int => t('a) as 'this => int;
let lastIndexOf_start: 'a => t('a) as 'this => int;
  • deprecated Please use `lastIndexOf
let slice: start:int => end_:int => t('a) as 'this => 'this;
let copy: t('a) as 'this => 'this;
let slice_copy: unit => t('a) as 'this => 'this;
  • deprecated Please use `copy`
let sliceFrom: int => t('a) as 'this => 'this;
let slice_start: int => t('a) as 'this => 'this;
  • deprecated Please use `sliceFrom`
let toString: t('a) as 'this => string;
let toLocaleString: t('a) as 'this => string;
let every: ('a => bool) => t('a) as 'this => bool;
let everyi: ('a => int => bool) => t('a) as 'this => bool;
let filter: ('a => bool) => t('a) as 'this => 'this;

should we use bool or boolean seems they are intechangeable here

let filteri: ('a => int => bool) => t('a) as 'this => 'this;
let find: ('a => bool) => t('a) as 'this => option('a);
let findi: ('a => int => bool) => t('a) as 'this => option('a);
let findIndex: ('a => bool) => t('a) as 'this => int;
let findIndexi: ('a => int => bool) => t('a) as 'this => int;
let forEach: ('a => unit) => t('a) as 'this => unit;
let forEachi: ('a => int => unit) => t('a) as 'this => unit;
let map: ('a => 'b) => t('a) as 'this => t('b);
let mapi: ('a => int => 'b) => t('a) as 'this => t('b);
let reduce: ('b => 'a => 'b) => 'b => t('a) as 'this => 'b;
let reducei: ('b => 'a => int => 'b) => 'b => t('a) as 'this => 'b;
let reduceRight: ('b => 'a => 'b) => 'b => t('a) as 'this => 'b;
let reduceRighti: ('b => 'a => int => 'b) => 'b => t('a) as 'this => 'b;
let some: ('a => bool) => t('a) as 'this => bool;
let somei: ('a => int => bool) => t('a) as 'this => bool;
let unsafe_get: array('a) => int => 'a;
let unsafe_set: array('a) => int => 'a => unit;