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

union

import { union } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/comparable.ts";

Create a Comparable from two other Comparables. The resultant Comparable checks that any two values are equal according to at least one of the supplied eqs.

It should be noted that we cannot differentiate the eq used to compare two disparate types like number and number[]. Thus, internally union must type cast to any and treat thrown errors as a false equivalence.

@example
import { union, number, string } from "./comparable.ts";
import { pipe } from "./fn.ts";

const { compare } = pipe(number, union(string));

const result1 = compare(1)("Hello"); // false
const result2 = compare(1)(1); // true
function union<I>(second: Comparable<I>): <A>(first: Comparable<A>) => Comparable<A | I>;
§
union<I>(second: Comparable<I>): <A>(first: Comparable<A>) => Comparable<A | I>
[src]

§Type Parameters

§Parameters

§Return Type

§
<A>(first: Comparable<A>) => Comparable<A | I>
[src]