Open this example in the interactive library
Source code
import {
URL,
domainToASCII,
domainToUnicode,
pathToFileURL,
fileURLToPath,
} from "node:url";
console.log(URL.parse("broken url"));
Sample output
null

Open this example in the interactive library
import {
URL,
domainToASCII,
domainToUnicode,
pathToFileURL,
fileURLToPath,
} from "node:url";
console.log(URL.parse("broken url"));
null