README
dotcfg
Allows you to manage namespace objects with qualified names.
Getting Started
Installation
npm install dotcfg --save
Links to CDN
umd
amd
iife
cjs
Use this URL for dev/testing
<script src="https://rawgit.com/adriancmiranda/dotcfg/master/dist/dotcfg.umd.js"></script>
Use this URL in production
<script src="https://cdn.rawgit.com/adriancmiranda/dotcfg/master/dist/dotcfg.umd.min.js"></script>
Usage:
const dotcfg = require('dotcfg');
const NYC = dotcfg('NYC');
// SET
// ---
NYC.cfg('env.url.host', '0.0.0.0');
// => { env:{ url:{ host:'0.0.0.0' } } }
NYC.cfg('resolve.extensions.1.name', '.js');
// => { resolve:{ extensions:{ '1':{ name:'.js' } } } }
NYC.cfg('resolve.extensions[1].name', '.js');
// => { resolve:{ extensions:[undefined, { name:'.js' }] } }
NYC.cfg('watchOptions.pool', undefined);
// => { watchOptions:{} }
NYC.cfg('process[env.NODE_ENV].type', 'DEV');
// => { process:{ 'env.NODE_ENV':{ type:'DEV' } } }
// GET
// ---
NYC.cfg('env');
// <= { url:{ host:'0.0.0.0', port:3000 } } }
NYC.cfg('env.url');
// <= { host:'0.0.0.0', port:3000 }
NYC.cfg('env.url.host');
// <= '0.0.0.0'
NYC.cfg('resolve.extensions.1');
// <= { name:'.js' }
NYC.scope.resolve.extensions[1].name;
// <= '.js'
NYC.cfg(true);
/*! true: brings a deep copy of raw object. */
NYC.cfg();
/*! false/undefined: brings dotcfg object. */