Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • Socket score

Version published
Weekly downloads
1.1M
increased by9.84%
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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc