effect-io-ai

Package: effect
Module: Channel

Channel.fromIterator

Creates a Channel from an iterator.

Example (Creating channels from iterators)

import { Channel } from "effect"

const numbers = [1, 2, 3, 4, 5]
const channel = Channel.fromIterator(() => numbers[Symbol.iterator]())
// Emits: 1, 2, 3, 4, 5

Signature

declare const fromIterator: <A, L>(iterator: LazyArg<Iterator<A, L>>) => Channel<A, never, L>

Source

Since v4.0.0