fix check null error

Signed-off-by: kim5566 <qi.jin@anz.com>
This commit is contained in:
kim5566
2021-10-09 18:00:14 +11:00
parent ce6387a40b
commit 6ec56d5a57
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/core-components': patch
---
update the null check to use the optional chaining operator in case of non-null assertion operator is not working in function extractInitials(values: string)
@@ -28,5 +28,5 @@ export function stringToColor(str: string) {
}
export function extractInitials(value: string) {
return value.match(/\b\w/g)!.join('').substring(0, 2);
return value.match(/\b\w/g)?.join('').substring(0, 2);
}