dotcfg
TypeScript icon, indicating that this package has built-in type declarations

1.7.6 • Public • Published

dotcfg

Allows you to manage namespace objects with qualified names.

stability deps depsci travis appveyor

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. */

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.7.6
    1
    • latest

Version History

Package Sidebar

Install

npm i dotcfg

Weekly Downloads

62

Version

1.7.6

License

MIT

Unpacked Size

135 kB

Total Files

39

Last publish

Collaborators

  • adriancmiranda