diff options
author | CommanderRoot <CommanderRoot@users.noreply.github.com> | 2022-04-04 18:19:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-04 12:19:45 -0400 |
commit | 0ec695e036dab45d57598f451266bd0b176df9fd (patch) | |
tree | 0b68486138f3ec36bdba2f58f3f8db41e5bae6a9 /app/javascript/mastodon/features/status | |
parent | 80ded02a4bd2ea6d5b9b69198753063224773f66 (diff) |
Replace deprecated String.prototype.substr() (#17949)
* Replace deprecated String.prototype.substr() .substr() is deprecated so we replace it with .slice() which works similarily but isn't deprecated * Change String.prototype.substring() to String.prototype.slice() .substring() and .slice() work very similary but .slice() is a bit faster and stricter * Add ESLint rule to forbid usage of .substr and .substring .substr() is deprecated and .substring() is very similar to .slice() so better to use .slice() at all times Signed-off-by: Tobias Speicher <rootcommander@gmail.com>
Diffstat (limited to 'app/javascript/mastodon/features/status')
-rw-r--r-- | app/javascript/mastodon/features/status/components/card.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/status/components/card.js b/app/javascript/mastodon/features/status/components/card.js index 90f9ae7ae..3d81bcb29 100644 --- a/app/javascript/mastodon/features/status/components/card.js +++ b/app/javascript/mastodon/features/status/components/card.js @@ -32,7 +32,7 @@ const trim = (text, len) => { return text; } - return text.substring(0, cut) + (text.length > len ? '…' : ''); + return text.slice(0, cut) + (text.length > len ? '…' : ''); }; const domParser = new DOMParser(); |