UNPKG

@mcnoble/interest

Version:

A simple interest and compound interest calculator

35 lines (24 loc) 651 B
# Interest Calculator A simple and compound interest calculator for JavaScript and Node.js. ## Installation ```bash npm install @mcnoble/interest ``` ## Usage ```javascript // ES6 import simpleInterest from '@mcnoble/interest'; import compoundInterest from '@mcnoble/interest'; // Simple Interest simpleInterest(principal, rate, time); // Compound Interest compoundInterest(principal, rate, time, frequency); ``` ## Example ```javascript const interest = require('@mcnoble/interest'); // Simple Interest console.log(simpleInterest(1000, 5, 2)); // 100 // Compound Interest console.log(compoundInterest(1000, 5, 2, "annually")); // 102.5 ```