Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 8, 2024 via pnpm

warning 4.0.3

A mirror of Facebook's Warning
Package summary
Share
0
issues
1
license
3
MIT
Package created
1 Apr 2015
Version published
9 Feb 2019
Maintainers
1
Total deps
3
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
js-tokens@4.0.0
loose-envify@1.4.0
warning@4.0.3
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of warning 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
loose-envify1.4.02.78 kBMIT
prod

Visualizations

Frequently Asked Questions

What does warning do?

Warning is a JavaScript package that acts as a mirror of Facebook's Warning module. Its primary function is to log warnings if certain predefined conditions are not met, making it especially useful for identifying issues in development environments during critical paths. Unlike Facebook's invariant, which completely halts execution when a condition fails, Warning simply logs these discrepancies so you can review them at your convenience. This ensures that the same logic and code paths are maintained even when the logging code is removed for production environments.

How do you use warning?

Using Warning in your JavaScript project is straightforward. After installing it through npm using the command npm install warning, you can require it in your script and then use it to check conditions. Here's an example:

// Import the package
var warning = require('warning');

// Define a variable
var ShouldBeTrue = false;

// Use warning to check the condition
warning(
  ShouldBeTrue,
  'This thing should be true but you set to false. No soup for you!'
);
// Output: 'This thing should be true but you set to false. No soup for you!'

In the above example, if ShouldBeTrue doesn't contain a truthy value, the warning message is logged to the console.

Where are the warning docs?

The documentation for Warning is available directly in the source which is hosted on Facebook's GitHub. The specific link to the source file is here.

Remember to read through the Frequently Asked Questions (FAQ) in the repository before opening an issue. If you want to add a new feature, it's advisable to open a feature request in Facebook's warning module. This is because Warning follows Facebook's module closely, any changes in the source will be reflected in this package.

For use in production environments, Warning recommends adding babel-plugin-dev-expression to remove warning messages in production.