Skip to content

Instantly share code, notes, and snippets.

@GabeDuarteM
Last active March 19, 2020 17:53
Show Gist options
  • Select an option

  • Save GabeDuarteM/24459e46ca5a0b87eaa765695bfb4ea0 to your computer and use it in GitHub Desktop.

Select an option

Save GabeDuarteM/24459e46ca5a0b87eaa765695bfb4ea0 to your computer and use it in GitHub Desktop.
utilities
function paginateList<T>(list: T[], currentPage: number, totalPerPage: number) {
const start = (currentPage - 1) * totalPerPage;
const end = start + totalPerPage;
const pageList = list.slice(start, end);
return pageList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment