code: function splitLocation(location) {
    var re = /([^\?#]*)?(\?[^#]*)?(#.*)?$/;
    var match = re.exec(location);
    return {
      path: match[1] || '',
      queryString: match[2] && match[2].substring(1) || '',
      hash: match[3] && match[3].substring(1) || ''
    }
  }
docs: Split a location string into different parts, e.g.: splitLocation("/foo/bar?fruit=apple#some-hash") => { path: "/foo/bar", queryString: "fruit=apple", hash: "some-hash" }