Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

exists

import { exists } from "https://raw.githubusercontent.com/baetheus/fun/main/option.ts";

Apply a predicate to the inner value of an Option, returning true if the option is Some and the predicate returns true, otherwise returning false.

@example
import * as O from "./option.ts";
import { pipe } from "./fn.ts";

const positive = (n: number) => n > 0;

const result1 = pipe(O.some(1), O.exists(positive)); // true
const result2 = pipe(O.some(0), O.exists(positive)); // false
const result3 = pipe(O.none, O.exists(positive)); // false
function exists<A>(predicate: Predicate<A>): (ua: Option<A>) => boolean;
§
exists<A>(predicate: Predicate<A>): (ua: Option<A>) => boolean
[src]

§Type Parameters

§Parameters

§
predicate: Predicate<A>
[src]

§Return Type

§
(ua: Option<A>) => boolean
[src]