0.1.5 • Published 6 years ago

array-binarysearch.comparator.closest v0.1.5

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

array-binarysearch.comparator.closest

NPM

Get index of closest value in sorted (using comparator).

DEPRECATED: Please use array-binarysearch.closest instead.

const binarySearch = require('array-binarysearch.comparator.closest');
// binarySearch(<array>, <value>, <compare function>, [this], [begin=0], [end=array.length])

binarySearch([21, 42, 91, 91], 40, (a, b) => a===b? 0:(a<b? -1:1));
// 1
binarySearch(['G', 'KG', 'KG', 'MG'], 'g', (a, b, i) => a.toLowerCase().localeCompare(b.toLowerCase()), null, 1);
// 1
binarySearch(['G', 'KG', 'KG', 'MG'], 'KG', (a, b, i, arr) => a.localeCompare(b), null, 1, 4);
// 2
0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago