Skip to content

ericanaglik/js-math-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kevin Math

npm GitHub repo size Build Status

Getting Started

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')

Golden Ratio

goldenRatio()
This function returns the golden ratio
Number.goldenRatio() → 1.61803398875

Rounding Methods

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

Degrees ↔ Radians

degToRad(n)
This methods converts degrees to radians
45.degToRad()→ 0.785

radToDeg(n)
This methods converts radians to degrees
.785.RadTodeg()→ 44.977

Money Methods

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published