Fork me on GitHub

Module core/array

Adds useful methods to the JavaScript Array type.

Class Array

Instance Methods

Static Methods


Array.intersection (array1,...)

Retrieve the intersection set of a bunch of arrays

Parameters

Array array1,... the arrays to intersect

Returns

Array the intersection set

Array.prototype.contains (val)

check if an array passed as argument contains a specific value (start from end of array)

Parameters

Object val the value to check

Returns

boolean true if the value is contained

Array.prototype.max ()

Returns

the maximal element in this array obtained by calling Math.max().

Array.prototype.min ()

Returns

the minimal element in this array obtained by calling Math.min().

Array.prototype.partition (fn)

Parameters

fn

Array.prototype.peek ()

Return the last element of this array. This is like pop(), but without modifying the array.

Returns

Object the last element of the array, or undefined if the array is empty.

Array.prototype.remove (val)

Remove the first occurrence of the argument value from this array. This method mutates and returns the array on which it is called and does not create a new array instance.

Parameters

Object val the value to remove

Returns

Array this array

Array.union (array1,...)

Retrieve the union set of a bunch of arrays

Parameters

Array array1,... the arrays to unify

Returns

Array the union set