From 0c89a21f96b43d1094e01f40e6d850155163127d Mon Sep 17 00:00:00 2001 From: dnlup Date: Thu, 21 Mar 2019 16:21:22 +0100 Subject: [PATCH] dgram: remove usage of public require('util') Use `require('internal/util').deprecate` instead of `require('util').deprecate`. Refs: https://github.com/nodejs/node/issues/26546 PR-URL: https://github.com/nodejs/node/pull/26770 Reviewed-By: Masashi Hirano Reviewed-By: James M Snell Reviewed-By: Yongsheng Zhang Reviewed-By: Ruben Bridgewater --- lib/dgram.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/dgram.js b/lib/dgram.js index 29239b34353116..97709b1d948ded 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -45,7 +45,7 @@ const { validateNumber } = require('internal/validators'); const { Buffer } = require('buffer'); -const util = require('util'); +const { deprecate } = require('internal/util'); const { isUint8Array } = require('internal/util/types'); const EventEmitter = require('events'); const { @@ -729,61 +729,61 @@ Socket.prototype.getSendBufferSize = function() { // Deprecated private APIs. Object.defineProperty(Socket.prototype, '_handle', { - get: util.deprecate(function() { + get: deprecate(function() { return this[kStateSymbol].handle; }, 'Socket.prototype._handle is deprecated', 'DEP0112'), - set: util.deprecate(function(val) { + set: deprecate(function(val) { this[kStateSymbol].handle = val; }, 'Socket.prototype._handle is deprecated', 'DEP0112') }); Object.defineProperty(Socket.prototype, '_receiving', { - get: util.deprecate(function() { + get: deprecate(function() { return this[kStateSymbol].receiving; }, 'Socket.prototype._receiving is deprecated', 'DEP0112'), - set: util.deprecate(function(val) { + set: deprecate(function(val) { this[kStateSymbol].receiving = val; }, 'Socket.prototype._receiving is deprecated', 'DEP0112') }); Object.defineProperty(Socket.prototype, '_bindState', { - get: util.deprecate(function() { + get: deprecate(function() { return this[kStateSymbol].bindState; }, 'Socket.prototype._bindState is deprecated', 'DEP0112'), - set: util.deprecate(function(val) { + set: deprecate(function(val) { this[kStateSymbol].bindState = val; }, 'Socket.prototype._bindState is deprecated', 'DEP0112') }); Object.defineProperty(Socket.prototype, '_queue', { - get: util.deprecate(function() { + get: deprecate(function() { return this[kStateSymbol].queue; }, 'Socket.prototype._queue is deprecated', 'DEP0112'), - set: util.deprecate(function(val) { + set: deprecate(function(val) { this[kStateSymbol].queue = val; }, 'Socket.prototype._queue is deprecated', 'DEP0112') }); Object.defineProperty(Socket.prototype, '_reuseAddr', { - get: util.deprecate(function() { + get: deprecate(function() { return this[kStateSymbol].reuseAddr; }, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'), - set: util.deprecate(function(val) { + set: deprecate(function(val) { this[kStateSymbol].reuseAddr = val; }, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112') }); -Socket.prototype._healthCheck = util.deprecate(function() { +Socket.prototype._healthCheck = deprecate(function() { healthCheck(this); }, 'Socket.prototype._healthCheck() is deprecated', 'DEP0112'); -Socket.prototype._stopReceiving = util.deprecate(function() { +Socket.prototype._stopReceiving = deprecate(function() { stopReceiving(this); }, 'Socket.prototype._stopReceiving() is deprecated', 'DEP0112'); @@ -797,7 +797,7 @@ Object.defineProperty(UDP.prototype, 'owner', { module.exports = { - _createSocketHandle: util.deprecate( + _createSocketHandle: deprecate( _createSocketHandle, 'dgram._createSocketHandle() is deprecated', 'DEP0112'