Skip to content

Commit b146f20

Browse files
fix: replace deprecated String.prototype.substr() (#68)
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <[email protected]>
1 parent 021b97b commit b146f20

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/lines-to-revs.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ const lineToRevDoc = line => {
9898
// ignore the pointer.
9999
// For now, though, we have to save both, because some tags
100100
// don't have peels, if they were not annotated.
101-
const ref = rawRef.substr('refs/tags/'.length)
101+
const ref = rawRef.slice('refs/tags/'.length)
102102
return { sha, ref, rawRef, type }
103103
}
104104

105105
if (type === 'branch') {
106-
const ref = rawRef.substr('refs/heads/'.length)
106+
const ref = rawRef.slice('refs/heads/'.length)
107107
return { sha, ref, rawRef, type }
108108
}
109109

110110
if (type === 'pull') {
111111
// NB: merged pull requests installable with #pull/123/merge
112112
// for the merged pr, or #pull/123 for the PR head
113-
const ref = rawRef.substr('refs/'.length).replace(/\/head$/, '')
113+
const ref = rawRef.slice('refs/'.length).replace(/\/head$/, '')
114114
return { sha, ref, rawRef, type }
115115
}
116116

0 commit comments

Comments
 (0)