0.2.1 • Published 7 years ago

smallbox v0.2.1

Weekly downloads
6
License
MIT
Repository
github
Last release
7 years ago

smallbox

NPM

a lightweight container library for node.js

Build Status

Installation

$ npm install smallbox

Usage

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' }

Share a container between two modules

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

Testing

The library is tested using Mocha.

$ npm test

Contributing

  1. Fork it ( https://github.com/javierav/smallbox/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Versioning

smallbox uses Semantic Versioning 2.0.0

License

Copyright (c) 2016 Javier Aranda - Released under MIT license

0.2.1

7 years ago

0.2.0

9 years ago

0.1.1

10 years ago

0.0.1

10 years ago