refactor: avoid using unnecessary variables
This commit is contained in:
parent
bec0ec4ee6
commit
0085c22003
1 changed files with 5 additions and 3 deletions
|
|
@ -161,9 +161,11 @@ function plugins (settings, deviceId) {
|
||||||
return _.map(([acc, bill]) => acc + bill.provisioned, _.zip(sum, bills))
|
return _.map(([acc, bill]) => acc + bill.provisioned, _.zip(sum, bills))
|
||||||
}
|
}
|
||||||
|
|
||||||
const provisioned = _.reduce(sumTxs, _.map(_.constant(0), recyclers), redeemableTxs)
|
const counts = _.flow(
|
||||||
const zipped = _.zip(_.map('count', recyclers), provisioned)
|
_.reduce(sumTxs, _.map(_.constant(0), recyclers)),
|
||||||
const counts = _.map(r => r[0] - r[1], zipped)
|
_.zip(_.map('count', recyclers)),
|
||||||
|
_.map(([count, provisioned]) => count - provisioned),
|
||||||
|
)(redeemableTxs)
|
||||||
|
|
||||||
if (_.some(_.lt(_, 0), counts)) {
|
if (_.some(_.lt(_, 0), counts)) {
|
||||||
throw new Error('Negative note count: %j', counts)
|
throw new Error('Negative note count: %j', counts)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue