Class: shaka.util.Functional

A set of functional utility functions.

Constructor

new Functional()

A set of functional utility functions.

Source:

Methods

collapseArrays(allnon-null, partnon-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>

createFallbackPromiseChain(arraynon-null, callback) → {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>

ignored(…args)

A no-op function that ignores its arguments. This is used to suppress unused variable errors.
Parameters:
Name Type Attributes Description
args * <repeatable>
Source:

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

noop()

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