Skip to content

sindresorhus/math-clamp

main
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

math-clamp

Clamp a number

Install

$ npm install math-clamp

Usage

import mathClamp from 'math-clamp';

mathClamp(1, {minimum: 2, maximum: 4});
//=> 2

API

mathClamp(number, {minimum, maximum})

Related