*Ensure key is both not undefined and not null

This commit is contained in:
Derrick Hammer 2022-09-21 16:55:46 -04:00
parent 44b8aa18e6
commit 8b49a6ed6b
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 11 additions and 20 deletions

View File

@ -226,23 +226,19 @@ export default class Config {
key = key.replace(/-/g, ""); key = key.replace(/-/g, "");
key = key.toLowerCase(); key = key.toLowerCase();
if (this.hash[key] !== null) { if (key in this.hash && this.hash[key] !== null) {
return true; return true;
} }
if (key in this.query && this.query[key] !== null) {
if (this.query[key] !== null) {
return true; return true;
} }
if (key in this.args && this.args[key] !== null) {
if (this.args[key] !== null) {
return true; return true;
} }
if (key in this.env && this.env[key] !== null) {
if (this.env[key] !== null) {
return true; return true;
} }
if (key in this.data && this.data[key] !== null) {
if (this.data[key] !== null) {
return true; return true;
} }
@ -280,27 +276,22 @@ export default class Config {
key = key.replace(/-/g, ""); key = key.replace(/-/g, "");
key = key.toLowerCase(); key = key.toLowerCase();
if (this.hash[key] !== null) { if (key in this.hash && this.hash[key] !== null) {
return this.hash[key]; return this.hash[key];
} }
if (key in this.query && this.query[key] !== null) {
if (this.query[key] !== null) {
return this.query[key]; return this.query[key];
} }
if (key in this.args && this.args[key] !== null) {
if (this.args[key] !== null) {
return this.args[key]; return this.args[key];
} }
if (key in this.env && this.env[key] !== null) {
if (this.env[key] !== null) {
return this.env[key]; return this.env[key];
} }
if (key in this.data && this.data[key] !== null) {
if (this.data[key] !== null) {
return this.data[key]; return this.data[key];
} }
if (key in this.options && this.options[key] !== null) {
if (this.options[key] !== null) {
return this.options[key]; return this.options[key];
} }