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

@miloun/cosmo

v1.1.0

Published

Ergonomic internationalization (i18n) and localization (l10n) for JavaScript & Node — format numbers, currency, dates, times, units, lists, relative time and plurals for any locale on the standard Intl/ICU (ECMA-402) API. Zero dependencies, no bundled loc

Downloads

427

Readme

Cosmo

Ergonomic application localisation for JavaScript / Node, built entirely on the standard Intl API.

Cosmo is a thin, ergonomic layer over the JavaScript engine's own ICU, reached through the standard Intl API. Give it a locale (and optionally a time zone) and it formats numbers, money, dates, units, lists and messages exactly the way your users expect. There are zero runtime dependencies and zero bundled locale data — every result comes straight from ICU and CLDR, covering all languages, scripts, calendars and time zones.

Cosmo is implemented consistently across four languages — the same concepts, method names and behaviour, each built directly on its platform's ICU: JavaScript · Python (docs) · Java (docs) · PHP (docs).

📖 Full documentation, API reference and live playground: https://cosmo.miloun.com/?lang=js

Requirements

  • Node 20+ (Node 22+ for duration()), or any modern browser
  • ESM-only; ships TypeScript type definitions

Install

npm install @miloun/cosmo

Quick start

import { Cosmo, cosmo } from "@miloun/cosmo";

new Cosmo("es_ES").money(11000.4, "EUR");                    // "11.000,40 €"
new Cosmo("tr").unit("temperature", "celsius", 26, "short"); // "26 °C"
new Cosmo("en").percentage(0.2);                             // "20%"
new Cosmo("fa").language("en");                             // "انگلیسی"

// or the helper
cosmo("en_AU").country();                                    // "Australia"

Underscore locales (en_AU) and BCP-47 Unicode extensions (fa-IR-u-nu-latn-ca-buddhist) are both accepted.

What you get

  • Locale display names — languages, regions, scripts, calendars and currencies, plus emoji flags and writing direction.
  • Numbers & money — decimals, percentages, currencies, units, compact notation (1.2M), scientific, and number/money ranges.
  • Dates & times — locale formats in any calendar (Gregorian, Persian, Buddhist…), durations, date ranges, and relative times ("3 days ago").
  • Text — locale-aware sort and search, word/sentence/grapheme segmentation, and case mapping.
  • Lists"A, B, and C" conjunctions and disjunctions.
  • MessagesICU MessageFormat (plural, selectordinal, select).

See the full API reference for every method, the platform notes for what Intl does and doesn't expose to JavaScript, and resources for ICU/CLDR references.

Errors

Recoverable problems throw CosmoError, with InvalidArgumentError and UnsupportedError subclasses — an invalid currency in strict mode, an unsupported unit, an unsupported symbol name, a malformed message, and the like.

License

MIT © Aiden Adrian