fixes eslint errors

This commit is contained in:
Joffrey JAFFEUX 2017-06-05 15:50:15 +02:00
parent 05f8b5b72e
commit ab8a1a377c
1 changed files with 3 additions and 4 deletions

View File

@ -362,20 +362,19 @@ export default function(options) {
if (!options.key) return; if (!options.key) return;
var key = me[0].value[cp-1]; const key = me[0].value[cp-1];
if (options.onKeyUp && key !== options.key) { if (options.onKeyUp && key !== options.key) {
var match = options.onKeyUp(me.val(), cp); var match = options.onKeyUp(me.val(), cp);
if (match) { if (match) {
completeStart = cp - match[0].length; completeStart = cp - match[0].length;
completeEnd = completeStart + match[0].length - 1; completeEnd = completeStart + match[0].length - 1;
var term = match[0].substring(1, match[0].length); let term = match[0].substring(1, match[0].length);
updateAutoComplete(dataSource(term, options)); updateAutoComplete(dataSource(term, options));
} }
} }
if (completeStart === null && cp > 0) { if (completeStart === null && cp > 0) {
var key = me[0].value[cp-1];
if (key === options.key) { if (key === options.key) {
var prevChar = me.val().charAt(cp-2); var prevChar = me.val().charAt(cp-2);
if (checkTriggerRule() && (!prevChar || allowedLettersRegex.test(prevChar))) { if (checkTriggerRule() && (!prevChar || allowedLettersRegex.test(prevChar))) {
@ -384,7 +383,7 @@ export default function(options) {
} }
} }
} else if (completeStart !== null) { } else if (completeStart !== null) {
var term = me.val().substring(completeStart + (options.key ? 1 : 0), cp); let term = me.val().substring(completeStart + (options.key ? 1 : 0), cp);
updateAutoComplete(dataSource(term, options)); updateAutoComplete(dataSource(term, options));
} }
}); });