import { intersect } from "https://deno.land/x/fun@v2.0.0-alpha.12/comparable.ts";
Create a eq from two other eqs. The resultant eq checks that any two values are equal according to both supplied eqs.
Examples
Example 1
Example 1
import { intersect, struct, partial, string } from "./comparable.ts";
import { pipe } from "./fn.ts";
const { compare } = pipe(
struct({ firstName: string }),
intersect(partial({ lastName: string }))
);
const batman = { firstName: "Batman" };
const grace = { firstName: "Grace", lastName: "Hopper" };
const result1 = compare(batman)(grace); // false
const result2 = compare(grace)(grace); // true
Parameters
second: Comparable<I>
Returns
<A>(first: Comparable<A>) => Comparable<Spread<A & I>>