code: function trimUrlQuery(url: string): string {
    const length = url.length;
    const q1 = url.indexOf("?");
    const q2 = url.indexOf("&");
    const q3 = url.indexOf("#");
    const q = Math.min(
      q1 != -1 ? q1 : length,
      q2 != -1 ? q2 : length,
      q3 != -1 ? q3 : length
    );
  
    return url.slice(0, q);
  }
docs: Trims the query part or reference identifier of a URL string, if necessary.