Skip to content

Commit

Permalink
refactor: replace deprecated String.prototype.substr()
Browse files Browse the repository at this point in the history
.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated

Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
  • Loading branch information
CommanderRoot authored and rlidwka committed Apr 18, 2022
1 parent f523514 commit e6d1bfd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/rules_block/table.js
Expand Up @@ -9,7 +9,7 @@ function getLine(state, line) {
var pos = state.bMarks[line] + state.tShift[line],
max = state.eMarks[line];

return state.src.substr(pos, max - pos);
return state.src.slice(pos, max);
}

function escapedSplit(str) {
Expand Down
2 changes: 1 addition & 1 deletion lib/rules_core/smartquotes.js
Expand Up @@ -13,7 +13,7 @@ var APOSTROPHE = '\u2019'; /* ’ */


function replaceAt(str, index, ch) {
return str.substr(0, index) + ch + str.substr(index + 1);
return str.slice(0, index) + ch + str.slice(index + 1);
}

function process_inlines(tokens, state) {
Expand Down

0 comments on commit e6d1bfd

Please sign in to comment.