@clickup/rest-client
Version:
A syntax sugar tool around Node fetch() API, tailored to work with TypeScript and response validators
10 lines • 561 B
TypeScript
/**
* Keeps calling a function with an updating cursor, and depaginates all the
* results until the cursor returned is null or undefined.
*
* On each call, the inner function needs to return an array with two elements:
* 1. Array or results, which could be empty, but not null or undefined.
* 2. A new cursor.
*/
export default function depaginate<TItem, TCursor = string>(readFunc: (cursor: TCursor | undefined) => Promise<readonly [TItem[], TCursor | null | undefined]>): AsyncGenerator<TItem, void, undefined>;
//# sourceMappingURL=depaginate.d.ts.map