mirror of
https://code.forgejo.org/actions/checkout.git
synced 2025-08-23 15:30:49 +02:00
Replace deprecated String.prototype.substr()
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
2d1c1198e7
commit
dedef103f1
4 changed files with 13 additions and 13 deletions
|
@ -110,9 +110,9 @@ class GitCommandManager {
|
|||
branch = branch.trim()
|
||||
if (branch) {
|
||||
if (branch.startsWith('refs/heads/')) {
|
||||
branch = branch.substr('refs/heads/'.length)
|
||||
branch = branch.slice('refs/heads/'.length)
|
||||
} else if (branch.startsWith('refs/remotes/')) {
|
||||
branch = branch.substr('refs/remotes/'.length)
|
||||
branch = branch.slice('refs/remotes/'.length)
|
||||
}
|
||||
|
||||
result.push(branch)
|
||||
|
@ -217,7 +217,7 @@ class GitCommandManager {
|
|||
line = line.trim()
|
||||
if (line.startsWith('ref:') || line.endsWith('HEAD')) {
|
||||
return line
|
||||
.substr('ref:'.length, line.length - 'ref:'.length - 'HEAD'.length)
|
||||
.slice('ref:'.length, line.length - 'HEAD'.length)
|
||||
.trim()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue