- Fixes
RangeTree
given a range that ended farther than ranges beginning after it.
This occurring was dependent on how the binary tree laid itself out.
Thanks, Ross Allen, for reporting this!
- Fixes searching
RangeTree
with an empty range in it. Empty ranges are now ignored.
- Throws
RangeError
if the given bounds are not valid (not of the following:[]
,()
,[)
,(]
).
Thanks, Nikhil Benesch, for the hint!
- Adds
Range.compareBeginToEnd
- Adds support for calling
RangeTree.prototype.search
with range to find ranges that intersect.
- Adds
Range.prototype.valueOf
to get a more primitive representation of a range.
Useful with Egal.js or other libraries that compare value objects by theirvalueOf
output.
-
Makes
Range.prototype
a valid emptyRange
.
Allows you to use it as an empty range:var EMPTY_RANGE = Range.prototype EMPTY_RANGE.isEmpty() // => true EMPTY_RANGE.contains(new Range(0, 1)) // => false
-
Adds
Range.compareEndToEnd
. -
Adds
Range.union
. -
Sets numeric unbounded endpoints to
-Infinity
/Infinity
if you passNumber
toRange.parse
as the parse function.Range.parse("[15,]", Number) // => new Range(15, Infinity) Range.parse("(,3.14]", Number) // => new Range(-Infinity, 3.14, "(]")
-
Fixes
Range.prototype.intersects
to handle exclusive unbounded ranges properly. -
Adds
RangeTree
for creating an interval tree (augmented binary search tree) for searching ranges that intersect with a given value.
- Adds
Range.prototype.isBounded
. - Adds
Range.prototype.isUnbounded
. - Adds
Range.prototype.isFinite
. - Adds
Range.prototype.isInfinite
.
- Adds
Range.prototype.isEmpty
. - Adds
Range.prototype.intersects
. - Adds
Range.prototype.contains
.
- Adds support for setting range bounds with
new Range(1, 3, "[)")
to set a left-closed, right-open range. - Adds
Range.prototype.toString
to stringify a range. - Adds
Range.prototype.toJSON
as an alias toRange.prototype.toString
. - Adds
Range.parse
to parse the stringified range.
- First release. Its future is an infinite exclusive range.