Skip to content

Instantly share code, notes, and snippets.

@wingkwong
Created May 19, 2021 05:40
Show Gist options
  • Save wingkwong/68e2c9f9378b03cde751ee174d7cfde3 to your computer and use it in GitHub Desktop.
Save wingkwong/68e2c9f9378b03cde751ee174d7cfde3 to your computer and use it in GitHub Desktop.
Paginate JSON object
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