Readplace

:hammer: Use only one 'interest amount' variable to return · FagnerMartinsBrack/jack-the-moneylender@649a980

GitHub 1 min read
View original
  • current

This article is too short to summarise.

@@ -18,34 +18,24 @@

1818

const greaterThan5000 = { endOfRange: Money('$5000.00'), interestPerDollar: Money('$0.14'), previousInterestPerDollar: Money('$0.09') };

1919

const greaterThan10000 = { endOfRange: Money('$10000.00'), interestPerDollar: Money('$0.21'), previousInterestPerDollar: Money('$0.14') };

202021-

if (loanAmount.greaterThan(Money('$2000.00')) && loanAmount.lessThan(Money('$5001.00'))) {

22-

let interestAmount = Money('$0.00');

21+

let interestAmount = Money('$0.00');

232223+

if (loanAmount.greaterThan(Money('$2000.00')) && loanAmount.lessThan(Money('$5001.00'))) {

2424

interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));

25-26-

return interestAmount;

2725

}

28262927

if (loanAmount.greaterThan(Money('$5000.00')) && loanAmount.lessThan(Money('$10001.00'))) {

30-

let interestAmount = Money('$0.00');

31-3228

interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));

3329

interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan5000));

34-35-

return interestAmount;

3630

}

37313832

if (loanAmount.greaterThan(Money('$10000.00'))) {

39-

let interestAmount = Money('$0.00');

40-4133

interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan2000));

4234

interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan5000));

4335

interestAmount = interestAmount.plus(calculateInterest(loanAmount, greaterThan10000));

44-45-

return interestAmount;

4636

}

473748-

return Money('$0.00');

38+

return interestAmount;

4939

};

50405141

QUnit.module('Loans of $2000 and below are interest-free. For example');