DEV Community


Discussion on: Is there a good temporary variable name that you use?

klvenky profile image
venkatesh k Author

Ideally I would have multiple pages in such case the token would be used for fetching the next set of results. It's like a SQL cursor based pagination approach.

qm3ster profile image
Mihail Malo

Then, in the style of my other answer:

async function getAllFooBar() {
  const all = []
  for await (const foo of getPaged('foo'))
    for await (const x of getPaged('bar', foo))
  return all
Enter fullscreen mode Exit fullscreen mode
Thread Thread
klvenky profile image
venkatesh k Author

Yep. That looks great. thanks.