a lightweight container library for node.js
$ npm install smallbox
var container = require('smallbox');
// register components
container.define('user:name', 'Javier');
container.define('user:surname', 'Aranda');
container.define('files:storage', 's3');
// get components
if ( container.has('user:name') ) {
console.log( container.require('user:name') );
}
// using wildcard
container.require('user:*'); //=> { 'user:name': 'Javier', 'user:surname': 'Aranda' }
// module_a.js
var container = require('smallbox');
container.define('user:location', 'Spain');
// module_b.js
var container = require('smallbox');
container.require('user:location'); // => 'Spain'
More examples are available inside the code or tests.
The library is tested using Mocha.
$ npm test
- Fork it ( https://github.com/javierav/smallbox/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
smallbox uses Semantic Versioning 2.0.0
Copyright (c) 2016 Javier Aranda - Released under MIT license