-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
executable file
·25 lines (24 loc) · 1.11 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* index.js
*
* Created on: November 9, 2013
* Author: Valeri Karpov
*
* Exposes a simple yet flexible API for constructing dependencies in NodeJS:
*
* 1) register: Takes a name and object. The inject() function will then pass
* that object as a parameter to functions which take `name` as
* a parameter.
* 2) inject: Given a factory function, assembles the parameters necessary for
* that function, calls it, and returns the result. If the
* parameter name hasn't been registered, throw an exception.
* 3) injectAndRegister: Given a name and a factory function, register the
* result of calling inject on the factory to `name`.
* 4) get: Return the object registered to the given name.
* 5) assemble: Given a list of lists, run injectAndRegister on each element
* in order. Can think of this function as building up a
* dependency graph with each list representing levels of a
* topologically sorted DAG.
*
*/
module.exports = require('./dependency_injector.js').DependencyInjector;