const isValidPage = function(page, postsPerPage, totalPosts) { return (!(page === 0 || page -1 >= totalPosts/postsPerPage)); }; module.exports= { main: function(baseURL, currentPage, postsPerPage, totalPosts) { var nextPage = currentPage + 1; var previousPage = currentPage - 1; var olderPosts = ""; var newerPosts = ""; if (isValidPage(previousPage, postsPerPage, totalPosts)) { newerPosts = ""; } if (isValidPage(nextPage, postsPerPage, totalPosts)) { olderPosts = ""; } return "