Skip to content

Commit 04c7db3

Browse files
toshi1127targos
authored andcommitted
url: remove usage of require('util')
PR-URL: #26808 Refs: #26546 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
1 parent 15af519 commit 04c7db3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/internal/url.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const util = require('util');
3+
const { inspect } = require('internal/util/inspect');
44
const {
55
encodeStr,
66
hexTable,
@@ -184,7 +184,7 @@ class URLSearchParams {
184184
this[context] = null;
185185
}
186186

187-
[util.inspect.custom](recurseTimes, ctx) {
187+
[inspect.custom](recurseTimes, ctx) {
188188
if (!this || !this[searchParams] || this[searchParams][searchParams]) {
189189
throw new ERR_INVALID_THIS('URLSearchParams');
190190
}
@@ -197,7 +197,7 @@ class URLSearchParams {
197197
if (recurseTimes !== null) {
198198
innerOpts.depth = recurseTimes - 1;
199199
}
200-
var innerInspect = (v) => util.inspect(v, innerOpts);
200+
var innerInspect = (v) => inspect(v, innerOpts);
201201

202202
var list = this[searchParams];
203203
var output = [];
@@ -334,7 +334,7 @@ class URL {
334334
scheme === 'file:');
335335
}
336336

337-
[util.inspect.custom](depth, opts) {
337+
[inspect.custom](depth, opts) {
338338
if (this == null ||
339339
Object.getPrototypeOf(this[context]) !== URLContext.prototype) {
340340
throw new ERR_INVALID_THIS('URL');
@@ -368,7 +368,7 @@ class URL {
368368
obj[context] = this[context];
369369
}
370370

371-
return util.inspect(obj, opts);
371+
return inspect(obj, opts);
372372
}
373373
}
374374

@@ -1194,7 +1194,7 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
11941194
done: false
11951195
};
11961196
},
1197-
[util.inspect.custom](recurseTimes, ctx) {
1197+
[inspect.custom](recurseTimes, ctx) {
11981198
if (this == null || this[context] == null || this[context].target == null)
11991199
throw new ERR_INVALID_THIS('URLSearchParamsIterator');
12001200

@@ -1221,8 +1221,8 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
12211221
}
12221222
return prev;
12231223
}, []);
1224-
const breakLn = util.inspect(output, innerOpts).includes('\n');
1225-
const outputStrs = output.map((p) => util.inspect(p, innerOpts));
1224+
const breakLn = inspect(output, innerOpts).includes('\n');
1225+
const outputStrs = output.map((p) => inspect(p, innerOpts));
12261226
let outputStr;
12271227
if (breakLn) {
12281228
outputStr = `\n ${outputStrs.join(',\n ')}`;

0 commit comments

Comments
 (0)