Skip to content

Commit 5e06c3b

Browse files
dnluptargos
authored andcommitted
net: remove usage of require('util')
Use `require('internal/util/inspect').inspect` and `require('internal/util/debuglog').debuglog` instead of `require('util').debuglog` and `require('util').inspect`. PR-URL: #26807 Refs: #26546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 4cafd74 commit 5e06c3b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/net.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
const EventEmitter = require('events');
2525
const stream = require('stream');
26-
const util = require('util');
26+
const { inspect } = require('internal/util/inspect');
27+
const { debuglog } = require('internal/util/debuglog');
2728
const internalUtil = require('internal/util');
2829
const {
2930
isIP,
@@ -129,7 +130,7 @@ function getNewAsyncId(handle) {
129130
}
130131

131132

132-
const debug = util.debuglog('net');
133+
const debug = debuglog('net');
133134

134135
function isPipeName(s) {
135136
return typeof s === 'string' && toNumber(s) === false;
@@ -334,7 +335,8 @@ function Socket(options) {
334335
this[kBytesRead] = 0;
335336
this[kBytesWritten] = 0;
336337
}
337-
util.inherits(Socket, stream.Duplex);
338+
Object.setPrototypeOf(Socket.prototype, stream.Duplex.prototype);
339+
Object.setPrototypeOf(Socket, stream.Duplex);
338340

339341
// Refresh existing timeouts.
340342
Socket.prototype._unrefTimer = function _unrefTimer() {
@@ -1432,7 +1434,7 @@ Server.prototype.listen = function(...args) {
14321434
'must have the property "port" or "path"');
14331435
}
14341436

1435-
throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options));
1437+
throw new ERR_INVALID_OPT_VALUE('options', inspect(options));
14361438
};
14371439

14381440
function lookupAndListen(self, port, address, backlog, exclusive, flags) {

0 commit comments

Comments
 (0)