refactor: 将 Array.indexof !== -1 替换为 Array.includes (#2073)
This commit is contained in:
parent
615216868b
commit
274199e450
|
|
@ -21,12 +21,12 @@ module.exports = async (ctx, next) => {
|
|||
await next();
|
||||
} else {
|
||||
if (config.whitelist) {
|
||||
if (!(config.whitelist.indexOf(ip) !== -1 || config.whitelist.indexOf(requestPath) !== -1)) {
|
||||
if (!(config.whitelist.includes(ip) || config.whitelist.includes(requestPath))) {
|
||||
reject(ctx);
|
||||
}
|
||||
} else {
|
||||
if (config.blacklist) {
|
||||
if (config.blacklist.indexOf(ip) !== -1 || config.blacklist.indexOf(requestPath) !== -1) {
|
||||
if (config.blacklist.includes(ip) || config.blacklist.includes(requestPath)) {
|
||||
reject(ctx);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue