'use strict';
// Reproduces the joi/@hapi/hoek init-time pattern: package compiled
// through perry.compilePackages references `URL` as a global at module
// load time. Without the V8 jsruntime URL polyfill this throws
// `ReferenceError: URL is not defined` before the consumer code runs.

exports.urlProto = URL.prototype;
exports.parseHref = function (href) {
    const u = new URL(href);
    return {
        protocol: u.protocol,
        hostname: u.hostname,
        pathname: u.pathname,
        search: u.search,
    };
};
exports.searchToString = function (init) {
    return new URLSearchParams(init).toString();
};
