0.1.4 • Published 6 years ago

array-binarysearch.comparator.last v0.1.4

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

array-binarysearch.comparator.last

NPM

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

DEPRECATED: Please use array-binarysearch.last instead.

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

binarySearch([21, 42, 91, 91], 91, (a, b) => a===b? 0:(a<b? -1:1));
// 3
binarySearch(['G', 'KG', 'KG', 'MG'], 'g', (a, b, i) => a.toLowerCase().localeCompare(b.toLowerCase()), null, 1);
// -2 (-ve => not found, closest: ~(-2) = 1)
binarySearch(['G', 'KG', 'KG', 'MG'], 'KG', (a, b, i, arr) => a.localeCompare(b), null, 1, 4);
// 2
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.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