Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/rambda/mod.ts>clamp

Faster and smaller alternative to Ramda
Go to Latest
function clamp
import { clamp } from "https://deno.land/x/rambda@9.2.1/mod.ts";

Restrict a number input to be within min and max limits.

If input is bigger than max, then the result is max.

If input is smaller than min, then the result is min.

Parameters

min: number
max: number
input: number

Returns

number

Parameters

min: number
max: number

Returns

(input: number) => number