Replace deprecated String.prototype.substr() (#2427)
String.prototype.substr() is deprecated (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr) 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:
		@ -33,7 +33,7 @@ export const replaceAll = (input = '', find = '', replace = '') =>
 | 
			
		||||
 | 
			
		||||
// Convert to title case
 | 
			
		||||
export const toTitleCase = (input = '') =>
 | 
			
		||||
  input.toString().replace(/\w\S*/g, (text) => text.charAt(0).toUpperCase() + text.substr(1).toLowerCase());
 | 
			
		||||
  input.toString().replace(/\w\S*/g, (text) => text.charAt(0).toUpperCase() + text.slice(1).toLowerCase());
 | 
			
		||||
 | 
			
		||||
// Convert string to pascalCase
 | 
			
		||||
export function toPascalCase(input = '') {
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user