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

@cutticat/ms

v1.0.3

Published

CuttiCat library for parsing and formatting durations

Downloads

107

Readme

@cutticat/ms

A library for parsing and formatting time intervals (durations).

Contents

Overview

The library provides a single ms function that:

  • Parses string duration representations into milliseconds
  • Formats milliseconds into various string formats

Supports intervals (y, yr, mo, w, d, h, min, s, ms), operations (+/-), time formats (MM:SS, HH:MM:SS), and numbers in scientific notation.

Installation

pnpm i @cutticat/ms

Quick start

import { ms } from "@cutticat/ms"

// Parse strings into milliseconds
ms("10h + 5min") // 36_300_000
ms("1:30:45") // 5_445_000
ms("-5min") // -300_000
ms("1d 2mo - 1:10:20") // 5_266_180_000

// Format milliseconds into strings
ms(36_300_000) // "10h 5m"
ms(36_300_000, { format: "long" }) // "10 hours 5 minutes"
ms(36_300_000, { format: "iso" }) // "PT10H5M"
ms(36_300_000, { format: "colon" }) // "10:05:00"
ms(36_300_000, { format: "number" }) // "36300000"

Comparison with ms

This library is an extended alternative to the popular ms package:

| Feature | ms | @cutticat/ms | | :-------------: | :--: | :------------: | | Simple parsing ("2 days") | ✅ | ✅ | | Arithmetic ("10h + 5min", "1d - 30min") | ❌ | ✅ | | MM:SS / HH:MM:SS format ("1:30:45") | ❌ | ✅ | | Output formats (short, long, iso, colon) | ❌ | ✅ | | Decimal numbers ("1.5h") | ❌ | ✅ | | Scientific notation ("12e3") | ❌ | ✅ | | Custom formats (createMs) | ❌ | ✅ | | Unary +/- ("-5min") | ❌ | ✅ |

API

Functions

  • ms(input, options?) — parses a string into milliseconds or formats a number into a string
  • createMs(options?) — creates a custom instance with its own formatters and default format

Output formats

  • short — short format ("10h 5m")
  • long — full format ("10 hours 5 minutes")
  • iso — ISO 8601 Duration ("PT10H5M")
  • colon — colon-separated format ("10:05:00")
  • number — number as a string ("36300000")

Types

  • CreateMsOptions — options for createMs
  • MsFormatOptions — formatting options
  • Ms — type of the ms function

Documentation

Further documentation:

Full API documentation is available in JSDoc comments.

Requirements

  • Node.js >= 22.0.0
  • pnpm >= 10.17.0
  • TypeScript >= 5.9.0