DEV Community

Discussion on: ES2018. Real-life simple usage of async iteration: get paginated data from REST APIs in 20 lines of code

 
exacs profile image
Carlos Saito

Thanks for the suggestion! Your solution would work perfectly :)

I don't think that my solution is valid for all scenarios but might be good sometimes. For example:

  • We want to fetch pages until we met some condition (for example, search the last 10 commits that says "refactor" in the text) where we don't want to fetch all pages
  • The API doesn't return the "last" page in the header