Created
March 18, 2021 13:14
-
-
Save ponich/cc471a7915d2bc2ee6962ce6a3970477 to your computer and use it in GitHub Desktop.
get data from array by pagination
This file contains 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
function getPagedData({data, page, size}) { | |
const skip = (page * size) - size; | |
return data.slice(skip, size + skip); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment