Filter items in the iterator leaving only the items that fulfill the predicate.
import { pipe } from "yta";import { filter, toArray } from "yta/async";import { asAsync, range } from "yta/sync";await pipe( range(10), asAsync(), filter((n) => n % 2 === 0), toArray(),);// => [0, 2, 4, 6, 8] Copy
import { pipe } from "yta";import { filter, toArray } from "yta/async";import { asAsync, range } from "yta/sync";await pipe( range(10), asAsync(), filter((n) => n % 2 === 0), toArray(),);// => [0, 2, 4, 6, 8]
The item type
The predicated function
Filter items in the iterator leaving only the items that fulfill the predicate.