Skip to content

Commit

Permalink
util: cleanup internalUtil.deprecate
Browse files Browse the repository at this point in the history
There were two functions `deprecate` and `_deprecate`
that were really just aliases of each other. Simplify

PR-URL: #11450
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
jasnell authored and italoacasas committed Feb 25, 2017
1 parent 54e1f0c commit 237db9c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions lib/internal/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,18 @@ 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) {
return exports._deprecate(fn, msg);
};

exports.trace = function(msg) {
console.trace(`${prefix}${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) {
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);
};
}

Expand Down
2 changes: 1 addition & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ exports.format = function(f) {
};


exports.deprecate = internalUtil._deprecate;
exports.deprecate = internalUtil.deprecate;


var debugs = {};
Expand Down

0 comments on commit 237db9c

Please sign in to comment.