🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@apmyp/kredito.js

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@apmyp/kredito.js

A tiny loan functions

latest
Source
npmnpm
Version
1.0.5
Version published
Weekly downloads
3
-78.57%
Maintainers
1
Weekly downloads
 
Created
Source

kredito.js

kredito.js logo

npm version Build Status License

A tiny (~498 bytes) and fast module to calculate loan for JavaScript. May be used in both CommonJS and ES module systems.

First, you install it:

$ npm i @apmyp/kredito.js

Then, you just use it like this for annuity payment type:

import { Annuity } from "@apmyp/kredito.js";

const principal = 100000;
const interestRate = 0.12 / 12; // 12% per year we should convert to 1% per month
const installments = 24;
const annuity = new Annuity(principal, interestRate, installments);

annuity.payment(); //=> 4707.35
annuity.percentageInPayment(1); //=> 1000
annuity.bodyInPayment(1); //=> 3707.35
annuity.totalCost(); //=> 112976.33
annuity.overpayment(); //=> 12976.33

Or like this for linear payment type:

import { Linear } from "@apmyp/kredito.js";

const principal = 100000;
const interestRate = 0.12 / 12; // 12% per year we should convert to 1% per month
const installments = 24;
const linear = new Linear(principal, interestRate, installments);

linear.payment(1); //=> 5166.67
linear.percentageInPayment(1); //=> 1000
linear.bodyInPayment(); //=> 4166.67
linear.totalCost(); //=> 112500
linear.overpayment(); //=> 12500

If you want to use CommonJS modules:

const { Annuity, Linear } = require('@apmyp/kredito.js');

Keywords

money

FAQs

Package last updated on 08 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts