Ver código fonte

add another case for string undefined or null

Alexander Belanger 3 anos atrás
pai
commit
6856e544de
1 arquivos alterados com 3 adições e 1 exclusões
  1. 3 1
      dashboard/src/shared/string_utils.ts

+ 3 - 1
dashboard/src/shared/string_utils.ts

@@ -91,7 +91,9 @@ export const timeFrom = (
 };
 
 export const capitalize = (s: string) => {
-  if (s.length == 0) {
+  if (!s) {
+    return "";
+  } else if (s.length == 0) {
     return s;
   } else if (s.length == 1) {
     return s.charAt(0).toUpperCase();