import { predicate } from "https://deno.land/x/fun@v.2.0.0-alpha.11/mod.ts";
const { contramap } = predicate;
Create a Predicate using a Predicate and a function that takes a type L and returns a type D. This maps over the input value of the predicate.
Examples
Example 1
Example 1
import { contramap } from "./predicate.ts";
import { pipe } from "./fn.ts";
const isGreaterThan3 = (n: number) => n > 3;
const isLongerThan3 = pipe(
isGreaterThan3,
contramap((s: string) => s.length),
);
const result1 = isLongerThan3("Hello"); // true
const result2 = isLongerThan3("Hi"); // false