import { array } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { alt } = array;
Given two arrays first and second, if first is empty the return second, otherwise return first.
Examples
Example 1
Example 1
import * as A from "./array.ts";
import { pipe } from "./fn.ts";
const result1 = pipe(
A.empty<number>(),
A.alt(A.of(1)),
); // [1]
const result2 = pipe(
A.array(1, 2, 3),
A.alt(A.array(3, 2, 1)),
); // [1, 2, 3]
Parameters
second: ReadonlyArray<A>