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

alt

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

Replace an first with second if first is None. This allows one to offer a a replacement or default.

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

const result1 = pipe(O.some(1), O.alt(O.some(2))); // Some(1);
const result2 = pipe(O.some(1), O.alt(O.constNone())); // Some(1);
const result3 = pipe(O.none, O.alt(O.some(2))); // Some(2);
const result4 = pipe(O.none, O.alt(O.none)); // None
function alt<A>(second: Option<A>): (first: Option<A>) => Option<A>;
§
alt<A>(second: Option<A>): (first: Option<A>) => Option<A>
[src]

§Type Parameters

§Parameters

§
second: Option<A>
[src]

§Return Type

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