MCPcopy Create free account
hub / github.com/nodejs/node / [inspect.custom]

Method [inspect.custom]

lib/internal/url.js:862–887  ·  view source on GitHub ↗
(depth, opts)

Source from the content-addressed store, hash-verified

860 }
861
862 [inspect.custom](depth, opts) {
863 if (typeof depth === 'number' && depth < 0)
864 return this;
865
866 const constructor = getConstructorOf(this) || URL;
867 const obj = { __proto__: { constructor } };
868
869 obj.href = this.href;
870 obj.origin = this.origin;
871 obj.protocol = this.protocol;
872 obj.username = this.username;
873 obj.password = this.password;
874 obj.host = this.host;
875 obj.hostname = this.hostname;
876 obj.port = this.port;
877 obj.pathname = this.pathname;
878 obj.search = this.search;
879 obj.searchParams = this.searchParams;
880 obj.hash = this.hash;
881
882 if (opts.showHidden) {
883 obj[contextForInspect] = this.#context;
884 }
885
886 return `${constructor.name} ${inspect(obj, opts)}`;
887 }
888
889 #getSearchFromContext() {
890 if (!this.#context.hasSearch) return '';

Callers

nothing calls this directly

Calls 2

getConstructorOfFunction · 0.85
inspectFunction · 0.70

Tested by

no test coverage detected