Skip to content

Commit 237db9c

Browse files
jasnellitaloacasas
authored andcommitted
util: cleanup internalUtil.deprecate
There were two functions `deprecate` and `_deprecate` that were really just aliases of each other. Simplify PR-URL: #11450 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 54e1f0c commit 237db9c

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

lib/internal/util.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,18 @@ const kDecoratedPrivateSymbolIndex = binding['decorated_private_symbol'];
1010
// `util` module makes it accessible without having to `require('util')` there.
1111
exports.customInspectSymbol = Symbol('util.inspect.custom');
1212

13-
// All the internal deprecations have to use this function only, as this will
14-
// prepend the prefix to the actual message.
15-
exports.deprecate = function(fn, msg) {
16-
return exports._deprecate(fn, msg);
17-
};
18-
1913
exports.trace = function(msg) {
2014
console.trace(`${prefix}${msg}`);
2115
};
2216

2317
// Mark that a method should not be used.
2418
// Returns a modified function which warns once by default.
2519
// If --no-deprecation is set, then it is a no-op.
26-
exports._deprecate = function(fn, msg) {
20+
exports.deprecate = function deprecate(fn, msg, code) {
2721
// Allow for deprecating things in the process of starting up.
2822
if (global.process === undefined) {
2923
return function() {
30-
return exports._deprecate(fn, msg).apply(this, arguments);
24+
return exports.deprecate(fn, msg, code).apply(this, arguments);
3125
};
3226
}
3327

lib/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ exports.format = function(f) {
131131
};
132132

133133

134-
exports.deprecate = internalUtil._deprecate;
134+
exports.deprecate = internalUtil.deprecate;
135135

136136

137137
var debugs = {};

0 commit comments

Comments
 (0)