Skip to content
Myr

refactor: replace deprecated String.prototype.substr()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

.substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

authored by Tobias Speicher · committed by Abe Tomoaki · parent 8cbd082 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Tobias Speicher <rootcommander@gmail.com>

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:lib/help.js+2 added-2 removed
385 unmodified lines
386 // Do not wrap if not enough room for a wrapped column of text (as could end up with a word per line).387 const columnWidth = width - indent;388 if (columnWidth < minColumnWidth) return str;389390 const leadingStr = str.substr(0, indent);391 const columnText = str.substr(indent);390 const leadingStr = str.slice(0, indent);391 const columnText = str.slice(indent);392393 const indentString = ' '.repeat(indent);394 const regex = new RegExp('.{1,' + (columnWidth - 1) + '}([\\s\u200B]|$)|[^\\s\u200B]+?([\\s\u200B]|$)', 'g');395 const lines = columnText.match(regex) || [];
10 unmodified lines