Array utility functions.
- Source:
Methods
-
(static) indexOf(arraynon-null, value, compareFn) → {number}
-
Find an item in an array. For use when comparison of entries via == will not suffice.
Parameters:
Name Type Description array
Array.<T> value
T compareFn
function(T, T): boolean A function which will be used to compare items in the array. - Source:
Returns:
The index, or -1 if not found.- Type
- number
-
(static) remove(arraynon-null, element)
-
Remove given element from array (assumes no duplicates).
Parameters:
Name Type Description array
Array.<T> element
T - Source:
-
(static) removeDuplicates(arraynon-null, opt_compareFn) → (non-null) {Array.<T>}
-
Remove duplicate entries from an array. Order N^2, so use with caution.
Parameters:
Name Type Description array
Array.<T> opt_compareFn
function(T, T): boolean= An optional function which will be used to compare items in the array. - Source:
Returns:
- Type
- Array.<T>