refactor: includes instead of indexOf (#5117)

This commit is contained in:
btea
2022-01-21 01:36:48 -06:00
committed by GitHub
parent c64907d261
commit 63210fe41a
4 changed files with 7 additions and 7 deletions

View File

@@ -157,7 +157,7 @@ export function legacyCheckKeyCodes(
function isKeyNotMatch<T>(expect: T | T[], actual: T): boolean {
if (isArray(expect)) {
return expect.indexOf(actual) === -1
return !expect.includes(actual)
} else {
return expect !== actual
}

View File

@@ -345,7 +345,7 @@ function matches(pattern: MatchPattern, name: string): boolean {
if (isArray(pattern)) {
return pattern.some((p: string | RegExp) => matches(p, name))
} else if (isString(pattern)) {
return pattern.split(',').indexOf(name) > -1
return pattern.split(',').includes(name)
} else if (pattern.test) {
return pattern.test(name)
}