refactor: includes instead of indexOf (#5117)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user