Flattens an input iterable up to a specified depth. Returns a new asynchronous iterable.
A function that accepts an input iterable and returns a new asynchronous iterable.
const input = [1, [2, 3], [4, [5]]];const flatIterable = flat<number>(1)(input);(async () => { for await (const x of flatIterable) { console.log(x); // Logs 1, 2, 3, 4, [5] }})();
The type of elements in the input iterable.
The depth of flattening.
Optional
The depth of flattening, defaults to 1.
Generated using TypeDoc
Flattens an input iterable up to a specified depth. Returns a new asynchronous iterable.
Returns
A function that accepts an input iterable and returns a new asynchronous iterable.
Example