Gathering detailed insights and metrics for warning
Gathering detailed insights and metrics for warning
Gathering detailed insights and metrics for warning
Gathering detailed insights and metrics for warning
npm install warning
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
225 Stars
93 Commits
26 Forks
4 Watchers
2 Branches
8 Contributors
Updated on Jan 10, 2025
Latest Version
4.0.3
Package Id
warning@4.0.3
Size
3.66 kB
NPM Version
6.5.0
Node Version
10.15.0
Published on
Feb 09, 2019
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A mirror of Facebook's Warning
npm install warning
// some script
var warning = require('warning');
var ShouldBeTrue = false;
warning(
ShouldBeTrue,
'This thing should be true but you set to false. No soup for you!'
);
// 'This thing should be true but you set to false. No soup for you!'
Similar to Facebook's (FB) invariant but only logs a warning if the condition is not met. This can be used to log issues in development environments in critical paths. Removing the logging code for production environments will keep the same logic and follow the same code paths.
Why do you use
console.error
instead ofconsole.warn
?
This is a mirror of Facebook's (FB) warning module used within React's source code (and other FB software). As such this module will mirror their code as much as possible.
The descision to use error
over warn
was made a long time ago by the FB team and isn't going to change anytime soon.
The source can be found here: https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/__forks__/warning.js The reasoning can be found here and elsewhere: https://github.com/facebook/fbjs/pull/94#issuecomment-168332326
Can I add X feature?
This is a mirror of Facebook's (FB) warning and as such the source and signature will mirror that module.
If you believe a feature is missing than please open a feature request there. If it is approved and merged in that this module will be updated to reflect that change, otherwise this module will not change.
It is recommended to add babel-plugin-dev-expression with this module to remove warning messages in production.
Don't Forget To Be Awesome
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 1/6 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
60 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More