1.0.0-alpha.0 • Published 5 years ago

@euclid/clamp v1.0.0-alpha.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@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.