-
Notifications
You must be signed in to change notification settings - Fork 146
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested
Description
I have included some thoughts here of how it could be implemented, but it is very much open to discussion.
- It could implement the async iterator protocol where each call to obj.next() will return a promise and the value (i.e. for a logs iterator it would return a specific log - not a page of logs)
- Include a getAll method that iterates until all pages have been fetched and returns them as a single array (?) or exposes them through the normal iteration system
- If we implement a standard way of doing this it would allow users to loop over results with ease while hiding the underlying complexity of fetching pages
- (But that may encourage bad patterns? People looping over all results not realising it is making many requests?)
- This would be a breaking change if we drop it in. Could we make it default to returning an array and allow a special parameter to return iterators? Or we could make it part of the v5 and replace it - but it is an increase in complexity to understand these iterators.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is neededquestionFurther information is requestedFurther information is requested