Mostly useful for tests or when you want to be explicit about consuming an iterable without doing anything with any yielded values.
import drain from 'it-drain'// This can also be an iterator, generator, etcconst values = [0, 1, 2, 3, 4]drain(values) Copy
import drain from 'it-drain'// This can also be an iterator, generator, etcconst values = [0, 1, 2, 3, 4]drain(values)
Async sources must be awaited:
import drain from 'it-drain'const values = async function * { yield * [0, 1, 2, 3, 4]}await drain(values()) Copy
import drain from 'it-drain'const values = async function * { yield * [0, 1, 2, 3, 4]}await drain(values())
Mostly useful for tests or when you want to be explicit about consuming an iterable without doing anything with any yielded values.
Example
Async sources must be awaited: