Created
May 19, 2021 05:40
-
-
Save wingkwong/68e2c9f9378b03cde751ee174d7cfde3 to your computer and use it in GitHub Desktop.
Paginate JSON object
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
var paginate = function(page, limit) { | |
page = page || DEFAULT_PAGE | |
limit = limit || DEFAULT_LIMIT | |
return json_obj.slice((page - 1) * limit).slice(0, limit) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment