Module: UWA/Function

UWA/Function

Function utility functions

Index

Methods

<static> UWA.Function.always(value) → {Function}

Creates a function that always returns value.

Example
// For passing constants to APIs that expect functions :
someArray.filter(filterFunction || UWA.Function.always(true));
// api: object.position = function (time) { return coords }
circle.position = Utils.always([10, 10]);
// api: image.fill( function (x, y) { return color; });
image.fill(UWA.Function.always(black));
Parameters
Name Type Description
value Void

The value to return from the new function.

Returns

Returns the new function.

Type
Function