From b536ebda5b3830c0746ccc3b6b34b8052778b273 Mon Sep 17 00:00:00 2001 From: Skylar Grant Date: Thu, 26 Sep 2024 19:30:01 -0400 Subject: [PATCH] Add ability to handle pages of different length, defaulting to 10 --- CustomModules/Indexer.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CustomModules/Indexer.js b/CustomModules/Indexer.js index dacb3bb..8b9c2a3 100644 --- a/CustomModules/Indexer.js +++ b/CustomModules/Indexer.js @@ -1,5 +1,5 @@ -module.exports = (collection, page) => { - const itemsPerPage = 10; +module.exports = (collection, page, qty) => { + const itemsPerPage = qty ? qty : 10; const index = page * itemsPerPage; const totalPages = Math.ceil(collection.size / itemsPerPage); let state = page === 0 ? 'first' : 'middle';