Rewrite `indexOf(...) === -1` ⇒ `includes`

JavaScript pattern

ES7 introduced the includes method for arrays so bitwise and comparisons to -1 are no longer needed.

Transforms indexOf

BEFORE
!~foo.indexOf("a");

foo.indexOf("a") === -1;

foo.indexOf("a") == -1;

foo.indexOf("a") !== -1;

foo.indexOf("a") != -1;

~foo.indexOf("a");
AFTER
!foo.includes("a");

!foo.includes("a")

!foo.includes("a")

foo.includes("a")

foo.includes("a")

foo.includes("a")

Transforms lastIndexOf

BEFORE
!~foo.lastIndexOf("a");

foo.lastIndexOf("a") === -1;

foo.lastIndexOf("a") == -1;

foo.lastIndexOf("a") !== -1;

foo.lastIndexOf("a") != -1;

~foo.lastIndexOf("a");
AFTER
!foo.includes("a");

!foo.includes("a")

!foo.includes("a")

foo.includes("a")

foo.includes("a")

foo.includes("a")

Does not change lastIndexOf or indexOf if it checks for a real index

JAVASCRIPT
foo.lastIndexOf("") == 1;

foo.indexOf("") == 1;