From dae1e301c6fb17811491aa7d15d3676f225b977a 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 | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lib/dgram.js b/lib/dgram.js index ceda82653085df..da94e1a9cda01b 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -46,6 +46,7 @@ const { } = 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 { @@ -728,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'); @@ -796,7 +797,7 @@ Object.defineProperty(UDP.prototype, 'owner', { module.exports = { - _createSocketHandle: util.deprecate( + _createSocketHandle: deprecate( _createSocketHandle, 'dgram._createSocketHandle() is deprecated', 'DEP0112'