Comparing version 1.0.0 to 1.0.1
{ | ||
"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); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4588
57
25