New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@harrysarson/eval-debug

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@harrysarson/eval-debug

Wrapper around debug that allows conditional evaluation for performance reasons

0.0.1
latest
Source
npm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

eval-debug

A wrapper around debug if you are worried about the performance penalty of creating logging data in production mode.

usage


const createDebug = require('harrysarson/eval-debug');

const debug = createDebug('namespace');

debug('%e', expensiveFunction);

// will log the return value of expensiveFunction(). 
// expensiveFunction() will not be called unless debug is enabled


warning

Conditionally running code dependant on whether or not debugging is enabled is an anti-pattern. This could lead to errors in production code that disapear when you try to debug them causing everyone involved a lot of grief.

See https://github.com/visionmedia/debug/pull/497.

FAQs

Package last updated on 03 Sep 2017

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