Skip to content

Latest commit

 

History

History
22 lines (13 loc) · 354 Bytes

README.md

File metadata and controls

22 lines (13 loc) · 354 Bytes

Nearby

Finds elements in an array that are within a given distance threshold.

This is useful for generating random numbers that don't collide, or have ample distance between them.

Usage

var nearby = require('nearby')
var near = nearby(5)

var arr = [1, 5, 10, 25, 40, 42]

near(arr, 12) // true
near(arr, 19) // false

License

MIT