# @iamniel/mortgage-calculator

## Description

This is simple property mortage calculator library. The calculus behind mortgage payments is complicated, but the Mortgage Calculator makes this math problem quick and easy.

## Table of Contents

- Installation
- Methods
- Usage
- calculate (Method)
- downPaymentValue (Method)
- downPaymentPerc (Method)
- Contributing

## Installation

`npm install @iamniel/mortgage-calculator`

## Methods

- calculate
- downPaymentValue
- downPaymentPerc

## Usage

```
const calculator = require("@iamniel/mortgage-calculator");
calculator.downPaymentValue(4100, 20);
```

## calculate(Method)

```
const calculator = require("@iamniel/mortgage-calculator");
// calculator.calculate(price, rate, period, downPaymentPerc, annualTax, additionalFees);
calculator.calculate(4100, 4.5, 25, 20);
```

Parameters:

- price: (Required) Property Price must be a number. Price must be a positive number.
- rate: (Required) Interest Rate must be a positive number. This is what the lender charges you to lend you the money. Interest rates are expressed as an annual percentage.
- period: (Required) Period must be a positive number. Must in years. Must be less than 100.
- downPaymentPerc: (Required) Down Payment Percentage must be in number. Must be between 1-99.
- annualTax: (optional) Annual Tax must be a number. Price must be a positive number.
- additionalFees: (optional) Additional Monthly Fees must be a number. Price must be a positive number.

## downPaymentValue(Method)

```
const calculator = require("@iamniel/mortgage-calculator");
// calculator.downPaymentValue(price, downPaymentPerc);
calculator.downPaymentValue(4100, 20);
```

Parameters:

- price: (Required) Property Price must be a number. Price must be a positive number.
- downPaymentPerc: (Required) Down Payment Percentage must be in number. Must be between 1-99.

## downPaymentPerc(Method)

```
const calculator = require("@iamniel/mortgage-calculator");
// calculator.downPaymentPerc(price, downPaymentPrice);
calculator.downPaymentPerc(4100, 820);
```

Parameters:

- price: (Required) Property Price must be a number. Price must be a positive number.
- downPaymentPrice: (Required) Down Payment Price must be in number. Price must be greater than 0 and less than original price.

## Contributing

Feel free to fork this repo and make it your own! If you think your changes could be widely used, submit a pull request!