Then I tried to get a sorted set with the largest value first (smallest first by default) by calling reversed():
> var SortedSet = require('collections/sorted-set')
> var ss = new SortedSet([2, 8, 5, 3, 11])
> ss.toArray()
[ 2, 3, 5, 8, 11 ]
> var iss = ss.reversed()
TypeError: this.constructClone(...).reverse is not a function
at SortedSet.GenericCollection.reversed (.../node_modules/collections/generic-collection.js:254:38)
at repl:1:14
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at REPLServer.defaultEval (repl.js:339:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:191:7)
at REPLServer.Interface._onLine (readline.js:241:10)
I installed collections 5.0.6 via NPM today:
Then I tried to get a sorted set with the largest value first (smallest first by default) by calling reversed():
The docs claim SortedSet to have a reversed() method: http://www.collectionsjs.com/sorted-set http://www.collectionsjs.com/method/reversed
The docs also claim that reverse() (without d) method is only available for List: http://www.collectionsjs.com/method/reverse
What I was expecting was that reversed() would return another SortedSet with same contents but inverted sorting order.