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:
parent
2d7638a230
commit
6b8e0f25d6
@ -33,7 +33,7 @@ export const replaceAll = (input = '', find = '', replace = '') =>
|
|||||||
|
|
||||||
// Convert to title case
|
// Convert to title case
|
||||||
export const toTitleCase = (input = '') =>
|
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
|
// Convert string to pascalCase
|
||||||
export function toPascalCase(input = '') {
|
export function toPascalCase(input = '') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user