Class: shaka.util.Functional

A set of functional utility functions.

Methods

(static) collapseArrays(allnon-null, partnon-null) → (non-null) {Array.<T>}

Returns the first array concatenated to the second; used to collapse an array of arrays into a single array.
Parameters:
Name Type Description
all Array.<T>
part Array.<T>
Source:
Returns:
Type
Array.<T>

(static) createFallbackPromiseChain(arraynon-null, callback) → (non-null) {Promise.<RESULT>}

Creates a promise chain that calls the given callback for each element in the array in a catch of a promise. e.g.: Promise.reject().catch(callback(array[0])).catch(callback(array[1]));
Parameters:
Name Type Description
array Array.<ELEM>
callback function(ELEM): !Promise.<RESULT>
Source:
Returns:
Type
Promise.<RESULT>

(static) isNotNull(value) → {boolean}

Returns if the given value is not null; useful for filtering out null values.
Parameters:
Name Type Description
value T
Source:
Returns:
Type
boolean

(static) noop()

A no-op function. Useful in promise chains.
Source: