/**
 * Extract query strings from a URL.
 *
 * @param {field} field The field in the query string to look up.
 * @param {string} [url] The URL to be parsed. If not specified, the query string portion of the current URL will be used.
 * 
 * @return {string} Returns the value of the field if it exists in the query string.
 * Otherwise, returns NULL.
 */

var queryString = function (value, url) {
  var match = [],
      query = {};
  
  url = url || window.location.search;
  
  if (value) {
    match = new RegExp('[?&]' + value + '=([^&]*)').exec(url)[0].replace(/[?&]/, '').split('=');
  } else {
    url = url.replace(/\?/, '').split('&');

    for (var i = 0; i < url.length; i++) {
      var field = url[i].split('=');
      query[field[0]] = decodeURIComponent(field.replace(/\+/g, ' '));
    }
  }

  return value ? decodeURIComponent(match[1].replace(/\+/g, ' ')) : query;
};

@@ -51,21 +51,24 @@
 ram 
-%7Bfield%7D field
+%5Bvalue%5D %7Bstring%7D
  The
@@ -105,16 +105,32 @@
 look up.
+ (default: null)
 %0A * @par
@@ -131,16 +131,22 @@
 * @param
+ %5Burl%5D
  %7Bstring
@@ -146,22 +146,16 @@
 %7Bstring%7D
- %5Burl%5D
  The URL
@@ -337,35 +337,77 @@
 ing.
-%0A * Otherwise, returns NULL
+ If no field is given, the whole querystring is returned as an object
 .%0A *

Update queryString documentation