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

clamp

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

Construct an inclusive clamp function over A from Sortable.

@example
import * as O from "./sortable.ts";
import { SortableNumber } from "./number.ts";

const clamp = O.clamp(SortableNumber);
const clamp1 = clamp(0, 10)

const result1 = clamp1(-1); // 0
const result2 = clamp1(1); // 1
const result3 = clamp1(100); // 10
function clamp<A>(sort: Sortable<A>): (low: A, high: A) => (value: A) => A;
§
clamp<A>(sort: Sortable<A>): (low: A, high: A) => (value: A) => A
[src]

§Type Parameters

§Parameters

§Return Type

§
(low: A, high: A) => (value: A) => A
[src]