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))
|
||||
}
|
||||
|
||||
const provisioned = _.reduce(sumTxs, _.map(_.constant(0), recyclers), redeemableTxs)
|
||||
const zipped = _.zip(_.map('count', recyclers), provisioned)
|
||||
const counts = _.map(r => r[0] - r[1], zipped)
|
||||
const counts = _.flow(
|
||||
_.reduce(sumTxs, _.map(_.constant(0), recyclers)),
|
||||
_.zip(_.map('count', recyclers)),
|
||||
_.map(([count, provisioned]) => count - provisioned),
|
||||
)(redeemableTxs)
|
||||
|
||||
if (_.some(_.lt(_, 0), counts)) {
|
||||
throw new Error('Negative note count: %j', counts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue