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

premap

import { premap } from "https://raw.githubusercontent.com/baetheus/fun/main/predicate.ts";

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.

@example
import { premap } from "./predicate.ts";
import { pipe } from "./fn.ts";

const isGreaterThan3 = (n: number) => n > 3;
const isLongerThan3 = pipe(
  isGreaterThan3,
  premap((s: string) => s.length),
);

const result1 = isLongerThan3("Hello"); // true
const result2 = isLongerThan3("Hi"); // false
function premap<I, A>(fia: (i: I) => A): (ua: Predicate<A>) => Predicate<I>;
§
premap<I, A>(fia: (i: I) => A): (ua: Predicate<A>) => Predicate<I>
[src]

§Type Parameters

§Parameters

§
fia: (i: I) => A
[src]

§Return Type