Module ringo/utils/arrays
Provides utility functions for working with JavaScript Arrays.
Check if an array passed as argument contains
a specific value (start from end of array).
Parameters
| Array |
array |
the array |
| Object |
val |
the value to check |
Returns
| boolean |
true if the value is contained |
Retrieve the intersection set of a bunch of arrays.
Parameters
| Array |
array1,... |
the arrays to intersect |
Returns
| Array |
the intersection set |
max
(array)
Returns
|
the maximal element in an array obtained by calling Math.max(). |
min
(array)
Returns
|
the minimal element in an array obtained by calling Math.min(). |
Return the last element of the 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. |
remove
(array, val)
Remove the first occurrence of the argument value from the array. This method
mutates and returns the array on which it is called and does not create a
new array instance.
Parameters
| Array |
array |
the array |
| Object |
val |
the value to remove |
union
(array1,...)
Retrieve the union set of a bunch of arrays.
Parameters
| Array |
array1,... |
the arrays to unify |