Skip to main content
ReadableBase.prototype.some - node__stream.d.ts - Node documentation
method ReadableBase.prototype.some

Usage in Deno

```typescript import { ReadableBase } from "node:node__stream.d.ts"; ```
ReadableBase.prototype.some(
fn: (
data: any,
options?: Pick<ArrayOptions, "signal">,
) => boolean | Promise<boolean>
,
options?: ArrayOptions,
): Promise<boolean>
This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`.

Parameters

fn: (
data: any,
options?: Pick<ArrayOptions, "signal">,
) => boolean | Promise<boolean>
a function to call on each chunk of the stream. Async or not.
optional
options: ArrayOptions

Return Type

Promise<boolean>
a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks.