method StreamClass.prototype.every
Private
StreamClass.prototype.every(predicate: (
value: T,
index: number
) => boolean | PromiseLike<boolean>
): Task<boolean, E>

Whether every value satisfies predicate — short-circuiting on the first that does not.

This is the member Rust and Elixir both call all; JS calls it every, and JS wins here for the same reason forEach did. StreamClass#collect is the collector, and the two are told apart by their arguments as much as their names: every takes a predicate, collect takes nothing.

Vacuously true on an empty stream, matching Array.prototype.every.

await Stream.from([2, 4]).every((n) => n % 2 === 0); // true

Parameters

predicate: (
value: T,
index: number
) => boolean | PromiseLike<boolean>

Return Type

Task<boolean, E>

Usage

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