Join us to discuss the challenges, solutions and best practices for in-house JavaScript code sharing. Tuesday, 12/17 at 10am PT/1pm ET.Sign up here »

closeness

1.0.0 • Public • Published

closeness

browser support

Test the proximal range of values

npm install closeness

example

The constructor takes 2 parameters, the target value, and the proximal range you want to test. It returns a function which takes a singe value as an argument, and return true or false if it is close enough.

var howClose = require('closeness');
 
var close = howClose(100, 5) // returns a fn that will test if your number is with 5 of 100
 
if(close(96)) console.log('yep its close enough')
if(!(close(50))) console.log('not close enough')
 

license

MIT I GUESS

Keywords

none

Install

npm i closeness

DownloadsWeekly Downloads

1

Version

1.0.0

License

none

Last publish

Collaborators

  • avatar