Function: prepend()
prepend<
ElementType>(iterable:IterableResolvable<ElementType>, ...iterables:IterableResolvable<ElementType>[]):IterableIterator<ElementType>
Defined in: projects/utilities/packages/iterator-utilities/src/lib/prepend.ts:21
Creates an iterator with the provided iterables prepended to the first iterable.
Type Parameters
| Type Parameter | 
|---|
| ElementType | 
Parameters
| Parameter | Type | Description | 
|---|---|---|
| iterable | IterableResolvable<ElementType> | The iterator to prepend values to. | 
| ... iterables | IterableResolvable<ElementType>[] | The iterables to prepend to the iterator. | 
Returns
IterableIterator<ElementType>
An iterator that yields the values of the provided iterator followed by the values of the provided iterables.
Example
import { prepend } from '@sapphire/iterator-utilities';
console.log([...prepend([3, 4, 5], [1, 2])]);
// Output: [1, 2, 3, 4, 5]
Seealso
append to append values to the end of an iterator.