Open CodeNinjaUG opened 1 year ago
"Uncaught TypeError", I think this is because of the return value from paginate is null or nan, below this, its the code for that paginate function
const paginate = (fromArray, pageActive = 1, limitPerPage = 10) => {
const newArray = Array.from(fromArray)
const startPaginate = (Number(limitPerPage) * Number(pageActive)) - (Number(limitPerPage) - 1)
const endPaginate = Number(limitPerPage) * Number(pageActive)
return newArray.slice(startPaginate - 1, (endPaginate <= newArray.length) ? endPaginate : newArray.length)
}
yes i figured it out ... import * as array from 'alga-js/array' array.paginate(arrayOfObjects, currentPage, limitPerPage) using vue 3 with composition api
Originally posted by @CodeNinjaUG in https://github.com/tedirghazali/alga-js/issues/2#issuecomment-1322009995