Object qualified names
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
dist
source
test
.editorconfig
.eslintrc
.flowconfig
.gitattributes
.gitignore
.travis.yml
CHANGELOG.md
LICENSE
README.md
appveyor.yml
bower.json
index.js
package-lock.json
package.json

README.md

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