Replace indexOf with includes (#6967)

* Replace `indexOf` with `includes`

* Add `unicorn/prefer-includes`
This commit is contained in:
fisker Cheung authored and Simon Lydell committed 2019-11-17 11:06:14 +01:00
1 parent 93c63fde18
commit 57f0dd56dd
27 files changed
+242 -77

No files matched your search

+3 -4
View File
@@ -7,10 +7,9 @@ export function read() {
}
// backwards support for old json encoded URIComponent
const decode =
hash.indexOf("%7B%22") !== -1
? decodeURIComponent
: LZString.decompressFromEncodedURIComponent;
const decode = hash.includes("%7B%22")
? decodeURIComponent
: LZString.decompressFromEncodedURIComponent;
try {
return JSON.parse(decode(hash));