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

@catniplabs/mango

v0.5.0

Published

๐ŸŠ Fake data generator with a juicy twist โ€” fast, realistic, tiny, TS-first.

Readme


โœจ Features

  • ๐Ÿพ Fast fake data generation
  • ๐Ÿพ Fully written in TypeScript
  • ๐Ÿพ Simple and expressive API
  • ๐Ÿพ Extensible and customizable
  • ๐Ÿพ ESM + CJS support
  • ๐Ÿพ Multi-locale (e.g., en_US, pt_BR)

๐Ÿ“ฆ Installation

# npm (recommended lowercase scope)
npm install @catniplabs/mango

# or pnpm
pnpm add @catniplabs/mango

๐Ÿš€ Usage

Functional API (tree-shakeable)

import { fullName, email, pt_BR, en_US } from "@catniplabs/mango";
import { Random } from "@catniplabs/mango/core/random";

const rng = new Random(42); // seed for reproducibility

console.log(fullName(rng, pt_BR)); // e.g., "Laura Oliveira"
console.log(email(rng, en_US));    // e.g., "[email protected]"

Class-based API

import { Mango, pt_BR } from "@catniplabs/mango";

const mango = new Mango({ seed: 1337, locale: pt_BR });

console.log(mango.person.fullName()); // e.g., "Ana Souza"
console.log(mango.internet.email());  // e.g., "[email protected]"

๐ŸŒ Browser (CDN)

You can use Mango directly in the browser via jsDelivr or unpkg. Since browsers don't resolve bare specifiers by default, either import by full URL to the ESM file or set up an import map.

Option A โ€” Direct URL (no import map)

Using jsDelivr:

<script type="module">
  import { Mango, pt_BR, en_US } from "https://cdn.jsdelivr.net/npm/@catniplabs/[email protected]/dist/index.mjs";

  const mango = new Mango({ seed: 1337, locale: pt_BR, fallbackLocale: en_US });
  console.log(mango.person.fullName());
  console.log(mango.internet.email());
  console.log(mango.address.full());
</script>

Using unpkg:

<script type="module">
  import { Mango, pt_BR, en_US } from "https://unpkg.com/@catniplabs/mango@latest/dist/index.mjs";

  const mango = new Mango({ seed: 2025, locale: en_US, fallbackLocale: pt_BR });
  console.log(mango.commerce.productName());
  console.log(mango.phone.phone());
</script>

Option B โ€” Import map (use package name in imports)

<script type="importmap">
{
  "imports": {
    "@catniplabs/mango": "https://cdn.jsdelivr.net/npm/@catniplabs/[email protected]/dist/index.mjs"
  }
}
</script>
<script type="module">
  import { Mango, pt_BR } from "@catniplabs/mango";
  const mango = new Mango({ seed: 42, locale: pt_BR });
  document.body.innerText = mango.internet.email();
</script>

Notes:

  • The CDN serves ESM with proper CORS headers, so it works in <script type="module">.
  • We publish ESM (.mjs) and CJS (.cjs); for browsers, prefer the ESM URL.
  • For deterministic results in the browser, use the Mango classโ€™ seed option.

๐Ÿ”Œ Plugin support

Mango provides a simple, strongly typed plugin system. Define a plugin with definePlugin, register it via mango.use(plugin) or fetch its API directly with mango.plugin(plugin) (auto-installs if needed).

Define and use a plugin (TypeScript)

import { definePlugin, Mango, pt_BR, en_US } from "@catniplabs/mango";
import type { Locale } from "@catniplabs/mango";

// Create a plugin exposing a typed API
const greetPlugin = definePlugin({
  name: "greet",
  install(ctx) {
    return {
      hello: () => `Hello from ${ctx.getLocale().address.states[0]?.code ?? "--"}`,
      reseed: (seed: number) => ctx.rng.seed(seed),
      setLocale: (locale: Locale) => ctx.setLocale(locale),
    };
  },
});

const mango = new Mango({ seed: 42, locale: pt_BR, fallbackLocale: en_US });

// Get the plugin API with full types (auto-installs if necessary)
const greet = mango.plugin(greetPlugin);
console.log(greet.hello());

// Alternative: register then retrieve
mango.use(greetPlugin);
const greetApi = mango.plugin(greetPlugin);
greetApi.reseed(1337);
greetApi.setLocale(en_US);

Useful public types:

  • MangoPlugin<TApi> and PluginContext for strongly typed plugins
  • LocaleDefinition to author custom locales/providers

Notes:

  • mango.plugin(plugin) is idempotent and preserves the plugin API instance
  • getLocale() returns the effective locale with fallback applied

๐Ÿงฉ Scripts

These scripts are available in package.json:

# Development (watch mode)
pnpm dev

# Build (ESM + CJS + types)
pnpm build

# Type checking
pnpm typecheck

# Tests (CI mode) and watch mode
pnpm test
pnpm test:watch

# Lint and auto-fix (Biome)
pnpm lint
pnpm lint:fix

# Format code (Biome)
pnpm format

# Changesets (versioning & publish)
pnpm changeset

# Pre-publish check
pnpm prepublishOnly

# Prepare husky hooks
pnpm prepare

๐Ÿ—บ๏ธ Roadmap

Prioritized to deliver a lightweight, realistic, extensible, and multi-environment library.

๐ŸŽฏ MVP (v0.1.x)

  • [x] Core RNG with seed (reproducibility)
  • [x] ESM + CJS + types (.d.ts) via tsup
  • [x] Functional API (tree-shakeable) + optional class (Mango)
  • [x] Initial locales: en_US, pt_BR
  • [x] Basic generators: person (first/last/fullName), internet.email
  • [x] Unit tests with vitest + V8 coverage
  • [x] Lint/format with Biome
  • [x] CI (build, typecheck, lint, test)

๐Ÿ”ธ v0.2.x โ€” Realism and coverage

  • [x] Full address (street, number, city, state, ZIP/CEP per locale format)
  • [x] phone (valid regional formats)
  • [x] date (ranges and practical utilities)
  • [x] commerce (product, price, category)
  • [x] helpers.multiple / generateMany for batch generation
  • [x] Configurable locale fallback (e.g., pt_BR โ†’ en_US)

๐Ÿ”ถ v0.3.x โ€” Extensibility and DX

  • [x] Plugin system (register third-party modules)
  • [x] Public types for LocaleDefinition and custom providers

๐ŸŸ  v0.4.x โ€” Quality and performance

  • [ ] Benchmarks (Node and browser) and comparisons
  • [ ] Optional lazy-import for locales (on-demand loading)
  • [ ] Extended documentation with real-world examples and guides

๐ŸŸง v0.5.x โ€” Data reliability

  • [ ] Regional validations (e.g., ZIP/CEP, phone formats)
  • [ ] Realistic correlations (area code matching city/state, etc.)
  • [ ] Dataset reviewed with community contributions

๐ŸŸฉ v1.0.0 โ€” Stable

  • [ ] Frozen and documented API
  • [ ] Documentation site with playground
  • [ ] Migration guide (if needed)
  • [ ] Versioning and support policy

๐Ÿ“œ License

MIT License

Copyright (c) 2025 CatnipLabs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.