encode_uri_components = function (uri) {
        /**
         * encode just the components of a multi-segment uri,
         * leaving '/' separators
         */
        return uri.split('/').map(encodeURIComponent).join('/');
    }
an `a` element with an href allows attr-access to the parsed segments of a URL
a = parse_url("http://localhost:8888/path/name#hash")
a.protocol = "http:"
a.host     = "localhost:8888"
a.hostname = "localhost"
a.port     = 8888
a.pathname = "/path/name"
a.hash     = "#hash"