tiny-binary-search
A very small binary search index.
Install
npm install tiny-binary-search
Usage
var index = new BinarySearchIndex([
{ value: 0, id: "A" },
{ value: 1, id: "B" },
{ value: 2, id: "C" },
{ value: 3, id: "D" },
{ value: 4, id: "E" },
{ value: 5, id: "F" },
{ value: 6, id: "G" },
{ value: 7, id: "H" },
{ value: 8, id: "I" },
{ value: 9, id: "J" }
]);
index.query(5);
index.between(1, 3);
index.getIndex(0.5);
index.insert({value: 0.5, id: "AA"});
index.bulkAdd([
{ value: 1.5, id: "BB" },
{ value: 2.5, id: "CC" },
]);
This module is distributed as a UMD module and can also be used in AMD based systems or as a global under the BinarySearchIndex
namespace.
Issues
Find a bug or want to request a new feature? Please let us know by submitting an issue.