New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ldebug

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ldebug

A debugging utility that evaluates messages lazily.

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

ldebug

npm version

A debugging utility that evaluates messages lazily.

Usage

import { createDebug } from 'ldebug';
import process from 'node:process';

const debug = createDebug({
  isDevelopment: process.env.NODE_ENV !== 'production',
  highlight: true,
  prettyStringify: true,
});

// The following line will log "Hello ['world']" with colors in development and do nothing in production (the template string won't be evaluated either).
debug((f) => f`Hello ${['world']}`);

API

createDebug(options)

Returns: LazyDebugFunction

Creates a new debug function with the given options.

options.isDevelopment

Type: boolean
Required: true

A boolean representing whether or not the application is running in development. If the application is not running in the development, createDebug will return a no-op function.

options.highlight

Type: boolean
Default: true

Highlights the messages using cli-highlighter.

options.prettyStringify

Type: boolean
Default: true

If true, uses [json-stringify-pretty-compact] to stringify objects. Otherwise, uses JSON.stringify().

options.logger

Type: (message: string) => void
Default: console.log

A custom logger function to use when logging debug messages.

LazyDebugFunction

Type: (callback: (format: FormatHelper) => string) => void

callback

The callback (only called in development) that returns the message to log.

format

Type: FormatHelper

export type FormatHelper = (
  strings: TemplateStringsArray,
  ...values: unknown[]
) => string;

A format helper ES6 template tag that applies transformations to the strings and values in the template string (e.g. formatting and highlighting) for more readable output.

Keywords

debug

FAQs

Package last updated on 17 May 2022

Did you know?

Socket

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