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

maskot

v1.1.0

Published

Zero-dependency, framework-agnostic input masking library with custom tokens, multi-pattern support, and type-safe presets

Readme

Maskot

A lightweight, zero-dependency, framework-agnostic input masking library with TypeScript support.

Install

pnpm add maskot

Usage

Basic masking

import { mask, unmask } from "maskot"

mask("ABC1C83", "AAA - 9S99")
// => "ABC - 1C83"

unmask("ABC - 1C83")
// => "ABC1C83"

Multi-pattern

Pattern can be an array — maskot picks the best match based on value length:

const patterns = ["999.999.999-99", "99.999.999/9999-99"]

mask("12345678901", patterns)
// => "123.456.789-01"

mask("12345678000106", patterns)
// => "12.345.678/0001-06"

Custom tokens

Built-in tokens: 9 (digit), A (letter), S (alphanumeric). You can extend or override them:

mask("ff00ab", "HH:HH:HH", {
	tokens: { H: /[0-9a-fA-F]/ },
})
// => "ff:00:ab"

mask("abc1234", "UUU-9999", {
	tokens: { U: { pattern: /[a-zA-Z]/, transform: (c) => c.toUpperCase() } },
})
// => "ABC-1234"

Factory pattern

Use createMasker to create configured instances with type-safe presets:

import { createMasker } from "maskot"

const masker = createMasker({
	presets: {
		zip: { pattern: "99999-999" },
		plate: {
			pattern: ["AAA-9999", "AAA9A99"],
			tokens: { A: { pattern: /[a-zA-Z]/, transform: (c) => c.toUpperCase() } },
		},
	},
})

masker.mask("12345678", { preset: "zip" })
// => "12345-678"

masker.mask("abc1d23", { preset: "plate" })
// => "ABC1D23"

BR presets

Pre-configured masker for Brazilian formats — CPF, CNPJ, phone, CEP, plate, credit card:

import { mask } from "maskot/br"

mask("12345678901", { preset: "cpf" })
// => "123.456.789-01"

mask("11999887766", { preset: "phone" })
// => "(11) 99988-7766"

mask("12345678", { preset: "cep" })
// => "12345-678"

Currency

Uses Intl.NumberFormat for locale-aware currency formatting:

import { currency } from "maskot"

currency.mask({ locale: "pt-BR", currency: "BRL", value: 123456.78 })
// => "R$ 123.456,78"

currency.unmask({ locale: "pt-BR", currency: "BRL", value: "R$ 123.456,78" })
// => 123456.78

Contributing

This project uses Changesets for versioning.

When making changes, create a changeset to describe what changed:

pnpm changeset

License

MIT