Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
hello: Add safety assertions.
Anders Kaseorg4e91572c96da
diff --git a/web/src/portico/hello.ts b/web/src/portico/hello.tsindex 60dc9d1ed1b..e5a2a57273d 100644--- a/web/src/portico/hello.ts+++ b/web/src/portico/hello.ts@@ -1,12 +1,13 @@-// Mark this as a module for ESLint and Webpack.-export {};+import assert from "minimalistic-assert";function get_new_rand(old_random_int: number, max: number): number {+ assert(max >= 2);const random_int = Math.floor(Math.random() * max);return random_int === old_random_int ? get_new_rand(random_int, max) : random_int;}function get_random_item_from_array<T>(array: T[]): T {+ assert(array.length >= 1);return array[Math.floor(Math.random() * array.length)];}