An interval tree implemented in JS