Parcourir la source

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>
Tobias Speicher il y a 3 ans
Parent
commit
a5d1b68800
1 fichiers modifiés avec 3 ajouts et 3 suppressions
  1. 3 3
      js/utils/color.js

+ 3 - 3
js/utils/color.js

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