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://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/fn.ts";

Map over the input of a function, turning D => A and L => D into L => A.

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

const equalsZero = (n: number): boolean => n === 0;
const strLength = (s: string): number => s.length;

const isEmpty = pipe(
  equalsZero,
  premap(strLength),
);

const result1 = isEmpty(""); // true
const result2 = isEmpty("Hello"); // false
function premap<L, D>(fld: (l: L) => D): <A>(ta: Fn<D, A>) => Fn<L, A>;
§
premap<L, D>(fld: (l: L) => D): <A>(ta: Fn<D, A>) => Fn<L, A>
[src]

§Type Parameters

§Parameters

§
fld: (l: L) => D
[src]

§Return Type

§
<A>(ta: Fn<D, A>) => Fn<L, A>
[src]