Run the following command in your project folder:
npm install @ericanaglik/kevin-math --save
Then add this to your index.js file
require('@ericanaglik/src/kevin-math')
goldenRatio()
This function returns the golden ratio
Number.goldenRatio()
→ 1.61803398875
round()
This method rounds a number either up or down depending on which it is closest to
'9.99.round()
→ 10
roundDown()
This method rounds down
'9.99.roundDown()
→ 9
roundUp()
This method rounds up
'9.2.roundUp()
→ 10
degToRad(n)
This methods converts degrees to radians
45.degToRad()
→ 0.785
radToDeg(n)
This methods converts radians to degrees
.785.RadTodeg()
→ 44.977
toDollars(amount)
This method converts a number with a decimal point to a string with a dollar sign in front of it and an extra number placeholder at the end if needed
3.9.toDollars()
→ '$3.90'
plusTax(rate)
This method tells you the tax on a number when you pass in the rate
100.plusTax(0.08)
→ '108'
plusInterest(total, year, rate)
This methods calculates interest based on the total, year, and rate
Number.plusInterest(100,2,2)
→ 104.04
mortgage(startingLoanAmount, totalPayments, interestRate)
This methods calculates mortgage based on the starting loan, the total number of payments, and the interest rate
Number.mortgage(10,5,10)
→ 100.00