@@ -39,8 +39,11 @@ const {
39
39
initAsyncResource,
40
40
validateTimerDuration
41
41
} = require ( 'internal/timers' ) ;
42
- const internalUtil = require ( 'internal/util' ) ;
43
- const util = require ( 'util' ) ;
42
+ const {
43
+ promisify : { custom : customPromisify } ,
44
+ deprecate
45
+ } = require ( 'internal/util' ) ;
46
+ const { inspect } = require ( 'internal/util/inspect' ) ;
44
47
const { ERR_INVALID_CALLBACK } = require ( 'internal/errors' ) . codes ;
45
48
46
49
let debuglog ;
@@ -249,8 +252,8 @@ function TimersList(expiry, msecs) {
249
252
}
250
253
251
254
// Make sure the linked list only shows the minimal necessary information.
252
- TimersList . prototype [ util . inspect . custom ] = function ( _ , options ) {
253
- return util . inspect ( this , {
255
+ TimersList . prototype [ inspect . custom ] = function ( _ , options ) {
256
+ return inspect ( this , {
254
257
...options ,
255
258
// Only inspect one level.
256
259
depth : 0 ,
@@ -457,7 +460,7 @@ function setTimeout(callback, after, arg1, arg2, arg3) {
457
460
return timeout ;
458
461
}
459
462
460
- setTimeout [ internalUtil . promisify . custom ] = function ( after , value ) {
463
+ setTimeout [ customPromisify ] = function ( after , value ) {
461
464
const args = value !== undefined ? [ value ] : value ;
462
465
return new Promise ( ( resolve ) => {
463
466
active ( new Timeout ( resolve , after , args , false ) ) ;
@@ -719,7 +722,7 @@ function setImmediate(callback, arg1, arg2, arg3) {
719
722
return new Immediate ( callback , args ) ;
720
723
}
721
724
722
- setImmediate [ internalUtil . promisify . custom ] = function ( value ) {
725
+ setImmediate [ customPromisify ] = function ( value ) {
723
726
return new Promise ( ( resolve ) => new Immediate ( resolve , [ value ] ) ) ;
724
727
} ;
725
728
@@ -752,11 +755,11 @@ module.exports = {
752
755
clearImmediate,
753
756
setInterval,
754
757
clearInterval,
755
- unenroll : util . deprecate (
758
+ unenroll : deprecate (
756
759
unenroll ,
757
760
'timers.unenroll() is deprecated. Please use clearTimeout instead.' ,
758
761
'DEP0096' ) ,
759
- enroll : util . deprecate (
762
+ enroll : deprecate (
760
763
enroll ,
761
764
'timers.enroll() is deprecated. Please use setTimeout instead.' ,
762
765
'DEP0095' )
0 commit comments