Skip to content
Permalink
Browse files

perf(sum-amounts): use BigNumber.sum to sum

  • Loading branch information...
devinus committed Dec 26, 2018
1 parent 2f76606 commit db15449f01ce625a637df0022e643920ee633cf4
Showing with 2 additions and 4 deletions.
  1. +2 −4 app/utils/sum-amounts.js
@@ -4,8 +4,6 @@ import { isPresent } from '@ember/utils';
import BigNumber from 'bignumber.js';

export default function sumAmounts(amounts, defaultValue = 0) {
return A(amounts)
.filter(isPresent)
.map(x => new BigNumber(String(x)))
.reduce((x, y) => y.plus(x), defaultValue);
const values = A(amounts).filter(isPresent);
return BigNumber.sum(defaultValue, ...values);
}

0 comments on commit db15449

Please sign in to comment.
You can’t perform that action at this time.