From e6d1bfdee11c0f93bcfd6fc98d4e5548abce280d Mon Sep 17 00:00:00 2001 From: Tobias Speicher Date: Mon, 21 Mar 2022 10:41:51 +0100 Subject: [PATCH] refactor: 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 --- lib/rules_block/table.js | 2 +- lib/rules_core/smartquotes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rules_block/table.js b/lib/rules_block/table.js index 7d9208f..3cb416f 100644 --- a/lib/rules_block/table.js +++ b/lib/rules_block/table.js @@ -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) { diff --git a/lib/rules_core/smartquotes.js b/lib/rules_core/smartquotes.js index e96fc71..42d6851 100644 --- a/lib/rules_core/smartquotes.js +++ b/lib/rules_core/smartquotes.js @@ -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) {