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

@lacspace/money

v1.0.1

Published

Money done right — integer minor units (no floating-point cent bugs), currency-safe arithmetic, remainder-preserving allocation/split, and localized formatting via Intl. Zero-dependency, isomorphic.

Readme

@lacspace/money

Money without the floating-point bugs — integer cents, safe math, localized formatting.

npm version license

0.1 + 0.2 !== 0.3 — so never store money as a float. @lacspace/money keeps amounts as integer minor units, refuses to add different currencies, splits a bill without losing a cent, and formats with Intl. Tiny, typed, isomorphic.

Install

npm i @lacspace/money

Use it

import { money, Money } from "@lacspace/money";

const price = money(19.99, "USD");   // 1999 minor units, exact
price.multiply(3).format();          // "$59.97"
price.add(money(5, "USD"));          // $24.99
money(9.99, "USD").add(money(1, "EUR")); // ❌ throws: currency mismatch

// Split a bill three ways — the cent doesn't vanish
money(10, "USD").allocate([1, 1, 1]).map((m) => m.format());
// ["$3.34", "$3.33", "$3.33"]   (sum is exactly $10.00)

// Zero-decimal & 3-decimal currencies handled automatically
money(1000, "JPY").format("ja-JP"); // "¥1,000"
money(1.5, "BHD").toMinor();        // 1500  (BHD has 3 decimals)

Note on Money.parse(): parsing is best-effort and locale-agnostic. It can misread strings where the thousands and decimal separators are ambiguous — e.g. "1,234" is read as 1.234 (a decimal), not 1234. For untrusted or locale-specific input, prefer constructing from an explicit numeric amount (Money.of / Money.fromMinor) rather than relying on parse().

Why minor units

Money.fromMinor(1999, "USD");   // exact, no rounding surprises
Money.of(19.99, "USD");         // convenience: rounds major → minor once
money(19.99, "USD").toMinor();  // 1999

API

| | | | --- | --- | | money(major, ccy) / Money.of / Money.fromMinor / Money.zero / Money.parse | construct | | .add · .subtract · .multiply · .divide · .negate · .abs | arithmetic (currency-checked) | | .allocate(ratios) · .split(n) | remainder-preserving distribution | | .equals · .greaterThan · .lessThan · .greaterThanOrEqual · .lessThanOrEqual | compare | | .isZero · .isPositive · .isNegative | predicates | | .format(locale?, opts?) · .toString · .toMajor · .toMinor · .toJSON | output | | sumMoney(list, ccy?) · decimalsFor(ccy) | helpers |

All operations return a new Money — instances are immutable.

Licensing

Free under the Lacspace Free Licence — MIT-equivalent freedoms. Use it in personal and commercial projects at no cost; just keep the notice. See the Lacspace Licence Centre.


Part of the Lacspace ecosystem — zero-dependency, isomorphic TypeScript packages.

All packages ↗ · npm org ↗ · Licence Centre ↗ · GitHub ↗