Skip to content

Instantly share code, notes, and snippets.

@wevertoum
Created April 24, 2023 17:32
Show Gist options
  • Save wevertoum/87a434e67137a1e41497706553f075f8 to your computer and use it in GitHub Desktop.
Save wevertoum/87a434e67137a1e41497706553f075f8 to your computer and use it in GitHub Desktop.
// 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