Replace deprecated String.prototype.substr()

.substr() is deprecated 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:
Tobias Speicher 2022-04-21 18:42:42 +02:00
parent 6412156210
commit e0486e49c6
No known key found for this signature in database
GPG key ID: 2CF824BD810C3BDB
3 changed files with 4 additions and 4 deletions

View file

@ -70,7 +70,7 @@ export default class TableOfContents {
tocHtml += '<li>';
// remove parent directory reference from href to fix certain books
const link = chapter.href.startsWith('../') ? chapter.href.substr(3) : chapter.href;
const link = chapter.href.startsWith('../') ? chapter.href.slice(3) : chapter.href;
tocHtml += `<a href="${rendition.book.path.directory + link}">${chapter.label}</a>`;
tocHtml += '</li>';
});