array¶
- getElementCount(array, elementToCount)¶
Get number of instances of an element in an array.
- Arguments:
array (Array) – The array to search.
elementToCount (*) – The element to search for.
- Returns:
number – The number of instances of the element in the array.
- asArray(array)¶
Return a scalar as a singleton array and an array as-is.
- Arguments:
array (T|Array.<T>) – An array or scalar.
- Returns:
Array.<T> – The original array or a singleton array of the scalar.
- recursiveMap(fn, array)¶
Apply a function recursively to an array.
- Arguments:
fn (function) – The function to apply.
array (Array.<T>) – The array to map.
- Returns:
Array.<U> – The mapped array.