diff --git a/lib/util.js b/lib/util.js index 834dc676ee2..8cc4739f275 100644 --- a/lib/util.js +++ b/lib/util.js @@ -522,16 +522,15 @@ exports.inherits = function(ctor, superCtor) { var deprecationWarnings; exports._deprecationWarning = function(moduleId, message) { - if ((new RegExp('\\b' + moduleId + '\\b')).test(process.env.NODE_DEBUG)) { - console.trace(message); - } else { - if (!deprecationWarnings) { - deprecationWarnings = {}; - } else if (message in deprecationWarnings) { - return; - } - console.error(message); + if (!deprecationWarnings) + deprecationWarnings = {}; + else if (message in deprecationWarnings) + return; - deprecationWarnings[message] = true; - } + deprecationWarnings[message] = true; + + if ((new RegExp('\\b' + moduleId + '\\b')).test(process.env.NODE_DEBUG)) + console.trace(message); + else + console.error(message); };