pagination-front-end
Version:
pagination-front-end é uma biblioteca voltada para realização de paginação no front end( pagination-front-end is a front-end paging library)
19 lines (16 loc) • 478 B
text/typescript
const filterPagination = (
items: any[],
pageSize: number,
currentPage: number
) => {
//realiza a paginação em si dos itens
const verifyItems = items == null || items == undefined;
const pageCall: number = currentPage - 1;
const contentItems: any[] = verifyItems
? []
: currentPage == 1
? items.slice(0, pageSize)
: items.slice(pageSize * pageCall, pageSize + pageSize * pageCall);
return { contentItems };
}
export default filterPagination;