All Projects → kfiku → LoanJS

kfiku / LoanJS

Licence: MIT license
Calculate loan in js (browser/node.js) for equal installments, installments decreasing, the sum of interest, etc.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to LoanJS

cypress-browserify-preprocessor
Cypress preprocessor for bundling JavaScript via browserify
Stars: ✭ 23 (+15%)
Mutual labels:  browserify
titaniumifier
Get a Titanium™ SDK CommonJS module out of a Node package!
Stars: ✭ 95 (+375%)
Mutual labels:  browserify
descent-app
Top of descent path calculator. Let's calculate your descent!
Stars: ✭ 28 (+40%)
Mutual labels:  calculator
fend
Arbitrary-precision unit-aware calculator
Stars: ✭ 64 (+220%)
Mutual labels:  calculator
string-math
Evaluates a math expression from a string. Supports variables and custom operators.
Stars: ✭ 14 (-30%)
Mutual labels:  calculator
simply-djs
A Simple, Easy and Beginner friendly Discord.js Package for everyone. Uses Discord.js v13
Stars: ✭ 62 (+210%)
Mutual labels:  calculator
util
封装了一些Java常用的功能
Stars: ✭ 19 (-5%)
Mutual labels:  calculator
browserify-test
An easy way to test front-end libraries using browserify and mocha
Stars: ✭ 37 (+85%)
Mutual labels:  browserify
in-line-calculator
📟 an interface-less calculator for Windows
Stars: ✭ 44 (+120%)
Mutual labels:  calculator
CaliburnMicro-Calculator
A simple Calculator using Caliburn.Micro (WPF with MVVM)
Stars: ✭ 19 (-5%)
Mutual labels:  calculator
Nota
A calculator with a beautiful interface for the Terminal, Including unicode-based charting and rich mathematical notation rendering
Stars: ✭ 45 (+125%)
Mutual labels:  calculator
android-calculator
大三上Java课设 - Android 科学计算器
Stars: ✭ 37 (+85%)
Mutual labels:  calculator
MSCalculator
Using Maplestory material and reverse Polish algorithm to complete the Android calculator.
Stars: ✭ 14 (-30%)
Mutual labels:  calculator
hellocalc
HelloCalc is a programable calculator for Android created with JavaFX.
Stars: ✭ 23 (+15%)
Mutual labels:  calculator
Binary-Calculator-JavaScript
📱 A handy Calculator for Binary operations, that works on all Devices 📱 💻 🖥 | ⛓ https://play.google.com/store/apps/details?id=com.binarycalculator.ayidouble.binarycalculator.app ⛓
Stars: ✭ 45 (+125%)
Mutual labels:  calculator
eva
a calculator REPL, similar to bc(1)
Stars: ✭ 535 (+2575%)
Mutual labels:  calculator
Sprache.Calc
Easy to use extensible calculator for .NET. Demonstrates Sprache toolkit grammar inheritance.
Stars: ✭ 42 (+110%)
Mutual labels:  calculator
Calculator
A Calculator App built with HTML, CSS, and JavaScript. It also has a Dark Mode.
Stars: ✭ 122 (+510%)
Mutual labels:  calculator
mocaccino.js
Mocha test runner as a Browserify plugin
Stars: ✭ 22 (+10%)
Mutual labels:  browserify
bezos-calculator
Small app that shows how much Jeff Bezos gained since the user started reading the page.
Stars: ✭ 46 (+130%)
Mutual labels:  calculator

LoanJS

NPM version Build Status Dependency Status Coverage Status core gzip size

Super small (~500B) and fast module to calculate loan in js (browser/node.js) for equal/decreasing installments, the sum of interest, etc.

Standard - JavaScript Style Guide

Getting Started

Install the module with:

npm install loanjs

or Bower:

bower install loan-js --save

Calculating Loan:

var LoanJS = require('loanjs');
var loan = new LoanJS.Loan(
  1000, // amount
  12,   // installments number
  5,    // interest rate
  true  // diminishing
);
/** returns
{ 
  installments  : [
    {
      capital     : number,
      interest    : number,
      installment : number,
      remain      : number
    }
  ],
  amount        : number,
  interestSum   : number,
  capitalSum    : number,
  sum           : number
}
*/

Documentation

Loan

LoanJS.Loan(amount, installmentsNumber, interestRate, diminishing)

Arguments

Argument type default Description
amount number *required full amount of Loan
installmentsNumber number *required how many installments will be (in months)
interestRate number *required interest rate in percent (ex. 3.5)
diminishing bool false if installments will be - true: diminishing; false: equal/annuity

Returns

{ 
  installments  : [
    {
      capital     : number,
      interest    : number,
      installment : number,
      remain      : number
    }
  ],
  amount        : number,
  interestSum   : number,
  capitalSum    : number,
  sum           : number
}

Examples

nodejs / browserify example

var Loan = require('loanjs').Loan;

var loan_1 = new Loan(1000, 12, 5, true);
// loan on 1 000($) in 12 diminishing installments (ex. months) with 5% interest rate

var loan_2 = new Loan(500000, 360, 3.5);
// loan on 500 000($) in 360 equal installments (30 years) with 3.5% interest rate

Browser example:

You can also render loan as html table

<script src="../../dist/loan.js"></script>
<script src="../../dist/loanToHtmlTable.js"></script>
<script>
    var loan = new LoanJS.Loan(1000, 12, 5, true);
    
    var div = document.createElement("div");
    div.innerHTML = LoanJS.loanToHtmlTable(loan); // loan rendering as html table string
    document.body.appendChild(div);
</script>

more examples here

Similar projects

Contributing

Im open to contributors :).

Release History

2017-08-06 v1.0.0

  • go to es6
  • make dist files
  • make 100% covered tests

2016-02-29 v0.1.4

  • update dependencies

2015-10-12 v0.1.3

  • fixing typo intrest -> interest #3
  • update dependencies

2014-11-10 v0.0.4

  • update dependencies

2014-11-10 v0.0.2

  • now you can use it in node/browserify and browser

License

Copyright (c) 2014 Grzegorz Klimek
Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].