This is an extension of Immutable.js that provides sorted collections SortedMap and SortedSet. The current implementation is using highly optimized B-tree memory structure.
If one constructs a SortedSet with new SortedSet(), an error occurs, likely due to this line since this instanceof SortedSet will return true but the inner map isn't initialized so it can't provide a comparator.
It appears to be an Immutable.js convention to not use the new operator but the Immutable.js types also don't break when using the new operator so SortedMap and SortedSet shouldn't either. (SortedMap appears to not suffer from this problem, though.)
If one constructs a
SortedSet
withnew SortedSet()
, an error occurs, likely due to this line sincethis instanceof SortedSet
will returntrue
but the inner map isn't initialized so it can't provide a comparator.It appears to be an Immutable.js convention to not use the
new
operator but the Immutable.js types also don't break when using thenew
operator soSortedMap
andSortedSet
shouldn't either. (SortedMap
appears to not suffer from this problem, though.)