Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function normalizePaging(response) {
if (!response.links || !response.links.last) {
return {
count: 0,
pages: 0,
};
}
const query = parse(
url.parse(response.links.last).query,
);
const numPages = parseInt(query.page.number, 10);
const numPerPage = parseInt(query.page.size, 10);
return {
count: numPages * numPerPage,
pages: numPages,
};
}