diff --git a/util.js b/util.js index cbc2498..4f25671 100644 --- a/util.js +++ b/util.js @@ -73,17 +73,17 @@ exports.format = function(f) { // Returns a modified function which warns once by default. // If --no-deprecation is set, then it is a no-op. exports.deprecate = function(fn, msg) { + if (typeof process !== 'undefined' && process.noDeprecation === true) { + return fn; + } + // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { + if (typeof process === 'undefined') { return function() { return exports.deprecate(fn, msg).apply(this, arguments); }; } - if (process.noDeprecation === true) { - return fn; - } - var warned = false; function deprecated() { if (!warned) {