smallbox
a lightweight container library for node.js
Last updated 3 years ago by javierav .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install smallbox 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.2.1                                ...           latest (3 years ago)

4 Versions

  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.1                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |