Skip to content

Changes to the .pagination API #1215

@PopGoesTheWza

Description

@PopGoesTheWza

What problem are you trying to solve?

Improve .pagination API (and possibly performance and stability)

Describe the feature

I would humbly suggest the following 2 breaking changes:

  • Switch order of allItems and currentItems parameters of pagination.paginate, pagination.filter and pagination.shouldContinue

My reasoning about parameters order is that probably most use cases don't need the allItems parameters, with currentItems typically being more used. To be confirmed by other users, but if indeed currentItems is used more than allItems then it should reflect in the order of parameters.

It doesn't change how the Got code works but could save custom pagination.paginate, pagination.filter and pagination.shouldContinue from having an unused and unaesthetic _ as the second parameter... ;)

  • Default value for stackAllItem to false

As per the default of allItems, it implies a waste of CPU and RAM resources when unused. This is especially noticeable when iterating large datasets (and can results in a node.js crash in worst case scenarios)

Checklist

  • I have read the documentation and made sure this feature doesn't already exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions