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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@idio/debug

v1.2.3

Published

The Fork Of Debug For Node.JS Written In ES6 And Optimised With JavaScript Compiler.

Downloads

63

Readme

@idio/debug

npm version

@idio/debug is the fork of the popular debug package that was rewritten in modern JS using the ES6 modules, to be able to compile it with Closure Compiler. Currently, only the Node.JS version is supported.

yarn add @idio/debug

Table Of Contents

API

The package is available by importing its default function:

import debug from '@idio/debug'

debug(  namespace: string,): debugFunction

Creates a debug function for the given namespace.

import debug from '@idio/debug'

const log = debug('example')
log('hello')
log('world')
example hello +0ms
  example world +4ms

_debug.Env: An environment.

| Name | Type | Description | | ---------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | init* | function(debug.DebugFunction) | Env-specific initialization logic for debug instances. | | log* | function(...) | The logging function. | | __formatArgs_ | function(this: _debug.DebugFunction, !Array) | Apply env-specific formatting (colors, etc.). | | save* | !Function | Save namespaces. | | load* | !Function | Load namespaces. | | formatters* | Object<string, function(!Object): string> | Map of special "%n" handling functions, for the debug "format" argument. Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". | | useColors* | !Function | Is stdout a TTY? Colored output is enabled when true. | | colors* | !Array<number> | The array of supported colors. | | inspectOpts* | !Object<string, *> | The options from the env variables, e.g., DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js. |

_debug.DebugContext

| Name | Type | Description | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ | | namespace* | string | The namespace for which the debug function was setup. | | enabled* | boolean | Whether the debug function is enabled. | | useColors* | boolean | If the environment uses colors. | | diff* | number | The diff between the prev time and current time. | | prev* | number | The previous time. | | curr* | number | The current time. | | log | function(...) | The manually set logging function that overrides the environment log function. | | __color__ | (number | string) | The color for the namespace. | | destroy* | function(this: _debug.DebugFunction): boolean | Removes the debug function from the namespace. | | extend* | function(this: _debug.DebugFunction, string, string): _debug.DebugFunction | Using the debug function, creates a new one. |

function(this:_debug.DebugContext, ...*) _debug.DebugFunction: The setup debug function.

Modifiers

The modifiers can be used to print information in formatted way.

| Modifier | Action | | -------- | -------------------------------------- | | %O | Multiline inspect. | | %o | Single line inspect. | | %f | File-size format of bytes, e.g., 10MB. | | %fy | File-size in yellow. | | %fr | File-size in red. | | %fb | File-size in blue. | | %fg | File-size in green. | | %fc | File-size in cyan | | %fm | File-size in magenta. |

import Debug from '@idio/debug'

const debug = Debug('example')
debug('hello %O', { test: 'ok' })
debug('world %f', 105248)
example hello { test: 'ok' } +0ms
  example world 102.78KB +16ms

Copyright

Original Authors:

  • TJ Holowaychuk
  • Nathan Rajlich
  • Andrew Rhyne