Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix @typescript-eslint/prefer-string-starts-ends-with.
Anders Kaseorgc16837a6643e
diff --git a/web/src/browser_history.ts b/web/src/browser_history.tsindex 16d90a9e569..23245d60de3 100644--- a/web/src/browser_history.ts+++ b/web/src/browser_history.ts@@ -107,7 +107,7 @@ export function return_to_web_public_hash(): void {export function get_full_url(hash: string): string {const location = window.location;- if (hash.charAt(0) !== "#" && hash !== "") {+ if (!hash.startsWith("#") && hash !== "") {hash = "#" + hash;}@@ -115,7 +115,7 @@ export function get_full_url(hash: string): string {let pathname = location.pathname;if (pathname === undefined) {pathname = "/";- } else if (pathname === "" || pathname.charAt(0) !== "/") {+ } else if (pathname === "" || !pathname.startsWith("/")) {pathname = "/" + pathname;}diff --git a/web/src/channel.ts b/web/src/channel.tsindex b961bce4906..40e4a70c2f0 100644--- a/web/src/channel.ts+++ b/web/src/channel.ts@@ -210,7 +210,7 @@ export function patch(}export function xhr_error_message(message: string, xhr: JQuery.jqXHR<unknown>): string {- if (xhr.status.toString().charAt(0) === "4" && xhr.responseJSON?.msg) {+ if (xhr.status >= 400 && xhr.status < 500 && xhr.responseJSON?.msg) {// Only display the error response for 4XX, where we've crafted// a nice response.const server_response_html = _.escape(xhr.responseJSON.msg);diff --git a/web/src/hash_util.ts b/web/src/hash_util.tsindex 1d1bd9c6cb7..da753a1f877 100644--- a/web/src/hash_util.ts+++ b/web/src/hash_util.ts@@ -11,7 +11,7 @@ type Operator = {operator: string; operand: string; negated?: boolean};export function build_reload_url(): string {let hash = window.location.hash;- if (hash.length !== 0 && hash[0] === "#") {+ if (hash.length !== 0 && hash.startsWith("#")) {hash = hash.slice(1);}return "+oldhash=" + encodeURIComponent(hash);@@ -177,7 +177,7 @@ export function parse_narrow(hash: string): Operator[] | undefined {}let negated = false;- if (operator[0] === "-") {+ if (operator.startsWith("-")) {negated = true;operator = operator.slice(1);}