config-util: Add isConfigItemExists to check if a key exists.

This commit is contained in:
Abhigyan Khaund
2018-06-08 12:34:20 -07:00
committed by Akash Nimare
parent f7696cc04d
commit 339a415d60

View File

@@ -49,6 +49,16 @@ class ConfigUtil {
}
}
isConfigItemExists(key) {
this.reloadDB();
const value = this.db.getData('/')[key];
if (value === undefined) {
return false;
} else {
return true;
}
}
setConfigItem(key, value) {
this.db.push(`/${key}`, value, true);
this.reloadDB();