Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

bulleted_numbered_list_util: Convert module to TypeScript.

Anders Kaseorgfcd8395eb5a0
diff --git a/web/src/bulleted_numbered_list_util.js b/web/src/bulleted_numbered_list_util.js
deleted file mode 100644
index ca8809774a6..00000000000
--- a/web/src/bulleted_numbered_list_util.js
+++ /dev/null
@@ -1,12 +0,0 @@
-export const get_last_line = (text) => text.slice(text.lastIndexOf("\n") + 1);
-
-export const is_bulleted = (line) =>
- line.startsWith("- ") || line.startsWith("* ") || line.startsWith("+ ");
-
-// testing against regex for string with numbered syntax, that is,
-// any string starting with digit/s followed by a period and space
-export const is_numbered = (line) => /^\d+\. /.test(line);
-
-export const strip_bullet = (line) => line.slice(2);
-
-export const strip_numbering = (line) => line.slice(line.indexOf(" ") + 1);
diff --git a/web/src/bulleted_numbered_list_util.ts b/web/src/bulleted_numbered_list_util.ts
new file mode 100644
index 00000000000..bbb6048aeb9
--- /dev/null
+++ b/web/src/bulleted_numbered_list_util.ts
@@ -0,0 +1,12 @@
+export const get_last_line = (text: string): string => text.slice(text.lastIndexOf("\n") + 1);
+
+export const is_bulleted = (line: string): boolean =>
+ line.startsWith("- ") || line.startsWith("* ") || line.startsWith("+ ");
+
+// testing against regex for string with numbered syntax, that is,
+// any string starting with digit/s followed by a period and space
+export const is_numbered = (line: string): boolean => /^\d+\. /.test(line);
+
+export const strip_bullet = (line: string): string => line.slice(2);
+
+export const strip_numbering = (line: string): string => line.slice(line.indexOf(" ") + 1);