lib/collection/url.js
function (url) {
        !url && (url = E);
        var parsedUrl = _.isString(url) ? Url.parse(url) : url,
            auth = parsedUrl.auth,
            protocol = parsedUrl.protocol,
            port = parsedUrl.port,
            path = parsedUrl.path,
            hash = parsedUrl.hash,
            host = parsedUrl.host,
            query = parsedUrl.query,
            variable = parsedUrl.variable;

        // convert object based query string to array
        // @todo: create a key value parser
        if (query) {
            if (_.isString(query)) {
                query = QueryParam.parse(query);
            }

            if (!_.isArray(query) && _.keys(query).length) {
                query = _.map(_.keys(query), function (key) {
                    return {
                        key: key,
                        value: query[key]
                    };
                });
            }
        }

        // backward compatibility with path variables being storing thins with `id`
        if (_.isArray(variable)) {
            variable = _.map(variable, function (v) {
                _.isObject(v) && (v.key = v.key || v.id); // @todo Remove once path variables are deprecated
                return v;
            });
        }

        // expand string path name
        if (_.isString(path)) {
            path && (path = path.replace(regexes.trimPath, MATCH_1)); // remove leading slash for valid path
            // if path is blank string, we set it to undefined, if '/' then single blank string array
            path = path ? (path === PATH_SEPARATOR ? [E] : path.split(PATH_SEPARATOR)) : undefined;
        }

        // expand host string
        _.isString(host) && (host = host.split(regexes.splitDomain));

        _.assign(this, /** @lends Url.prototype */ {
            /**
             * @type {String}
             */
            auth: auth,

            /**
             * @type {String}
             */
            protocol: protocol,

            /**
             * @type {String}
             */
            port: port || undefined,

            /**
             * @type {Array<String>}
             */
            path: path,

            /**
             * @type {String}
             */
            hash: hash || undefined,

            /**
             * @type {Array<String>}
             */
            host: host,

            /**
             * @type {PropertyList<QueryParam>}
             */
            query: new PropertyList(QueryParam, this, query || []),

            /**
             * @type {VariableList}
             */
            variables: new VariableList(this, variable || [])
        });
    }
function (url) {
        !url && (url = E);
        var parsedUrl = _.isString(url) ? Url.parse(url) : url,
            auth = parsedUrl.auth,
            protocol = parsedUrl.protocol,
            port = parsedUrl.port,
            path = parsedUrl.path,
            hash = parsedUrl.hash,
            host = parsedUrl.host,
            query = parsedUrl.query,
            variable = parsedUrl.variable;

        // convert object based query string to array
        // @todo: create a key value parser
        if (query) {
            if (_.isString(query)) {
                query = QueryParam.parse(query);
            }

            if (!_.isArray(query) && _.keys(query).length) {
                query = _.map(_.keys(query), function (key) {
                    return {
                        key: key,
                        value: query[key]
                    };
                });
            }
        }

        // backward compatibility with path variables being storing thins with `id`
        if (_.isArray(variable)) {
            variable = _.map(variable, function (v) {
                _.isObject(v) && (v.key = v.key || v.id); // @todo Remove once path variables are deprecated
                return v;
            });
        }

        // expand string path name
        if (_.isString(path)) {
            path && (path = path.replace(regexes.trimPath, MATCH_1)); // remove leading slash for valid path
            // if path is blank string, we set it to undefined, if '/' then single blank string array
            path = path ? (path === PATH_SEPARATOR ? [E] : path.split(PATH_SEPARATOR)) : undefined;
        }

        // expand host string
        _.isString(host) && (host = host.split(regexes.splitDomain));

        _.assign(this, /** @lends Url.prototype */ {
            /**
             * @type {String}
             */
            auth: auth,

            /**
             * @type {String}
             */
            protocol: protocol,

            /**
             * @type {String}
             */
            port: port || undefined,

            /**
             * @type {Array<String>}
             */
            path: path,

            /**
             * @type {String}
             */
            hash: hash || undefined,

            /**
             * @type {Array<String>}
             */
            host: host,

            /**
             * @type {PropertyList<QueryParam>}
             */
            query: new PropertyList(QueryParam, this, query || []),

            /**
             * @type {VariableList}
             */
            variables: new VariableList(this, variable || [])
        });
    }
function ( url ) { ! url && ( url = E ) ; var parsedUrl = _ . isString ( url ) ? Url . parse ( url ) : url , auth = parsedUrl . auth , protocol = parsedUrl . protocol , port = parsedUrl . port , path = parsedUrl . path , hash = parsedUrl . hash , host = parsedUrl . host , query = parsedUrl . query , variable = parsedUrl . variable ; // convert object based query string to array // @todo: create a key value parser if ( query ) { if ( _ . isString ( query ) ) { query = QueryParam . parse ( query ) ; } if ( ! _ . isArray ( query ) && _ . keys ( query ) . length ) { query = _ . map ( _ . keys ( query ) , function ( key ) { return { key : key , value : query [ key ] } ; } ) ; } } // backward compatibility with path variables being storing thins with `id` if ( _ . isArray ( variable ) ) { variable = _ . map ( variable , function ( v ) { _ . isObject ( v ) && ( v . key = v . key || v . id ) ; // @todo Remove once path variables are deprecated return v ; } ) ; } // expand string path name if ( _ . isString ( path ) ) { path && ( path = path . replace ( regexes . trimPath , MATCH_1 ) ) ; // remove leading slash for valid path // if path is blank string, we set it to undefined, if '/' then single blank string array path = path ? ( path === PATH_SEPARATOR ? [ E ] : path . split ( PATH_SEPARATOR ) ) : undefined ; } // expand host string _ . isString ( host ) && ( host = host . split ( regexes . splitDomain ) ) ; _ . assign ( this , /** @lends Url.prototype */ { /**
             * @type {String}
             */ auth : auth , /**
             * @type {String}
             */ protocol : protocol , /**
             * @type {String}
             */ port : port || undefined , /**
             * @type {Array<String>}
             */ path : path , /**
             * @type {String}
             */ hash : hash || undefined , /**
             * @type {Array<String>}
             */ host : host , /**
             * @type {PropertyList<QueryParam>}
             */ query : new PropertyList ( QueryParam , this , query || [ ] ) , /**
             * @type {VariableList}
             */ variables : new VariableList ( this , variable || [ ] ) } ) ; }
Set a URL.

@draft
@param {String|Object} url
Set a URL .