Class: shaka.util.Functional

A set of functional utility functions.

Source:

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) isEqualFunc(compare) → {function(T): boolean}

Creates a function that returns whether the given value is equal to the given value.
Parameters:
Name Type Description
compare T
Source:
Returns:
Type
function(T): boolean

(static) isNotEqualFunc(compare) → {function(T): boolean}

Creates a function that returns whether the given value is not equal to the given value.
Parameters:
Name Type Description
compare T
Source:
Returns:
Type
function(T): boolean

(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: