itr8FromImpureFunction<T>(f: (() => T | Promise<T>)): IterableIterator<T> | AsyncIterableIterator<T>
Turns a parameterless function into an Iterator that will produce results using
the input function's return value. In case the function returns a promise, the result will be
an AsyncIterator.
Useful for 'impure' stuff like Math.random, or Date.now etc.
Turns a parameterless function into an Iterator that will produce results using the input function's return value. In case the function returns a promise, the result will be an AsyncIterator. Useful for 'impure' stuff like Math.random, or Date.now etc.
Example
Returns
an iterator