Created
April 6, 2020 07:11
-
-
Save juliusdejon/7297e275aa3b7a015ed358a5b2ac6289 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Pagination settings. | |
* | |
* @param {Object} pagination: {page, limit} | |
* @returns {Object} | |
*/ | |
export function paginate(pagination) { | |
const { page = 1, limit = 10 } = pagination; | |
const offset = (page - 1) * limit; | |
return { | |
page, | |
offset, | |
limit, | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.