Parse URI query strings
@param  {string} url        The URL or query string to parse
@param  {bool}   decode     Should values be URI decoded?
@return {object}            The parsed query string
503143
function(url, decode) {

      // If we're passed an object, convert it to a string
      if (typeof url === 'object') url = url.toString();

      // Default decode to true
      if (typeof decode === 'undefined') decode = true;

      // Extract query string from url
      var query_string = this.search(url);

      // Replace the starting ?, if it is there
      query_string = query_string.replace(/^\?/, '');

      var parts;

      // If query string is blank, parts should be blank
      if (query_string === '') {
        parts = [];
      } else {
        // Split the query string into key value parts
        parts = query_string.split('&');
      }

      // Iniate the return value
      var query = {};

      // Loop through each other the parts, splitting it into keys and values
      for (var i = 0, l = parts.length; i < l; i++) {
        var part = parts[i];
        var key;
        var val = '';

        if (part.match('=')) {
          // If it is in the format key=val

          // Split into the key and value by the = symbol
          var part_parts = part.split('=');

          // Assign key and value
          key = part_parts[0];
          val = part_parts[1];
        } else {
          // If there is no value, just set the key to the full part
          key = part;
        }

        // If we actually have a value, URI decode it
        if (val !== '' && decode) {
          val = decodeURIComponent(val);
        }

        // Assign to the return value
        query[key] = val;
      }

      return query;
    }
566839
function queryStringToObject(queryString) {
        var pairs = queryString.split('&');
        var result = {};
        pairs.forEach(function (pair) {
            pair = pair.split('=');
            result[pair[0]] = decodeURIComponent(pair[1] || '');
        });
        return JSON.parse(JSON.stringify(result));
    }
777806
function fastparse (str) {
  if (typeof str !== 'string' || str.charCodeAt(0) !== 0x2f /* / */) {
    return parse(str)
  }

  var pathname = str
  var query = null
  var search = null

  // This takes the regexp from https://github.com/joyent/node/pull/7878
  // Which is /^(\/[^?#\s]*)(\?[^#\s]*)?$/
  // And unrolls it into a for loop
  for (var i = 1; i < str.length; i++) {
    switch (str.charCodeAt(i)) {
      case 0x3f: /* ?  */
        if (search === null) {
          pathname = str.substring(0, i)
          query = str.substring(i + 1)
          search = str.substring(i)
        }
        break
      case 0x09: /* \t */
      case 0x0a: /* \n */
      case 0x0c: /* \f */
      case 0x0d: /* \r */
      case 0x20: /*    */
      case 0x23: /* #  */
      case 0xa0:
      case 0xfeff:
        return parse(str)
    }
  }

  var url = Url !== undefined
    ? new Url()
    : {}

  url.path = str
  url.href = str
  url.pathname = pathname

  if (search !== null) {
    url.query = query
    url.search = search
  }

  return url
}
121531
function (url) {
      var query = url.split('?')[1];
      var data = query.split("&");
      var result = {};
      for(var i=0; i<data.length; i++) {
        var item = data[i].split("=");
        result[item[0]] = item[1];
      }
      return result;
    }
473884
function(params){
            var object = {};
            if(typeof params === 'string'){

                params.replace('?', '').split('&').forEach(function(kv){
                    var pair = kv.split('=');
                    if(pair.length === 2){
                        object[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
                    }
                });
            } else {
                object = params;
            }
            return this.plainObject(object);
        }
21769
function(url) {

      // If the URL is an object with toString, do that
      if (typeof url === 'object' && typeof url.toString === 'function') {
        url = url.toString();
      }

      var query_string;

      // If the url does not have a query, return a blank string
      if (url.indexOf('?') === -1 && url.indexOf('=') === -1) {
        query_string = '';
      } else {
        var parts = url.split('?');
        var part = parts.slice(parts.length === 1 ? 0 : 1);
        query_string = '?' + part.join('?').split('#')[0];
      }


      return query_string;
    }
390474
function parse(uri) {
  var result = { baseUri: '', fragment: '#' };

  if (uri.slice(0, 4).toLowerCase() === 'urn:') {
    result.kind = 'urn';
    var parts = uri.match(URN_REGEX);
    if (parts) {
        result.baseUri = parts[1] + (parts[2] || '');
      result.host = parts[1];
      if (parts[2]) { result.pathname = parts[2]; }
      if (parts[3]) { result.fragment = parts[3]; }
    }
  } else {
    result.kind = 'url';
    var parsed = url.parse(uri);
    if (parsed.hash) {
      result.fragment = parsed.hash;
      delete parsed.hash;
    }
    result.absolute =
      (parsed.host && parsed.pathname && parsed.pathname[0] === '/') ?
      true : false;
    result.baseUri = url.format(parsed);
  }

  return result;
}
288854
function parseQueryString(s) {
    var data = {};

    s.split('&').forEach(function(item) {
      var pair = item.split('=');
      data[decodeURIComponent(pair[0])] =
        pair[1] ? decodeURIComponent(pair[1]) : true;
    });

    return data;
  }
974679
function url(queryString) {
  queryString = decodeURIComponent(queryString);
  queryString = queryString.split('&');
  return queryString.reduce((ret, url) => {
    url = url.split('=');
    var key = url[0];
    var val = url[1];

    // EXAMPLE: key[]=bar&key[]=world =>
    //  ret = { key: ['bar', 'world'] }
    if(key.slice(-2) === '[]') {
      key = key.slice(0, -2);
      ret[key] ? ret[key].push(val) : (ret[key] = [val]);

      // EXAMPLE: key[foo]=bar&key[hello]=world =>
      //  ret = { key: {foo: 'bar', hello: 'world'} }
    } else if(key.match(/\[\w+\]$/)) {
      let keys = key.split(/\[|\]/);
      let subkey = keys[1];
      key = keys[0];

      if(!ret[key]) ret[key] = {};
      ret[key][subkey] = val;
    } else {
      ret[key] = val;
    }
    return ret;
  }, {});
}
911951
function parseUrlSearch(search) {
  if (search[0] === '?') search = search.slice(1);

  function splitParam(param) {
    var [key, value = ''] = param.split('=');
    return [key, decodeURIComponent(value)];
  }

  return objectFromPairs(search . split('&') . map(splitParam));
}
221943
function querystring(query) {
  var parser = /([^=?&]+)=?([^&]*)/g
    , result = {}
    , part;

  while (part = parser.exec(query)) {
    var key = decode(part[1])
      , value = decode(part[2]);

    //
    // Prevent overriding of existing properties. This ensures that build-in
    // methods like `toString` or __proto__ are not overriden by malicious
    // querystrings.
    //
    if (key in result) continue;
    result[key] = value;
  }

  return result;
}
1144408
function parseQueryStr(url) {
      if (!contains(url, '?')) return {};
      var queryStr = url.substring(url.lastIndexOf('?') + 1);
      if (queryStr === '') return {};
      var querys = queryStr.split('&'), params = {}, i = -1;
      while (++i < querys.length) {
        var kw = querys[i].split('=')
          , decode = decodeURIComponent;
        params[decode(kw[0])] = decode(kw[1] || '');
      }
      return params;
    }
326571
function parse_uri(uri = document.location)
{
	const options =
	{
		strictMode: false,
		key:
		[
			"source",   // protocol:
			"protocol",
			"authority", // //user:password@
			"userInfo", // user:password
			"user",
			"password",
			"host",
			"port",
			"relative", 
			"path",
			"directory",
			"file",
			"query",
			"anchor"
		],
		query:
		{
			name:   "parameters",
			parser: /(?:^|&)([^&=]*)=?([^&]*)/g
		},
		parser:
		{
			//            protocol  :     //      user        :password    @  host          :port      path (relative,directory,file) ? query       #anchor
			strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
			loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
		}
	}
		
	var matches = options.parser[options.strictMode ? "strict" : "loose"].exec(uri)
	
	const result = {}

	let i = 14
	while (i--)
	{
		result[options.key[i]] = matches[i] || ""
	}

	result[options.query.name] = {}

	// options.key[12] === "query"
	result[options.key[12]].replace(options.query.parser, function ($0, $1, $2)
	{
		if ($1)
		{
			result[options.query.name][$1] = $2
		}
	})

	return result
}
872623
function querystring(query) {
      var parser = /([^=?&]+)=([^&]*)/g
        , result = {}
        , part;

      //
      // Little nifty parsing hack, leverage the fact that RegExp.exec increments
      // the lastIndex property so we can continue executing this loop until we've
      // parsed all results.
      //
      for (;
        part = parser.exec(query);
        result[decodeURIComponent(part[1])] = decodeURIComponent(part[2])
      );

      return result;
    }
179674
function split(url) {
  assert.equal(typeof url, 'string', 'url-querystring: url should be a string');

  var res = {};
  var nw = url.split('?');

  res.url = nw[0];
  res.qs = nw.length == 2
    ? qs.parse(nw[1])
    : {};

  return res;
}
504479
def parse_url(url):
    
    try:
        url = unicode(url)
    except UnicodeDecodeError:
        pass

    if py3k:
        make_utf8 = lambda x: x
    else:
        make_utf8 = lambda x: isinstance(x, unicode) and x.encode('utf-8') or x

    if '://' in url:
        scheme, url = url.split('://', 1)
    else:
        scheme = 'http'
    url = 'http://' + url
    parsed = urlparse.urlsplit(url)
    r = ObjectDict()
    r['scheme'] = make_utf8(scheme)
    r['netloc'] = make_utf8(parsed.netloc)
    r['path'] = make_utf8(parsed.path)
    r['query'] = make_utf8(parsed.query)
    r['fragment'] = make_utf8(parsed.fragment)
    r['uri'] = make_utf8(parsed.path)
    if parsed.query:
        r['uri'] += '?' + make_utf8(parsed.query)
    r['username'] = make_utf8(parsed.username)
    r['password'] = make_utf8(parsed.password)
    host = make_utf8(parsed.hostname.encode('idna').decode('utf-8'))
    r['host'] = r['hostname'] = host
    try:
        r['port'] = parsed.port
    except ValueError:
        r['port'] = None
    if r['port']:
        r['http_host'] = '%s:%d' % (r['host'], r['port'])
    else:
        r['http_host'] = r['host']

    return r
810740
function parseQuery(str, opts = {}) {
  let _querys = {};
  decodeURIComponent(str || '').replace(/\+/g, ' ')
  // (optional no-capturing & )(key)=(value)
  .replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, _name, _value) {
    if (_name) {
      let _path, _acc, _tmp, _ref;
      (_path = []).unshift(_name = _name.replace(/\[([^\]]*)]/g, function ($0, _k) {
        _path.push(_k);
        return '';
      }));
      _ref = _querys;
      for (let j = 0; j < _path.length - 1; j++) {
        _acc = _path[j];
        _tmp = _path[j + 1];
        if (!_ref[_acc]) {
          _ref[_acc] = _tmp === '' || /^[0-9]+$/.test(_tmp) ? [] : {};
        }
        _ref = _ref[_acc];
      }
      if (opts.boolval) {
        // first
        if (_value === 'true') {
          _value = true;
        } else if (_value === 'false') {
          _value = false;
        }
      } else if (opts.intval) {
        // skip "true" & "false"
        if (_tmp = parseInt(_value) === _value) {
          _value = _tmp;
        }
      }
      if ((_acc = _path[_path.length - 1]) === '') {
        _ref.push(_value);
      } else {
        _ref[_acc] = _value;
      }
    }
  });
  return _querys;
}