UNPKG

twreporter-redux

Version:

redux actions and reducers for twreporter website

16 lines (13 loc) 312 B
const pageToOffset = ({ page, nPerPage }) => ({ limit: nPerPage, offset: (page - 1) * nPerPage, }) const offsetToPage = ({ limit, offset, total }) => ({ nPerPage: limit, page: Math.floor(offset / limit) + 1, totalPages: Math.ceil(total / limit), }) export default { pageToOffset, offsetToPage, }