23 lines
567 B
JavaScript
23 lines
567 B
JavaScript
export const parseWinsData = (winsArray, currency) => {
|
|
if (!winsArray || winsArray.length === 0) return ;
|
|
const totalWin = winsArray.reduce((total, [_, win]) => {
|
|
return total + win;
|
|
}, 0);
|
|
const totalWinString = currency.getFormattedValue(totalWin);
|
|
const wins = winsArray.map(([type, amount, map, lineIndex]) => {
|
|
return {
|
|
type,
|
|
amount,
|
|
amountString: currency.getFormattedValue(amount),
|
|
lineSlotsIndexMap: map,
|
|
lineIndex
|
|
}
|
|
})
|
|
const result = {
|
|
totalWin,
|
|
totalWinString,
|
|
wins
|
|
}
|
|
return result
|
|
}
|