method Stream.take
Stream.take(n: number): Stream<T, E>

Limits the stream to at most n successful values. Errors pass through without counting against the limit. After n successes are yielded, the stream stops immediately (any pending errors from earlier in the pipeline may still be yielded before stopping).

Examples

Example 1

const first3 = source.take(3);

Parameters

n: number

Return Type

Stream<T, E>

Usage

import { type Stream } from ".";