maybe-config
Easy, safe configuration traversal.
maybe-config is a package designed to safely traverse configuration objects, allowing
deep trawling without fear of errors from incorrect keys, undefineds, and all the
goodness that usually comes out of working with Javascript.
maybe-config uses the concept of the Maybe monad to allow for safe traversal. The final
usage for interface by default provides plain values, but also provides Safe variants
that instead return the Maybe instance for further safe processing.
Usage
const Config = require('maybe-config');
module.exports = Config(window.myConfig);
const Config = require('./my-config');
const setting1 = Config.get('setting1');
const setting2 = Config.getIn('setting1', 'setting2');
const clientSetting = Config.getClientSetting('clientSetting');
const hasHeader = Config.getFlag('hasHeader');
const clientNameUpper = Config.getSafe('name').map(name => name.toUpperCase()).value();