Skip to content

Commit dae1e30

Browse files
dnluptargos
authored andcommitted
dgram: remove usage of public require('util')
Use `require('internal/util').deprecate` instead of `require('util').deprecate`. Refs: #26546 PR-URL: #26770 Reviewed-By: Masashi Hirano <shisama07@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent c127bec commit dae1e30

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

lib/dgram.js

+14-13
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ const {
4646
} = require('internal/validators');
4747
const { Buffer } = require('buffer');
4848
const util = require('util');
49+
const { deprecate } = require('internal/util');
4950
const { isUint8Array } = require('internal/util/types');
5051
const EventEmitter = require('events');
5152
const {
@@ -728,61 +729,61 @@ Socket.prototype.getSendBufferSize = function() {
728729

729730
// Deprecated private APIs.
730731
Object.defineProperty(Socket.prototype, '_handle', {
731-
get: util.deprecate(function() {
732+
get: deprecate(function() {
732733
return this[kStateSymbol].handle;
733734
}, 'Socket.prototype._handle is deprecated', 'DEP0112'),
734-
set: util.deprecate(function(val) {
735+
set: deprecate(function(val) {
735736
this[kStateSymbol].handle = val;
736737
}, 'Socket.prototype._handle is deprecated', 'DEP0112')
737738
});
738739

739740

740741
Object.defineProperty(Socket.prototype, '_receiving', {
741-
get: util.deprecate(function() {
742+
get: deprecate(function() {
742743
return this[kStateSymbol].receiving;
743744
}, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
744-
set: util.deprecate(function(val) {
745+
set: deprecate(function(val) {
745746
this[kStateSymbol].receiving = val;
746747
}, 'Socket.prototype._receiving is deprecated', 'DEP0112')
747748
});
748749

749750

750751
Object.defineProperty(Socket.prototype, '_bindState', {
751-
get: util.deprecate(function() {
752+
get: deprecate(function() {
752753
return this[kStateSymbol].bindState;
753754
}, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
754-
set: util.deprecate(function(val) {
755+
set: deprecate(function(val) {
755756
this[kStateSymbol].bindState = val;
756757
}, 'Socket.prototype._bindState is deprecated', 'DEP0112')
757758
});
758759

759760

760761
Object.defineProperty(Socket.prototype, '_queue', {
761-
get: util.deprecate(function() {
762+
get: deprecate(function() {
762763
return this[kStateSymbol].queue;
763764
}, 'Socket.prototype._queue is deprecated', 'DEP0112'),
764-
set: util.deprecate(function(val) {
765+
set: deprecate(function(val) {
765766
this[kStateSymbol].queue = val;
766767
}, 'Socket.prototype._queue is deprecated', 'DEP0112')
767768
});
768769

769770

770771
Object.defineProperty(Socket.prototype, '_reuseAddr', {
771-
get: util.deprecate(function() {
772+
get: deprecate(function() {
772773
return this[kStateSymbol].reuseAddr;
773774
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
774-
set: util.deprecate(function(val) {
775+
set: deprecate(function(val) {
775776
this[kStateSymbol].reuseAddr = val;
776777
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112')
777778
});
778779

779780

780-
Socket.prototype._healthCheck = util.deprecate(function() {
781+
Socket.prototype._healthCheck = deprecate(function() {
781782
healthCheck(this);
782783
}, 'Socket.prototype._healthCheck() is deprecated', 'DEP0112');
783784

784785

785-
Socket.prototype._stopReceiving = util.deprecate(function() {
786+
Socket.prototype._stopReceiving = deprecate(function() {
786787
stopReceiving(this);
787788
}, 'Socket.prototype._stopReceiving() is deprecated', 'DEP0112');
788789

@@ -796,7 +797,7 @@ Object.defineProperty(UDP.prototype, 'owner', {
796797

797798

798799
module.exports = {
799-
_createSocketHandle: util.deprecate(
800+
_createSocketHandle: deprecate(
800801
_createSocketHandle,
801802
'dgram._createSocketHandle() is deprecated',
802803
'DEP0112'

0 commit comments

Comments
 (0)