npm.io
1.2.0 • Published 3 years ago

just-in-range

Licence
MIT
Version
1.2.0
Deps
0
Size
5 kB
Vulns
0
Weekly
0
Stars
6.2K

just-in-range

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-in-range
yarn add just-in-range

Check if number is within a given range

  import inRange from 'just-number-in-range'

/*
  inRange(2, 1, 10); // true
  inRange(15, 20); // true
  inRange(20, 21, 30); // false
  inRange(30, 21, 30); // false
  inRange(); // throws
  inRange(100); // throws
  inRange("js"); // throws
*/

Keywords