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 abetomo committed Mar 21, 2022
1 parent 8cbd082 commit 961c45e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/help.js
Expand Up @@ -387,8 +387,8 @@ class Help {
const columnWidth = width - indent;
if (columnWidth < minColumnWidth) return str;

const leadingStr = str.substr(0, indent);
const columnText = str.substr(indent);
const leadingStr = str.slice(0, indent);
const columnText = str.slice(indent);

const indentString = ' '.repeat(indent);
const regex = new RegExp('.{1,' + (columnWidth - 1) + '}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)', 'g');
Expand Down

0 comments on commit 961c45e

Please sign in to comment.