Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

mima

1.0.2 • Public • Published

mima

Make sure that a number is between min and max

Build Status Test Coverage

bitHound Code bitHound Overall Score bitHound Dependencies bitHound Dev Dependencies License: MIT

Install

npm i mima --save

mima(min, x, max)

  • min <number|null|undefined>
  • x <number>
  • max <number|null|undefined>

If x is smaller than min then min is returned. If x is between min and max then x is returned. If x is bigger than max then max is returned.

Example

const mima = require('mima')
 
mima(0, -100, 1) // 0
// because -100 is smaller than 0
 
mima(0, 1, 2) // 1
// because 1 is between 0 and 2
 
mima(0, 0.3, 1) // 0.3
// because 0.3 is between 0 and 1
 
mima(5, 100, 10) // 10
// because 100 is bigger than 10

install

npm i mima

Downloadsweekly downloads

3

version

1.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability