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

debug-fabulous

v2.0.57

Published

visionmedia debug extensions rolled into one

Readme

debug-fabulous

Lazy-evaluation wrapper for debug — skip string building entirely when logging is disabled.

npm version npm downloads tests

Why?

The debug module always evaluates its arguments, even when the namespace is disabled. If you're building expensive strings — JSON serialization, large object inspection, string concatenation — you pay the cost even when nobody's reading the output.

debug-fabulous wraps debug with lazy evaluation. Pass a function instead of a string, and it only runs when the namespace is actually enabled. When logging is off, the call is a no-op — no string allocation, no concatenation, no wasted cycles.

This matters at scale. Libraries like gulp-sourcemaps (700K+ weekly downloads) use debug-fabulous as a transitive dependency for exactly this reason.

Install

npm install debug-fabulous

Quick Start

const debugFab = require('debug-fabulous');
const debug = debugFab()('my-app');

// Lazy evaluation — the function only runs if 'my-app' is enabled
debug(() => 'user object: ' + JSON.stringify(largeUserObject));

// Plain strings still work
debug('server started on port %d', 3000);

Spawning Child Debuggers

Create hierarchical namespaces without string juggling:

const debugFab = require('debug-fabulous');
const debug = debugFab()('my-app');

const dbDebug = debug.spawn('db');       // my-app:db
const queryDebug = dbDebug.spawn('query'); // my-app:db:query

dbDebug('connected');
queryDebug(() => `SELECT took ${ms}ms, returned ${rows.length} rows`);

Standalone Spawnable

If you just need hierarchical debuggers without the factory:

const { spawnable } = require('debug-fabulous');
const debug = spawnable('my-app');

const child = debug.spawn('worker');  // my-app:worker
child('processing job %d', jobId);

TypeScript

debug-fabulous is written in TypeScript and ships type declarations.

import debugFab, { spawnable } from 'debug-fabulous';

const debug = debugFab()('my-app');

// Lazy eval with type safety
debug(() => `processed ${items.length} items`);

// Spawn children
const child = debug.spawn('worker');
child('ready');

// Return an array for format strings
debug(() => ['found %d results in %dms', count, elapsed]);

API

debugFab(debugApi?)

Returns a wrapped debug factory with lazy evaluation and namespace caching.

  • debugApi (optional) — a custom debug instance. Defaults to require('debug').

The returned factory has the same API as debug (enable(), disable(), load(), save(), etc.) plus lazy evaluation support.

debug(fn) — Lazy Evaluation

Pass a function instead of a string. It's only called when the namespace is enabled:

// Function returns a string
debug(() => expensiveStringOperation());

// Function returns [formatter, ...args] array
debug(() => ['user %s performed %d actions', userName, count]);

debug.spawn(namespace)

Creates a child debugger under the current namespace:

const root = debug('app');       // app
const db = root.spawn('db');     // app:db
const cache = db.spawn('cache'); // app:db:cache

spawnable(namespace, debugFabFactory?)

Standalone function that creates a spawnable debugger directly:

const { spawnable } = require('debug-fabulous');
const debug = spawnable('app');

How It Works

  1. Namespace cachingMap-based memoization means repeated debug('same-ns') calls return the same instance instantly.
  2. Singleton no-op — Disabled namespaces get a shared no-op function instead of allocating per-instance.
  3. Lazy closures — When you pass a function, it's never invoked if the namespace is disabled. No string allocation, no concatenation, no JSON.stringify().

Sponsor

If you find this project useful, consider sponsoring @nmccready to support ongoing maintenance and development. ❤️

License

MIT — Nicholas McCready and contributors.