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

Suggestion: QuerySet.at should return undefined when not in this.rows #73

Closed
Aryk opened this issue Dec 27, 2016 · 3 comments
Closed

Suggestion: QuerySet.at should return undefined when not in this.rows #73

Aryk opened this issue Dec 27, 2016 · 3 comments

Comments

@Aryk
Copy link

Aryk commented Dec 27, 2016

Currently, if you filter down and call at and doesn't exist, it will still return something that is truthy, making calls like:

const record = model.associations.first()
if (record) {

}

not work correctly. Was this intended?

@Aryk
Copy link
Author

Aryk commented Jan 4, 2017

@tommikaikkonen , any thoughts on this? seems like it would be an easy fix to simply check if the record is there.

@tommikaikkonen
Copy link
Collaborator

Thanks for opening the issue and sorry for the delay. This was not intended functionality. With 0.9.0-rc.2, it'll return undefined when the index to access is out of bounds, like normal JavaScript Arrays.

@Aryk
Copy link
Author

Aryk commented Jan 6, 2017

No problem, thanks for adding it in!

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