Consume the iterator and return the first item where the predicate function returns true.
import { pipe } from "yta";import { find, of } from "yta/sync";pipe( of( { name: "foo", value: 42 }, { name: "bar", value: 5 }, { name: "baz", value: 101 }, ), find(({ name }) => name === "bar"),);// => { name: bar, value: 101 } Copy
import { pipe } from "yta";import { find, of } from "yta/sync";pipe( of( { name: "foo", value: 42 }, { name: "bar", value: 5 }, { name: "baz", value: 101 }, ), find(({ name }) => name === "bar"),);// => { name: bar, value: 101 }
The predicate function
Consume the iterator and return the first item where the predicate function returns true.