Skip to content

Commit

Permalink
net: remove usage of require('util')
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dnlup authored and targos committed Mar 27, 2019
1 parent 4cafd74 commit 5e06c3b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

const EventEmitter = require('events');
const stream = require('stream');
const util = require('util');
const { inspect } = require('internal/util/inspect');
const { debuglog } = require('internal/util/debuglog');
const internalUtil = require('internal/util');
const {
isIP,
Expand Down Expand Up @@ -129,7 +130,7 @@ function getNewAsyncId(handle) {
}


const debug = util.debuglog('net');
const debug = debuglog('net');

function isPipeName(s) {
return typeof s === 'string' && toNumber(s) === false;
Expand Down Expand Up @@ -334,7 +335,8 @@ function Socket(options) {
this[kBytesRead] = 0;
this[kBytesWritten] = 0;
}
util.inherits(Socket, stream.Duplex);
Object.setPrototypeOf(Socket.prototype, stream.Duplex.prototype);
Object.setPrototypeOf(Socket, stream.Duplex);

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

throw new ERR_INVALID_OPT_VALUE('options', util.inspect(options));
throw new ERR_INVALID_OPT_VALUE('options', inspect(options));
};

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

0 comments on commit 5e06c3b

Please sign in to comment.