Merge pull request #7527 from kim5566/fix/null-check-error

fix check null error
This commit is contained in:
Fredrik Adelöw
2021-10-09 09:35:15 +02:00
committed by GitHub
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);
}