method StreamClass.from
Private
StreamClass.from<U>(source: Source<U>): StreamClass<Exclude<U, AnyFailure>, Extract<U, AnyFailure>>

Lifts a source into a Stream. Elements that are Failures are the E channel from the start; everything else is T.

const doubled = await Stream.from([1, 2, 3]).map((n) => n * 2).collect();
doubled; // [2, 4, 6]

Type Parameters

Parameters

source: Source<U>

Return Type

StreamClass<Exclude<U, AnyFailure>, Extract<U, AnyFailure>>

Usage

import { StreamClass } from "lib/stream/stream.ts";