MCPcopy Index your code
hub / github.com/nodejs/node / constructor

Method constructor

lib/internal/url.js:824–852  ·  view source on GitHub ↗
(input, base = undefined, parseSymbol = undefined)

Source from the content-addressed store, hash-verified

822 }
823
824 constructor(input, base = undefined, parseSymbol = undefined) {
825 markTransferMode(this, false, false);
826
827 if (arguments.length === 0) {
828 throw new ERR_MISSING_ARGS('url');
829 }
830
831 // StringPrototypeToWellFormed is not needed.
832 input = `${input}`;
833
834 if (base !== undefined) {
835 base = `${base}`;
836 }
837
838 let href;
839 if (arguments.length < 3) {
840 href = bindingUrl.parse(input, base, true);
841 } else {
842 const raiseException = parseSymbol !== kParseURLSymbol;
843 const interpretAsWindowsPath = parseSymbol === kCreateURLFromWindowsPathSymbol;
844 const pathToFileURL = interpretAsWindowsPath || (parseSymbol === kCreateURLFromPosixPathSymbol);
845 href = pathToFileURL ?
846 bindingUrl.pathToFileURL(input, interpretAsWindowsPath, base) :
847 bindingUrl.parse(input, base, raiseException);
848 }
849 if (href) {
850 this.#updateContext(href);
851 }
852 }
853
854 static parse(input, base = undefined) {
855 if (arguments.length === 0) {

Callers

nothing calls this directly

Calls 4

#updateContextMethod · 0.95
markTransferModeFunction · 0.85
pathToFileURLMethod · 0.80
parseMethod · 0.65

Tested by

no test coverage detected