npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@investo/invform

v1.1.6

Published

A versatile library of investment formulas...

Downloads

10

Readme

📊 @investo/invform

A versatile and developer-friendly library of core investment formulas, including NPV, IRR, ROI, DCF, and more — ideal for financial modeling, analytics, and automation.

Table of Contents


Features

  • 📈 Net Present Value (NPV)
  • 📉 Internal Rate of Return (IRR)
  • 💰 Return on Investment (ROI)
  • 📆 Discounted Cash Flow (DCF)
  • 🧮 Time Value of Money calculations
  • 🔧 Typed and well-documented functions

Installation

npm install @investo/invform

Examples

📈 calculateInvestment

Calculates the total investment based on the number of assets, price per asset, and optional fee.

📦 Import

import { calculateInvestment  } from "@inveto/invform"

🧮 Signature

calculateInvestment(amount: number, pricePerAsset: number, fee?: number): number

📋 Parameters

  • amount (number): The number of assets purchased. Must be greater than or equal to 0.
  • pricePerAsset (number): The price of a single asset. Must be greater than or equal to 0.
  • fee (number, optional, default = 0): Transaction fee. Must be greater than or equal to 0.

🧪 Usage Examples

calculateInvestment(10, 100, 5); // => 1005

calculateInvestment(10, 100); // => 1000 (if fee is not provided)

📉 calculateAssetsFromInvestment

Calculates how many assets can be purchased with a given investment, price per coin, and optional fee.

📦 Import

import { calculateAssetsFromInvestment  } from "@inveto/invform"

🧮 Signature

calculateAssetsFromInvestment(investment: number, pricePerAsset: number, fee?: number): number

📋 Parameters

  • investment (number): Total amount of money available. Must be ≥ 0.
  • pricePerAsset (number): Price of a single asset. Must be > 0.
  • fee (number, optional, default = 0): Optional transaction fee. Must be ≥ 0.

🧪 Usage Examples

calculateAssetsFromInvestment(1000, 100, 50); // => 9.5

💰 calculatePricePerAsset

Calculates the effective price per asset based on the total investment amount, the number of assets received, and an optional fee.

📦 Import

import { calculatePricePerAsset  } from "@inveto/invform"

🧮 Signature

calculatePricePerAsset(investment: number, amount: number, fee?: number): number

📋 Parameters

  • investment (number): Total amount spent. Must be ≥ 0.
  • amount (number): Number of assets received. Must be > 0.
  • fee (number, optional, default = 0): Optional transaction fee. Must be ≥ 0.

🧪 Usage Examples

calculatePricePerAsset(1050, 10, 50); // => 100

💵 calculateNetSaleProceeds

Calculates the net proceeds from selling assets, subtracting any transaction fee from the total sale value.

📦 Import

import { calculateNetSaleProceeds  } from "@inveto/invform"

🧮 Signature

calculateNetSaleProceeds(amount: number, price: number, fee?: number): number

📋 Parameters

  • amount (number): Number of assets sold. Must be ≥ 0.
  • price (number): Selling price per asset. Must be ≥ 0.
  • fee (number, optional, default = 0): Transaction fee. Must be ≥ 0.

🧪 Usage Examples

calculateNetSaleProceeds(10, 50, 20); // => 480

📊 calculateProfit

Calculates the profit (or loss) from selling an asset.

📦 Import

import { calculateProfit  } from "@inveto/invform"

🧮 Signature

calculateProfit(saleProceeds: number, investment: number): number

📋 Parameters

  • saleProceeds (number): The amount received from selling the asset. Must be ≥ 0.
  • investment (number): The total amount originally invested. Must be ≥ 0.

🧪 Usage Examples

calculateProfit(1100, 900); // => 200

🏦 calculateRemainingInvestment

Calculates the remaining investment after a partial withdrawal.

📦 Import

import { calculateRemainingInvestment  } from "@inveto/invform"

🧮 Signature

calculateRemainingInvestment(initialInvestment: number, withdrawnAmount: number): number

📋 Parameters

  • initialInvestment (number): The original total investment. Must be ≥ 0.
  • withdrawnAmount (number): The amount withdrawn. Must be ≥ 0.

🧪 Usage Examples

calculateRemainingInvestment(10000, 4000); // => 6000