Module Js.Array
Bindings to the functions in Array.prototype
JavaScript Array API
type 'a t = 'a arraytype t('a) = array('a);type 'a array_like = 'a Js.array_liketype array_like('a) = Js.array_like('a);val from : 'a array_like -> 'a arraylet from: array_like('a) => array('a);val fromMap : 'a array_like -> f:('a -> 'b) -> 'b arraylet fromMap: array_like('a) => f:('a => 'b) => array('b);val isArray : 'a -> boollet isArray: 'a => bool;val length : 'a array -> intlet length: array('a) => int;Mutating functions
val copyWithin : to_:int -> ?start:int -> ?end_:int -> 'a t -> 'a tlet copyWithin: to_:int => ?start:int => ?end_:int => t('a) => t('a);val fill : value:'a -> ?start:int -> ?end_:int -> 'a t -> 'a tlet fill: value:'a => ?start:int => ?end_:int => t('a) => t('a);val flat : 'a t t -> 'a tlet flat: t(t('a)) => t('a);val pop : 'a t -> 'a optionlet pop: t('a) => option('a);https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Array/pop
val push : value:'a -> 'a t -> intlet push: value:'a => t('a) => int;val pushMany : values:'a array -> 'a t -> intlet pushMany: values:array('a) => t('a) => int;val toReversed : 'a t -> 'a tlet toReversed: t('a) => t('a);returns a new array with the elements in reversed order. (ES2023)
val reverseInPlace : 'a t -> 'a tlet reverseInPlace: t('a) => t('a);val shift : 'a t -> 'a optionlet shift: t('a) => option('a);val toSorted : 'a t -> 'a tlet toSorted: t('a) => t('a);returns a new array with the elements sorted in ascending order. (ES2023)
val toSortedWith : f:('a -> 'a -> int) -> 'a t -> 'a tlet toSortedWith: f:('a => 'a => int) => t('a) => t('a);returns a new array with the elements sorted in ascending order. (ES2023)
val sortInPlace : 'a t -> 'a tlet sortInPlace: t('a) => t('a);val sortInPlaceWith : f:('a -> 'a -> int) -> 'a t -> 'a tlet sortInPlaceWith: f:('a => 'a => int) => t('a) => t('a);val spliceInPlace : start:int -> remove:int -> add:'a array -> 'a t -> 'a tlet spliceInPlace: start:int => remove:int => add:array('a) => t('a) => t('a);changes the contents of the given array by removing or replacing existing elements and/or adding new elements in place. returns a new array containing the removed elements.
val toSpliced : start:int -> remove:int -> add:'a array -> 'a t -> 'a tlet toSpliced: start:int => remove:int => add:array('a) => t('a) => t('a);returns a new array with some elements removed and/or replaced at a given index. (ES2023)
val removeFromInPlace : start:int -> 'a t -> 'a tlet removeFromInPlace: start:int => t('a) => t('a);removes all elements from the given array starting at the start index and returns the removed elements.
val removeFrom : start:int -> 'a t -> 'a tlet removeFrom: start:int => t('a) => t('a);returns a new array with elements removed starting at the start index. (ES2023)
val removeCountInPlace : start:int -> count:int -> 'a t -> 'a tlet removeCountInPlace: start:int => count:int => t('a) => t('a);removes count elements from the given array starting at the start index and returns the removed elements.
val removeCount : start:int -> count:int -> 'a t -> 'a tlet removeCount: start:int => count:int => t('a) => t('a);returns a new array with count elements removed starting at the start index. (ES2023)
val unshift : value:'a -> 'a t -> intlet unshift: value:'a => t('a) => int;val unshiftMany : values:'a array -> 'a t -> intlet unshiftMany: values:array('a) => t('a) => int;val concat : other:'a t -> 'a t -> 'a tlet concat: other:t('a) => t('a) => t('a);val concatMany : arrays:'a t array -> 'a t -> 'a tlet concatMany: arrays:array(t('a)) => t('a) => t('a);val includes : value:'a -> 'a t -> boollet includes: value:'a => t('a) => bool;ES2015
val join : ?sep:string -> 'a t -> stringlet join: ?sep:string => t('a) => string;Accessor functions
val at : index:int -> 'a t -> 'a optionlet at: index:int => t('a) => option('a);ES2022
val indexOf : value:'a -> ?start:int -> 'a t -> intlet indexOf: value:'a => ?start:int => t('a) => int;val lastIndexOf : value:'a -> 'a t -> intlet lastIndexOf: value:'a => t('a) => int;val lastIndexOfFrom : value:'a -> start:int -> 'a t -> intlet lastIndexOfFrom: value:'a => start:int => t('a) => int;val copy : 'a t -> 'a tlet copy: t('a) => t('a);val slice : ?start:int -> ?end_:int -> 'a t -> 'a tlet slice: ?start:int => ?end_:int => t('a) => t('a);val toString : 'a t -> stringlet toString: t('a) => string;val toLocaleString : 'a t -> stringlet toLocaleString: t('a) => string;Iteration functions
val entries : 'a t -> (int * 'a) Js.iteratorlet entries: t('a) => Js.iterator((int, 'a));val every : f:('a -> bool) -> 'a t -> boollet every: f:('a => bool) => t('a) => bool;val everyi : f:('a -> int -> bool) -> 'a t -> boollet everyi: f:('a => int => bool) => t('a) => bool;val filter : f:('a -> bool) -> 'a t -> 'a tlet filter: f:('a => bool) => t('a) => t('a);val filteri : f:('a -> int -> bool) -> 'a t -> 'a tlet filteri: f:('a => int => bool) => t('a) => t('a);val find : f:('a -> bool) -> 'a t -> 'a optionlet find: f:('a => bool) => t('a) => option('a);val findi : f:('a -> int -> bool) -> 'a t -> 'a optionlet findi: f:('a => int => bool) => t('a) => option('a);val findLast : f:('a -> bool) -> 'a t -> 'a optionlet findLast: f:('a => bool) => t('a) => option('a);val findLasti : f:('a -> int -> bool) -> 'a t -> 'a optionlet findLasti: f:('a => int => bool) => t('a) => option('a);val findIndex : f:('a -> bool) -> 'a t -> intlet findIndex: f:('a => bool) => t('a) => int;val findIndexi : f:('a -> int -> bool) -> 'a t -> intlet findIndexi: f:('a => int => bool) => t('a) => int;val findLastIndex : f:('a -> bool) -> 'a t -> intlet findLastIndex: f:('a => bool) => t('a) => int;val findLastIndexi : f:('a -> int -> bool) -> 'a t -> intlet findLastIndexi: f:('a => int => bool) => t('a) => int;val forEach : f:('a -> unit) -> 'a t -> unitlet forEach: f:('a => unit) => t('a) => unit;val forEachi : f:('a -> int -> unit) -> 'a t -> unitlet forEachi: f:('a => int => unit) => t('a) => unit;val keys : 'a t -> int Js.iteratorlet keys: t('a) => Js.iterator(int);val map : f:('a -> 'b) -> 'a t -> 'b tlet map: f:('a => 'b) => t('a) => t('b);val mapi : f:('a -> int -> 'b) -> 'a t -> 'b tlet mapi: f:('a => int => 'b) => t('a) => t('b);val reduce : f:('b -> 'a -> 'b) -> init:'b -> 'a t -> 'blet reduce: f:('b => 'a => 'b) => init:'b => t('a) => 'b;val reducei : f:('b -> 'a -> int -> 'b) -> init:'b -> 'a t -> 'blet reducei: f:('b => 'a => int => 'b) => init:'b => t('a) => 'b;val reduceRight : f:('b -> 'a -> 'b) -> init:'b -> 'a t -> 'blet reduceRight: f:('b => 'a => 'b) => init:'b => t('a) => 'b;val reduceRighti : f:('b -> 'a -> int -> 'b) -> init:'b -> 'a t -> 'blet reduceRighti: f:('b => 'a => int => 'b) => init:'b => t('a) => 'b;val some : f:('a -> bool) -> 'a t -> boollet some: f:('a => bool) => t('a) => bool;val somei : f:('a -> int -> bool) -> 'a t -> boollet somei: f:('a => int => bool) => t('a) => bool;val values : 'a t -> 'a Js.iteratorlet values: t('a) => Js.iterator('a);val unsafe_get : 'a array -> int -> 'alet unsafe_get: array('a) => int => 'a;val unsafe_set : 'a array -> int -> 'a -> unitlet unsafe_set: array('a) => int => 'a => unit;