excel-npv
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

excel-npv

Get Finance NPV values as similar to Excel NPV function with Node package solution.

Introduction

excel-npv makes it easy to incorporate common npv calculations into your application. The library is built on pure JavaScript without any dependencies.

This project is hosted on GitHub. You can report bugs and discuss features on the GitHub issues page.

Getting Started

npm install excel-npv --save

or

  • Download or fork the repository from GitHub.
  • Extract the file excel-npv from the project and include it in your application on the client side.

Example Usage

var Finance = require('excel-npv');
var finance = new Finance();
// To calculate NPV
finance.NPV(3.125, -100000, 50000, 40000, 30000, 20000);
// => 30,192.11

Typescript

import { Finance } from 'excel-npv'
let finance = new Finance();
// To calculate NPV
finance.NPV(3.125, -100000, 50000, 40000, 30000, 20000);
// => 30,192.11

Net Present Value (NPV)

finance.NPV(discountRate, intialInvestment, [cash flows]);

Net Present Value (NPV) compares the money received in the future to an amount of money received today, while accounting for time and interest [through the discount rate]. It's based on the principal of time value of money (TVM), which explains how time affects monetary value.1

[cash flows] takes any number of projected cash flows.

// e.g., If discount rate is 10%, initial investment is -$1,000, cash flow in year 1 is $200,000, year 2 is $300,000, and year 3 is $200,000, the NPV is $80,015.03.

 finance.NPV(10, -500000, 200000, 300000, 200000);
 => 72740.93

Contributing

Contributions are welcome to aid in the expansion of the library. In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality, and please lint and test your code.

Reference

  1. Investopedia

Readme

Keywords

Package Sidebar

Install

npm i excel-npv

Weekly Downloads

2

Version

1.2.2

License

MIT

Unpacked Size

5.39 kB

Total Files

6

Last publish

Collaborators

  • govardhan-srinivas