From 93e67a67e4926853c29ba7f7db92d384c4be1a9e Mon Sep 17 00:00:00 2001 From: M IQBAL AR <32996401+kingrootid@users.noreply.github.com> Date: Wed, 27 Oct 2021 14:51:48 +0700 Subject: [PATCH] Bug page count --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 266817b..4d34bfd 100644 --- a/index.js +++ b/index.js @@ -19,10 +19,10 @@ const calculateLimitAndOffset = (currentPage, pageLimit = 20) => { * @param {number} pageLimit number of items per page/request * @returns {object} return the meta for pagination */ -const paginate = (currentPage, count, rows, pageLimit = 20) => { +const paginate = (currentPage, count, rows) => { const meta = { currentPage: Number(currentPage) || 1, - pageCount: Math.ceil(count / Number(pageLimit)), + pageCount: Math.ceil(count / Number(rows.length)), pageSize: rows.length, count };