JS: Fix some FPs in IncorrectSuffixCheck

This commit is contained in:
Asger F
2019-05-13 08:54:07 +01:00
parent 649979de3e
commit 9293010e4c
2 changed files with 20 additions and 0 deletions

View File

@@ -79,3 +79,13 @@ function withIndexOfCheckBad(x, y) {
function plus(x, y) {
return x.indexOf("." + y) === x.length - (y.length + 1); // NOT OK
}
function withIndexOfCheckLower(x, y) {
let index = x.indexOf(y);
return !(index < 0) && index === x.length - y.length - 1; // OK
}
function withIndexOfCheckLowerEq(x, y) {
let index = x.indexOf(y);
return !(index <= -1) && index === x.length - y.length - 1; // OK
}