Module Js_array2

JavaScript Array API

type 'a t = 'a array
type 'a array_like
val from : 'a array_like -> 'a array
val fromMap : 'a array_like -> ('a -> 'b) -> 'b array
val isArray : 'a -> bool
val length : 'a array -> int
val copyWithin : 'a t -> to_:int -> 'a t
val copyWithinFrom : 'a t -> to_:int -> from:int -> 'a t
val copyWithinFromRange : 'a t -> to_:int -> start:int -> end_:int -> 'a t
val fillInPlace : 'a t -> 'a -> 'a t
val fillFromInPlace : 'a t -> 'a -> from:int -> 'a t
val fillRangeInPlace : 'a t -> 'a -> start:int -> end_:int -> 'a t
val pop : 'a t -> 'a option

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

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

ES2016

val indexOf : 'a t -> 'a -> int
val indexOfFrom : 'a t -> 'a -> from:int -> int
val joinWith : 'a t -> string -> string
val lastIndexOf : 'a t -> 'a -> int
val lastIndexOfFrom : 'a t -> 'a -> from:int -> int
val slice : 'a t -> start:int -> end_:int -> 'a t
val copy : 'a t -> 'a t
val sliceFrom : 'a t -> int -> 'a t
val toString : 'a t -> string
val toLocaleString : 'a t -> string
val every : 'a t -> ('a -> bool) -> bool
val everyi : 'a t -> ('a -> int -> bool) -> bool
val filter : 'a t -> ('a -> bool) -> 'a t

should we use bool or boolean seems they are intechangeable here

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