Created
August 30, 2020 22:31
-
-
Save jhonnymoreira/e94abedcb32a2a2c021c7626546715b7 to your computer and use it in GitHub Desktop.
Calculo da quantia a ser paga de DAS-MEI em um determinado intervalo.
This file contains hidden or 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
const getMEIDebt = (indexBegin, length) => { | |
const NODE_SELECTOR = '.total.updatable.text-center'; | |
const sum = (x, y) => x + y; | |
const normalizeValue = (value) => | |
value.replace('R$', '').replace(',', '.').trim(); | |
return Array.from(document.querySelectorAll(NODE_SELECTOR)) | |
.slice(indexBegin, length) | |
.map((node) => parseFloat(normalizeValue(node.innerText))) | |
.reduce(sum, 0) | |
.toLocaleString('pt-BR', { style: 'currency', currency: 'BRL' }); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uso