1
0
Fork 0

replace deprecated String.prototype.substr()

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated
Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
Tobias Speicher 2022-03-20 16:17:42 +01:00
parent 37861335a2
commit a5d1b68800
No known key found for this signature in database
GPG Key ID: 2CF824BD810C3BDB
1 changed files with 3 additions and 3 deletions

View File

@ -29,9 +29,9 @@ export const colorToRgb = ( color ) => {
if( hex6 && hex6[1] ) { if( hex6 && hex6[1] ) {
hex6 = hex6[1]; hex6 = hex6[1];
return { return {
r: parseInt( hex6.substr( 0, 2 ), 16 ), r: parseInt( hex6.slice( 0, 2 ), 16 ),
g: parseInt( hex6.substr( 2, 2 ), 16 ), g: parseInt( hex6.slice( 2, 4 ), 16 ),
b: parseInt( hex6.substr( 4, 2 ), 16 ) b: parseInt( hex6.slice( 4, 6 ), 16 )
}; };
} }