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

Update index.js #53

Closed
wants to merge 1 commit into from
Closed

Conversation

dfdeagle47
Copy link
Contributor

Fix to .limit(n): if the next page is not a url (e.g. the link is broken or we reached the last page), the method should return fn(null, pages), and not call fn(null, pages) and continue to the next page.

Right now, x-ray crashes if the we choose n > number of pages in limit(n), whereas it should just return the fn(null, pages) once it reaches the end.

Fix to .limit(n): if the next page is not a url (e.g. the link is broken or we reached the last page), the method should return fn(null, pages), and not call fn(null, pages) and continue to the next page.
@matthewmueller
Copy link
Owner

Doh, good catch. If you have a chance, would you mind adding a test?

cosminonea added a commit to cosminonea/x-ray that referenced this pull request Jun 24, 2015
When reaching the last page the callback function is called twice.
This fixes matthewmueller#53

Added a test but it’s a bit messy because it’s a negative test and I am
not a javascript dev so I hope someone can refactor it in a more
elegant way.
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

Successfully merging this pull request may close these issues.

2 participants