getLazy()function
getLazy(value: (...args: A) => T, ...args: A): T
getLazy(value: Lazy<T, A>, ...args: A): T
| Param | Type | |
|---|---|---|
value | (...args: A) => T | The lazy value to resolve. required |
args | A | Any additional arguments passed into the initialiser function as its parameters. required |
value | Lazy<T, A> | Lazy value: a plain value, or an initialiser function that returns that value. required |
args | A | required |
| Return | |
|---|---|
T | The resolved value. |
T |
Initialise a lazy value.
- If
valueis a plain value, that value is returned. - If
valueis a function, it is called withargsand its returned value is returned.
Examples
getLazy(() => 123) // 123
getLazy(123) // 123