🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

warn-once

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

warn-once

Show a warning once

0.1.1
latest
Source
npm
Version published
Weekly downloads
1.4M
-8.44%
Maintainers
1
Weekly downloads
 
Created
Source

warn-once

Print a warning exactly once during development. Suitable for deprecation warnings, warnings for missing setup etc.

Installation

Open a Terminal in the project root and run:

npm install warn-once

Usage

The warnOnce function accepts a condition as the first argument. If the condition is true, then it'll print a warning:

const warnOnce = require('warn-once');

// ...

warnOnce(someCondition, 'This is a warning message');

You can call warnOnce multiple times, but if the warning was printed already, it'll not be printed again.

The warning is only shown during development, i.e. if NODE_ENV is not set to 'production'.

FAQs

Package last updated on 07 Aug 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