From 1b565ca5cb0bce27e1608b131a228a6a3614b50f Mon Sep 17 00:00:00 2001 From: James M Snell Date: Fri, 17 Feb 2017 15:42:21 -0800 Subject: [PATCH] util: cleanup internalUtil.deprecate There were two functions `deprecate` and `_deprecate` that were really just aliases of each other. Simplify --- lib/internal/util.js | 10 ++-------- lib/util.js | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/internal/util.js b/lib/internal/util.js index 4470770a991c03..5c47d06d58d7f4 100644 --- a/lib/internal/util.js +++ b/lib/internal/util.js @@ -10,12 +10,6 @@ const kDecoratedPrivateSymbolIndex = binding['decorated_private_symbol']; // `util` module makes it accessible without having to `require('util')` there. exports.customInspectSymbol = Symbol('util.inspect.custom'); -// All the internal deprecations have to use this function only, as this will -// prepend the prefix to the actual message. -exports.deprecate = function(fn, msg, code) { - return exports._deprecate(fn, msg, code); -}; - exports.trace = function(msg) { console.trace(`${prefix}${msg}`); }; @@ -23,11 +17,11 @@ exports.trace = function(msg) { // Mark that a method should not be used. // 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, code) { +exports.deprecate = function deprecate(fn, msg, code) { // Allow for deprecating things in the process of starting up. if (global.process === undefined) { return function() { - return exports._deprecate(fn, msg).apply(this, arguments); + return exports.deprecate(fn, msg, code).apply(this, arguments); }; } diff --git a/lib/util.js b/lib/util.js index dec2e6b390328e..96a9c70e993eb3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -96,7 +96,7 @@ exports.format = function(f) { }; -exports.deprecate = internalUtil._deprecate; +exports.deprecate = internalUtil.deprecate; var debugs = {};