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

constant

import { constant } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/fn.ts";

Create a Fn that always returns a value. This is equivalent to of but without the ability to specify a contravariant argument.

@example
import { constant } from "./fn.ts";

const alwaysA = constant("A");

const result = alwaysA(); // "A"
function constant<A>(a: A): () => A;
§
constant<A>(a: A): () => A
[src]

§Type Parameters

§Parameters

§Return Type

§
() => A
[src]