function matchesAmounts(row, quantity, prices, num) { const factor = quantity / (["%", "%"].includes(row.Unite) ? 100 : 1); const amounts = [num(row.GC), num(row.NC), num(row.JC) + num(row.SC)]; return prices.every( (price, index) => Math.abs(Math.trunc(factor * price) - amounts[index]) <= 0.000001, ); } module.exports = { matchesAmounts };