@euclid/clamp
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.0 • Public • Published

@euclid/clamp

Constrain a value to lie between two further values

$ npm install @euclid/clamp

Example

let v = clamp(11, 0, 10);
//=> 10

API

Clamps the number n between min (inclusive) and max (inclusive).

clamp(n, min, max)

Returns: Number

Number clamped in range min and max.

n

Type: Number

Value to clamp.

min

Type: Number

Lower end of the range into which to constrain n.

max

Type: Number

Upper end of the range into which to constrain n.

/@euclid/clamp/

    Package Sidebar

    Install

    npm i @euclid/clamp

    Weekly Downloads

    0

    Version

    1.0.0-alpha.0

    License

    MIT

    Unpacked Size

    1.84 kB

    Total Files

    5

    Last publish

    Collaborators

    • terkelg