Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f1851cb

Browse filesBrowse files
TimothyGuevanlucas
authored andcommitted
url: do not public expose inspect methods on URL
PR-URL: #10906 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 0bf3b24 commit f1851cb
Copy full SHA for f1851cb

File tree

Expand file treeCollapse file tree

2 files changed

+5
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+5
-4
lines changed
Open diff view settings
Collapse file

‎lib/internal/url.js‎

Copy file name to clipboardExpand all lines: lib/internal/url.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class TupleOrigin {
7777
return result;
7878
}
7979

80-
inspect() {
80+
[util.inspect.custom]() {
8181
return `TupleOrigin {
8282
scheme: ${this[kScheme]},
8383
host: ${this[kHost]},
@@ -235,7 +235,7 @@ class URL {
235235
return (this[context].flags & binding.URL_FLAGS_CANNOT_BE_BASE) !== 0;
236236
}
237237

238-
inspect(depth, opts) {
238+
[util.inspect.custom](depth, opts) {
239239
const ctx = this[context];
240240
var ret = 'URL {\n';
241241
ret += ` href: ${this.href}\n`;
Collapse file

‎test/parallel/test-whatwg-url-parsing.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-url-parsing.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const common = require('../common');
4+
const util = require('util');
45

56
if (!common.hasIntl) {
67
// A handful of the tests fail when ICU is not included.
@@ -144,8 +145,8 @@ for (const test of allTests) {
144145
const url = test.url ? new URL(test.url) : new URL(test.input, test.base);
145146

146147
for (const showHidden of [true, false]) {
147-
const res = url.inspect(null, {
148-
showHidden: showHidden
148+
const res = util.inspect(url, {
149+
showHidden
149150
});
150151

151152
const lines = res.split('\n');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.