Function: flat()
flat<
ElementType
>(iterables
:IterableResolvable
<IterableResolvable
<ElementType
>>):IterableIterator
<ElementType
>
Creates an iterable that yields the elements of each iterable in the input iterable.
Type Parameters
Type Parameter |
---|
ElementType |
Parameters
Parameter | Type | Description |
---|---|---|
iterables | IterableResolvable <IterableResolvable <ElementType >> | An iterator to map. |
Returns
IterableIterator
<ElementType
>
An iterator that yields the entries of each iterator.
Example
import { flat } from '@sapphire/iterator-utilities';
const iterable = flat([[1, 2], [3, 4], [5, 6]]);
console.log([...iterable]);
// Output: [1, 2, 3, 4, 5, 6]
Defined in
projects/utilities/packages/iterator-utilities/src/lib/flat.ts:19