Created
April 24, 2023 17:32
-
-
Save wevertoum/87a434e67137a1e41497706553f075f8 to your computer and use it in GitHub Desktop.
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
// typeSum can be "aposta" or "ganhos" | |
const reportPixBet = (typeSum = "aposta") => { | |
let arr = []; | |
document | |
.querySelectorAll(`tr[id^='rwid'] td:nth-child(${typeSum === "ganhos" ? "6" : "5"})`) | |
.forEach(function (el) { | |
const str = el.innerText; | |
arr.push(str); | |
}); | |
const total = arr.reduce( | |
(acc, curr) => acc + parseFloat(curr.replace(/[^0-9.-]+/g, "")), | |
0 | |
); | |
return total.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