Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated String.prototype.substr() #2579

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/Highlight/Highlight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export default {
chunks.push({
...range,
highlight: true,
text: this.text.substr(range.start, range.end - range.start),
text: this.text.slice(range.start, range.end),
})
currentRange++
currentIndex = range.end
Expand All @@ -187,7 +187,7 @@ export default {
start: currentIndex,
end: this.text.length,
highlight: false,
text: this.text.substr(currentIndex, this.text.length - currentIndex),
text: this.text.slice(currentIndex),
})
// Set the current index so the while loop ends.
currentIndex = this.text.length
Expand All @@ -200,7 +200,7 @@ export default {
start: currentIndex,
end: range.start,
highlight: false,
text: this.text.substr(currentIndex, range.start - currentIndex),
text: this.text.slice(currentIndex, range.start),
})
currentIndex = range.start
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Multiselect/EllipsisedOption.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export default {
},
part1() {
if (this.needsTruncate) {
return this.name.substr(0, this.split)
return this.name.slice(0, this.split)
}
return this.name
},
part2() {
if (this.needsTruncate) {
return this.name.substr(this.split)
return this.name.slice(this.split)
}
return ''
},
Expand Down
2 changes: 1 addition & 1 deletion src/utils/GenRandomId.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const GenRandomId = (length) => {
return Math.random()
.toString(36)
.replace(/[^a-z]+/g, '')
.substr(0, length || 5)
.slice(0, length || 5)
}

export default GenRandomId
4 changes: 2 additions & 2 deletions webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const StyleLintPlugin = require('stylelint-webpack-plugin')
// scope variable
// fallback for cypress testing
const appVersion = JSON.stringify(process.env.npm_package_version || 'nextcloud-vue')
const versionHash = md5(appVersion).substr(0, 7)
const versionHash = md5(appVersion).slice(0, 7)
const SCOPE_VERSION = JSON.stringify(versionHash)

console.info('This build version hash is', versionHash, '\n')
Expand All @@ -25,7 +25,7 @@ const translations = fs
.filter(name => name !== 'messages.pot' && name.endsWith('.pot'))
.map(file => {
const path = './l10n/' + file
const locale = file.substr(0, file.length - '.pot'.length)
const locale = file.slice(0, -'.pot'.length)

const po = fs.readFileSync(path)
const json = gettextParser.po.parse(po)
Expand Down