code: function (url, serializeArray) {
                  var host = url.host;
                  if (host === undef && url.hostname) {
                      host = encodeURIComponent(url.hostname);
                      if (url.port) {
                          host += ':' + url.port;
                      }
                  }
                  var search = url.search;
                  var query = url.query;
                  if (search === undef && query !== undef) {
                      if (typeof query !== 'string') {
                          query = querystring.stringify(query, undef, undef, serializeArray);
                      }
                      if (query) {
                          search = '?' + query;
                      }
                  }
                  if (search && search.charAt(0) !== '?') {
                      search = '?' + search;
                  }
                  var hash = url.hash || '';
                  if (hash && hash.charAt(0) !== '#') {
                      hash = '#' + hash;
                  }
                  var pathname = url.pathname || '';
                  var out = [], protocol, auth;
                  if (protocol = url.protocol) {
                      if (protocol.slice(0 - 1) !== ':') {
                          protocol += ':';
                      }
                      out.push(encodeSpecialChars(protocol, reDisallowedInProtocolOrAuth));
                  }
                  if (host !== undef) {
                      if (this.slashes || protocol && needDoubleSlash(protocol)) {
                          out.push('//');
                      }
                      if (auth = url.auth) {
                          out.push(encodeSpecialChars(auth, reDisallowedInProtocolOrAuth));
                          out.push('@');
                      }
                      out.push(host);
                  }
                  if (pathname) {
                      out.push(encodeSpecialChars(pathname, reDisallowedInPathName));
                  }
                  if (search) {
                      out.push(search);
                  }
                  if (hash) {
                      out.push('#' + encodeSpecialChars(hash.substring(1), reDisallowedInHash));
                  }
                  return out.join('');
              }
docs: Take a parsed URL object, and return a formatted URL string.
  @param {Object} url parsed from url.parse
  @param {Boolean} [serializeArray=true] whether add '[]' to array key of query data