refactor: map instead of pushing

This commit is contained in:
siiky 2023-10-23 10:12:07 +01:00
parent 491031a1b5
commit dd6bb6a8d3

View file

@ -250,15 +250,15 @@ function plugins (settings, deviceId) {
throw new Error('Denominations and respective counts do not match!') throw new Error('Denominations and respective counts do not match!')
} }
const recyclers = [] const recyclers = _.map(
_.forEach(it => { it => ({
recyclers.push({
number: it + 1, number: it + 1,
name: `recycler${it + 1}`, name: `recycler${it + 1}`,
denomination: parseInt(denominations[it], 10), denomination: parseInt(denominations[it], 10),
count: parseInt(counts[it], 10) count: parseInt(counts[it], 10)
}) }),
}, _.times(_.identity(), numberOfRecyclers)) _.range(0, numberOfRecyclers)
)
try { try {
return { return {