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

.last() on a .filter()'d vector returning undefined (v. 2.4.0) #141

Closed
dahjelle opened this issue Oct 17, 2014 · 3 comments
Closed

.last() on a .filter()'d vector returning undefined (v. 2.4.0) #141

dahjelle opened this issue Oct 17, 2014 · 3 comments

Comments

@dahjelle
Copy link

Hi!

Just starting with immutable-js, so please let me know if I'm missing something simple.

I would have expected the following node snippet to return 3:

var Immutable = require( "immutable" );
Immutable.Vector( 1, 2, 3, 4 )
  .filter( function( x ) { return x === 3; } )
  .last(); // undefined

It returns undefined. Is this due to the lazy nature of sequences?

If I use toVector() in the chain, it returns 3 as expected.

var Immutable = require( "immutable" );
Immutable.Vector( 1, 2, 3, 4 )
  .filter( function( x ) { return x === 3; } )
  .toVector()
  .last(); // 3
@leebyron
Copy link
Collaborator

Solved in 9e63cc0 - will be on npm soon

@leebyron
Copy link
Collaborator

Thanks again for the report!

@dahjelle
Copy link
Author

That's awesome—thanks!

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

No branches or pull requests

2 participants