Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SortedSet error: "reverse is not a function" #183

Open
axelpale opened this issue May 13, 2017 · 2 comments
Open

SortedSet error: "reverse is not a function" #183

axelpale opened this issue May 13, 2017 · 2 comments
Labels
Milestone

Comments

@axelpale
Copy link

I installed collections 5.0.6 via NPM today:

$ npm install --save collections

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)

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.

@hthetiot hthetiot added the bug label Dec 6, 2017
@hthetiot hthetiot added this to the 5.0.x milestone Dec 6, 2017
@nickyang07
Copy link

I also have this issue. Can this be fixed?

@wittlesouth
Copy link

See also #223. I probably should have looked at this first. This has been open since 2017?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants