@lou.codes/iterables
Version:
🔁 Iterable and AsyncIterable utils
13 lines (12 loc) • 314 B
JavaScript
/**
* Turns given iterable into an array.
*
* @category Reducers
* @example
* ```typescript
* iterableToArray([1, 2, 3, 4]); // [1, 2, 3, 4]
* ```
* @param iterable Iterable to be turned into an array.
* @returns Array made of iterable items.
*/
export const iterableToArray = iterable => [...iterable];