Created
July 20, 2018 23:29
-
-
Save reddyonrails/5b39d40a4753269465644053bf5e937a to your computer and use it in GitHub Desktop.
Revisions
-
reddyonrails created this gist
Jul 20, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ async function *getRecords() { const initialResponse = await getRecords(); yield* initialResponse.data; let nextPage = initialResponse.pagination_token; while(nextPage) { const response = await getRecords(nextPage); yield* response.data; nextPage = response.pagination_token; } } for await (const record of getRecords()) { handle(record); }