export const getPageCount = (totalCount, limit) => {
    return Math.ceil(totalCount / limit)
}

export const getPagesArray = (totalPages) => {
    let result = [];
    for (let i = 0; i < totalPages; i++) {
        result.push(i + 1)
    }
    return result;
}

export const getPreviousAndNextPage = (totalPages, page) => {
    let pagesArray = getPagesArray(totalPages);
    let previousPage = page !== 1 ? page - 1 : page;
    let nextPage = page < pagesArray.length ? page + 1 : page;

    return [previousPage, nextPage];
}