Binary search for JavaScript; includes equality and proximity search methods