Merge pull request #15898 from backstage/freben/substr
🧹 get rid of usages of substr which is deprecated
This commit is contained in:
@@ -22,11 +22,11 @@ export function stringToColor(str: string) {
|
||||
let color = '#';
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const value = (hash >> (i * 8)) & 0xff;
|
||||
color += `00${value.toString(16)}`.substr(-2);
|
||||
color += `00${value.toString(16)}`.slice(-2);
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
export function extractInitials(value: string) {
|
||||
return value.match(/\b\w/g)?.join('').substring(0, 2);
|
||||
return value.match(/\b\w/g)?.join('').slice(0, 2);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user