mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:37:07 +00:00
Add deep properties getter utility function to config.
cfg._("a.deep.property") returns the value of
cfg.a.deep.property if it exists. If the property
or any of its parents do not exist, returns undefined.
This commit is contained in:
@@ -69,4 +69,6 @@ if (process.env.PGDATABASE) {
|
||||
delete config.db;
|
||||
}
|
||||
|
||||
config._ = (k) => k.split(".").reduce((a, b) => typeof a != "undefined" ? a[b] : a, config);
|
||||
|
||||
module.exports = Object.freeze(config);
|
||||
|
||||
Reference in New Issue
Block a user