closest-array
v1.0.0
Published
Get the closest value to a given goal from an array.
Downloads
6
Readme
closest-array
Get the closest value to a given goal from an array.
Usage
const closest = require('closest-array');
closest([ 1, 2, 3 ], 1); // 1
closest([ 10, 20, 30 ], 12); // 10