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

warning

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

warning - npm Package Compare versions

Comparing version

to
1.0.1

2

package.json
{
"name": "warning",
"version": "1.0.0",
"version": "1.0.1",
"description": "A mirror of Facebook's Warning",

@@ -5,0 +5,0 @@ "main": "warning.js",

@@ -13,2 +13,13 @@ # Warning

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 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.

@@ -48,3 +48,6 @@ /**

var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, () => args[argIndex++]);
var message = 'Warning: ' +
format.replace(/%s/g, function() {
args[argIndex++];
});
if (typeof console !== 'undefined') {

@@ -51,0 +54,0 @@ console.error(message);