getLazy()function

getLazy(value: (...args: A) => T, ...args: A): T
getLazy(value: Lazy<T, A>, ...args: A): T
ParamType
value(...args: A) => T
The lazy value to resolve. required
argsA
Any additional arguments passed into the initialiser function as its parameters. required
valueLazy<T, A>
Lazy value: a plain value, or an initialiser function that returns that value. required
argsA
required
Return
T
The resolved value.
T

Initialise a lazy value.

  • If value is a plain value, that value is returned.
  • If value is a function, it is called with args and its returned value is returned.

Examples

getLazy(() => 123) // 123
getLazy(123) // 123