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>
This commit is contained in:
@ -124,7 +124,7 @@ function search(value, { emojisToShowFilter, maxResults, include, exclude, custo
|
||||
for (let id in aPool) {
|
||||
let emoji = aPool[id],
|
||||
{ search } = emoji,
|
||||
sub = value.substr(0, length),
|
||||
sub = value.slice(0, length),
|
||||
subIndex = search.indexOf(sub);
|
||||
|
||||
if (subIndex !== -1) {
|
||||
|
Reference in New Issue
Block a user