import { union } from "https://deno.land/x/fun@v2.0.0-alpha.6/eq.ts";
Create a eq from two other eqs. The resultant eq 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. To mitigate most of these issues we first test if the 'typeof' the values matches, but keep in mind that if you are doing any nonsense by mutating within a eq that union will find and expose such nonsense in inconsistent ways.
Examples
Example 1
Example 1
import { union, number, string } from "./eq.ts";
import { pipe } from "./fn.ts";
const { equals } = pipe(number, union(string));
const result1 = equals(1)("Hello"); // false
const result2 = equals(1)(1); // true