Sorted set data structures in JavaScript