refactor: move getSetting from background.js -> helpers.js

this is because i plan to use it in `detailsInterface.js`
This commit is contained in:
2022-11-05 21:30:49 -07:00
parent 55889b8f61
commit 4c7d3533a3
2 changed files with 22 additions and 21 deletions

View File

@@ -11,12 +11,32 @@ const BrowserpassURL = require("@browserpass/url");
module.exports = {
prepareLogins,
filterSortLogins,
getSetting,
ignoreFiles,
makeTOTP,
};
//----------------------------------- Function definitions ----------------------------------//
/**
* Get most relevant setting value
*
* @param string key Setting key
* @param object login Login object
* @param object settings Settings object
* @return object Setting value
*/
function getSetting(key, login, settings) {
if (typeof login.settings[key] !== "undefined") {
return login.settings[key];
}
if (typeof settings.stores[login.store.id].settings[key] !== "undefined") {
return settings.stores[login.store.id].settings[key];
}
return settings[key];
}
/**
* Get the deepest available domain component of a path
*