0.0.5 • Published 8 years ago
simpler-config v0.0.5
simpler-config
A really simple config library.
Installation:
npm i simpler-config --save
A few examples:
// require the library and then call load once with an object to setup your config.
// You can use a JS file (don't forget module.exports)
const config = require('simpler-config').load(require('./config'))
// or a JSON file
const config = require('simpler-config').load(require('./config.json'))
// or an object
const config = require('simpler-config').load({someKey: 'Some Value'}))
// or something far too fancy
const config = require('simpler-config').load({
dev: require('./dev'),
staging: require('./staging'),
production: require('./production')
}[process.env.name])
// Right. You get the idea.
// meanwhile, in another file in a directory far far away
const config = require('simpler-config')
console.log(config.someKey)
Here's another example as well.