import Big from 'big.js' export function orderAmount(row) { return new Big(Number(row.isDiscount) === 1 && row.discountAmount != null && row.discountAmount !== '' ? row.discountAmount : (row.totalPrice || 0)) } export function sumOrderAmounts(rows) { return rows.reduce((total, row) => total.plus(orderAmount(row)), new Big(0)).toFixed(2) }