refactor: replace deprecated String.prototype.substr()
.substr() is deprecated so we replace it with functions which work similarily but aren't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
This commit is contained in:
@@ -85,7 +85,7 @@ function Chooseaccount({ loading, errors, classes, hello, history, dispatch }) {
|
||||
className={classes.accountListItem}
|
||||
disabled={!!loading}
|
||||
onClick={(event) => logon(event)}
|
||||
><ListItemAvatar><Avatar>{username.substr(0, 1)}</Avatar></ListItemAvatar>
|
||||
><ListItemAvatar><Avatar>{username.slice(0, 1)}</Avatar></ListItemAvatar>
|
||||
<ListItemText className="oc-light" primary={username} />
|
||||
</ListItem>
|
||||
<ListItem
|
||||
|
||||
@@ -14,7 +14,7 @@ const envPublicUrl = process.env.PUBLIC_URL;
|
||||
function ensureSlash(inputPath, needsSlash) {
|
||||
const hasSlash = inputPath.endsWith('/');
|
||||
if (hasSlash && !needsSlash) {
|
||||
return inputPath.substr(0, inputPath.length - 1);
|
||||
return inputPath.slice(0, -1);
|
||||
} else if (!hasSlash && needsSlash) {
|
||||
return `${inputPath}/`;
|
||||
} else {
|
||||
|
||||
@@ -49,7 +49,7 @@ export default {
|
||||
methods: {
|
||||
...mapActions('Settings', ['saveValue']),
|
||||
getSettingComponent (setting) {
|
||||
return 'Setting' + setting.type[0].toUpperCase() + setting.type.substr(1)
|
||||
return 'Setting' + setting.type[0].toUpperCase() + setting.type.slice(1)
|
||||
},
|
||||
getValue (setting) {
|
||||
return this.getSettingsValue({ settingId: setting.id })
|
||||
|
||||
Reference in New Issue
Block a user