utils/uri.js
function parseQueryString(query, callback) {
  // Break early for empty string.
  if (!query) {
    return;
  }
  // Remove leading `?` so that callers can pass `location.search` directly to
  // this function.
  if (query.startsWith('?')) {
    query = query.slice(1);
  }

  var pairs = query.split('&');
  for (var i = 0; i < pairs.length; i++) {
    var separatorIndex = pairs[i].indexOf('=');
    if (separatorIndex >= 0) {
      var key = pairs[i].substring(0, separatorIndex);
      var value = pairs[i].substring(separatorIndex + 1);
      callback(key, urlDecode_(value));
    } else {
      // Treat "?foo" without the "=" as having an empty value.
      var key = pairs[i];
      callback(key, '');
    }
  }
}
function parseQueryString(query, callback) {
  // Break early for empty string.
  if (!query) {
    return;
  }
  // Remove leading `?` so that callers can pass `location.search` directly to
  // this function.
  if (query.startsWith('?')) {
    query = query.slice(1);
  }

  var pairs = query.split('&');
  for (var i = 0; i < pairs.length; i++) {
    var separatorIndex = pairs[i].indexOf('=');
    if (separatorIndex >= 0) {
      var key = pairs[i].substring(0, separatorIndex);
      var value = pairs[i].substring(separatorIndex + 1);
      callback(key, urlDecode_(value));
    } else {
      // Treat "?foo" without the "=" as having an empty value.
      var key = pairs[i];
      callback(key, '');
    }
  }
}
function parseQueryString ( query , callback ) { // Break early for empty string. if ( ! query ) { return ; } // Remove leading `?` so that callers can pass `location.search` directly to // this function. if ( query . startsWith ( '?' ) ) { query = query . slice ( 1 ) ; } var pairs = query . split ( '&' ) ; for ( var i = 0 ; i < pairs . length ; i ++ ) { var separatorIndex = pairs [ i ] . indexOf ( '=' ) ; if ( separatorIndex >= 0 ) { var key = pairs [ i ] . substring ( 0 , separatorIndex ) ; var value = pairs [ i ] . substring ( separatorIndex + 1 ) ; callback ( key , urlDecode_ ( value ) ) ; } else { // Treat "?foo" without the "=" as having an empty value. var key = pairs [ i ] ; callback ( key , '' ) ; } } }
Parses a query string and calls a callback function for every key-value
pair found in the string.
@param {string} query Query string (without the leading question mark).
@param {function(string, string)} callback Function called for every
key-value pair found in the query string.
Parses a query string and calls a callback function for every key - value pair found in the string .