UNPKG

@coveo/platform-client

Version:

The main goal of this package is to provide an easy to configure and straightforward way of querying Coveo Cloud APIs using JavaScript.

23 lines 711 B
export const normalizePaginatedOptions = (options) => { if (isDeprecatedPaginated(options)) { return options; } else { const { perPage: _, ...copiedOptions } = { ...options, pageSize: options?.perPage }; return copiedOptions; } }; const isDeprecatedPaginated = (options) => { if (!options) { return false; } const keys = Object.keys(options); if (!keys.includes('perPage')) { return true; } if (keys.includes('pageSize')) { throw new Error('The Pagination options are invalid: both pageSize and perPage have been set. Use only one of them.'); } return false; }; //# sourceMappingURL=normalizePaginatedOptions.js.map