typeahead: Replace substring with slice.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md
This commit is contained in:
evykassirer
2024-03-01 19:26:01 -08:00
committed by Tim Abbott
parent d131f4119f
commit 827b42dd9f

View File

@@ -198,7 +198,7 @@ import {get_string_diff} from "../../src/util";
this.$element.val(), this.$element.val(),
after_text, after_text,
); );
const replacement = after_text.substring(from, to_after); const replacement = after_text.slice(from, to_after);
// select / highlight the minimal text to be replaced // select / highlight the minimal text to be replaced
this.$element[0].setSelectionRange(from, to_before); this.$element[0].setSelectionRange(from, to_before);
insertTextIntoField(this.$element[0], replacement); insertTextIntoField(this.$element[0], replacement);