in the process of learning Node.js, I want to copy a url object reference, but the result is not satisfactory. The details are as follows:
console.log(new URL("file://"))
// URL {
// href: "file:///",
// origin: "null",
// protocol: "file:",
// username: "",
// password: "",
// host: "",
// hostname: "",
// port: "",
// pathname: "/",
// search: "",
// searchParams: URLSearchParams {},
// hash: "" }
and destructional reconstruction is indeed such an object:
console.log({ ...new URL("file://") })
// { [Symbol(context)]:
// URLContext {
// flags: 400,
// scheme: "file:",
// username: "",
// password: "",
// host: "",
// port: null,
// path: [ "" ],
// query: null,
// fragment: null },
// [Symbol(query)]: URLSearchParams {} }