···24242525```js
2626// index.js
2727-require('simpleplan')();
2828-var dependencies = {
2929- Mongoose: 'store here any object you would like',
3030- app: 'hell yeah'
3131-};
2727+var simpleplan = require('simpleplan')();
2828+simpleplan.register("Mongoose", "store here any object you would like.");
2929+simpleplan.register("app", "and it will magically injected to your favorite methods");
32303333-var myModule = require('myModule')(dependencies); // Mongoose will magically be injected into the function. wow. I know.
3131+var myModule = require('myModule')(); // Mongoose will magically be injected into the function. wow. I know.
3432```
35333634That's it.
37353836WAT
3937---
4040-simpleplan extends javascript's `Function` and provides 2 more methods: `inject()` and `use(params)`.
3838+By calling the base require of simpleplan, it extends javascript's `Function` and provides 2 more methods: `inject()` and `use(params)`.
3939+4040+### `register(key, value)`
4141+simply stores your dependencies in a key-value hash for the default dependencies.
4242+It was made for not passing a dependencies hash for every function you want to inject to.
4343+4444+```js
4545+simpleplan.register("a", { thisIs: "Its value" }); // It will be injected to any 'a' parameter
4646+ // unless it is being overriden in the function call.
4747+```
41484249### `use(params)`
4350Tells simpleplan you want to inject some dependencies to this function, with the right order.
···4956}.use("c", "b", "whoIsAwesome");
50575158somefunc({ c: "First", b: "Second", whoIsAwesome: "Gal Schlezinger" }); // "a: First, b: Second, c: Gal Schlezinger"
5959+5260```
53615462### `inject()`
···61696270somefunc({ b: "First", c: "Second", a: "Gal Schlezinger" }); // "a: Gal Schlezinger, b: First, c: Second"
6371```
7272+7373+## Don't touch my `Function`'s prototype!
7474+Well, you can also go like
7575+```js
7676+var simpleplan = require('simpleplan');
7777+var inject = simpleplan.inject,
7878+ register = simpleplan.register;
7979+8080+register("param", "Hugh Jackman!");
8181+8282+var func = inject(function(param) {
8383+ return "Who's the man? " + param;
8484+});
8585+8686+func("Gal!"); // => "Who's the man? Gal!"
8787+func(); // "Who's the man? Hugh Jackman!"
8888+```
8989+but as you can see, its not as awesome as extending `Function`.
9090+9191+CoffeeScript Usage
9292+------------------
9393+```coffeescript
9494+{ register, inject } = require 'simpleplan'
9595+9696+register "first", "Hello"
9797+register "second", "World"
9898+9999+myFunc = inject (first, second) ->
100100+ "#{first} #{second}!"
101101+102102+myFunc() # => "Hello World!"
103103+myFunc first: "wat" #=> "wat World!"
104104+```
105105+106106+Changelog
107107+---------
108108+### `0.1.0`
109109+- Added registry for stop passing the dependencies object to every method.
110110+111111+### `0.0.2`
112112+- Added CoffeeScript support (`inject ->`..)
6411365114Contributing
66115------------