Socket
Socket
Sign inDemoInstall

@types/debug

Package Overview
Dependencies
1
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/debug

TypeScript definitions for debug


Version published
Weekly downloads
7.7M
decreased by-16.83%
Maintainers
1
Install size
9.43 kB
Created
Weekly downloads
 

Package description

What is @types/debug?

The @types/debug package provides TypeScript type definitions for the debug library, which is a JavaScript utility that helps you with debugging your code. It allows you to create a minimal and customizable debugging utility. The @types/debug package itself does not contain functionality but provides type support for TypeScript users of the debug library.

What are @types/debug's main functionalities?

Creating a debug instance

This code sample demonstrates how to import the debug module and create a debug instance. You can replace 'myNamespace' with a namespace string that is relevant to your application or module. This instance can then be used to log messages under that namespace.

import * as Debug from 'debug';
const debug = Debug('myNamespace');

Enabling/disabling debug output

This code shows how to enable and disable debug output. By calling Debug.enable with a namespace, you enable logging for that namespace. Calling Debug.disable turns off all debug logging.

Debug.enable('myNamespace');
Debug.disable();

Logging messages

This example demonstrates logging a debug message with a formatted output. The %O token allows you to output an object in a pretty-printed format. Replace '{ some: 'object' }' with any object you wish to log.

debug('Here is a debug message: %O', { some: 'object' });

Other packages similar to @types/debug

Readme

Source

Installation

npm install --save @types/debug

Summary

This package contains type definitions for debug (https://github.com/debug-js/debug).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug.

index.d.ts

declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };

export = debug;
export as namespace debug;

declare namespace debug {
    interface Debug {
        (namespace: string): Debugger;
        coerce: (val: any) => any;
        disable: () => string;
        enable: (namespaces: string) => void;
        enabled: (namespaces: string) => boolean;
        formatArgs: (this: Debugger, args: any[]) => void;
        log: (...args: any[]) => any;
        selectColor: (namespace: string) => string | number;
        humanize: typeof import("ms");

        names: RegExp[];
        skips: RegExp[];

        formatters: Formatters;

        inspectOpts?: {
            hideDate?: boolean | number | null;
            colors?: boolean | number | null;
            depth?: boolean | number | null;
            showHidden?: boolean | number | null;
        };
    }

    type IDebug = Debug;

    interface Formatters {
        [formatter: string]: (v: any) => string;
    }

    type IDebugger = Debugger;

    interface Debugger {
        (formatter: any, ...args: any[]): void;

        color: string;
        diff: number;
        enabled: boolean;
        log: (...args: any[]) => any;
        namespace: string;
        destroy: () => boolean;
        extend: (namespace: string, delimiter?: string) => Debugger;
    }
}

Additional Details

  • Last updated: Thu, 09 Nov 2023 03:06:57 GMT
  • Dependencies: @types/ms

Credits

These definitions were written by Seon-Wook Park, Gal Talmor, John McLaughlin, Brasten Sager, Nicolas Penin, Kristian Brünn, and Caleb Gregory.

FAQs

Last updated on 09 Nov 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc