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

@michitson/cre-irr

v0.1.0

Published

IRR and tornado sensitivity analysis for commercial-real-estate deals. Pure, zero-dependency, validated against a golden fixture.

Readme

@michitson/cre-irr

IRR and tornado sensitivity analysis for commercial-real-estate (CRE) deals. Pure, zero-dependency TypeScript, validated against a golden fixture.

Status: pre-publish (0.1.0). Extracted from the CRE deal-analyst project as a standalone, reusable library — the one piece of authored domain logic that survives every architecture change around it.

Install

npm install @michitson/cre-irr

Usage

import { calculateIrr, runSensitivity } from '@michitson/cre-irr';

const deal = {
  purchasePrice: 5_000_000,
  netOperatingIncome: 400_000, // year 1 NOI
  noiGrowthRate: 3,            // percent, e.g. 3 = 3%/yr
  holdPeriod: 10,             // years
  exitCapRate: 6.5,           // percent
};

const irr = calculateIrr(deal);
console.log(irr.irrPercentage);  // e.g. 12.544692996050152

const tornado = runSensitivity(deal);
// variables ranked by IRR spread (max − min) across the sweep
console.log(tornado.variables.map((v) => [v.name, v.spreadPp]));

What it does

  • calculateIrr(inputs) — projects annual cash flows (year-1 NOI grown at noiGrowthRate), capitalises forward NOI at exitCapRate for the exit value, and solves IRR by bisection (100 iterations, |NPV| < 1e-6). Returns the IRR, total return, year-1 cash flow, exit value, and the full cash-flow array.
  • runSensitivity(inputs) — a tornado sweep that moves each variable and ranks them by IRR spread. Mixed-mode by variable type: rate variables (noiGrowthRate, exitCapRate) move in basis points (±50/±100 bp); dollar/period variables (purchasePrice, netOperatingIncome, holdPeriod) move multiplicatively (±10%/±20%) — the way CRE practitioners actually think about each.

Determinism and correctness

The IRR is computed by code, not estimated — and it's locked to a golden fixture (test/fixtures/irr_reference_values.json) extracted from a reference Python implementation. Parity is asserted to 4 decimal places. The exported irrPercentage for the standard case is 12.544692996050152; that value is the cross-implementation contract.

Develop

npm test        # vitest — golden-fixture parity + economic sanity
npm run build   # emit dist/ (ESM + .d.ts)

License

MIT © Andrew Michitson