Last active
February 28, 2020 17:37
-
-
Save brenofreire/2be3102ef26e94447f9724034c06941f to your computer and use it in GitHub Desktop.
Paginação otimizada
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
currentPage(direcao) { | |
const [minPages, maxPages] = [1,5]; | |
if(direcao === 'next') { | |
return Math.min(++currentPage, maxPages); | |
} | |
return Math.max(--currentPage, minPages); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment