summaryrefslogtreecommitdiffhomepage
path: root/client/web/src/utils/util.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/web/src/utils/util.ts')
-rw-r--r--client/web/src/utils/util.ts10
1 files changed, 10 insertions, 0 deletions
diff --git a/client/web/src/utils/util.ts b/client/web/src/utils/util.ts
index 5f8eda7b7..4abde7726 100644
--- a/client/web/src/utils/util.ts
+++ b/client/web/src/utils/util.ts
@@ -22,6 +22,16 @@ export function isObject(val: unknown): val is object {
}
/**
+ * capitalize returns the given string with the first letter capitalized.
+ */
+export function capitalize(str: string): string {
+ if (!str) {
+ return str // don't do anything to empty strings
+ }
+ return str.charAt(0).toUpperCase() + str.slice(1)
+}
+
+/**
* pluralize is a very simple function that returns either
* the singular or plural form of a string based on the given
* quantity.