refactor: 将 Array.indexof !== -1 替换为 Array.includes (#2073)

This commit is contained in:
Howel 2019-05-08 23:50:34 +08:00 committed by DIYgod
parent 615216868b
commit 274199e450
1 changed files with 2 additions and 2 deletions

View File

@ -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);
}
}