-
-
Save myndzi/0667436bfb4efb631d68683034a8c681 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getFoos(nextOffset, results) { | |
| nextOffset = nextOffset || 0; | |
| results = results || [ ]; | |
| return Promise.try(() => { | |
| return getSomeFoos(nextOffset); | |
| }).then(res => { | |
| let newResults = results.concat(res.foos); | |
| return res.hasMore ? | |
| getFoos(res.nextOffset, newResults) : | |
| newResults | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment