{"_id":"q-di","_rev":"60-20b625aacf0ff488bf3e7f7aac044e0a","name":"q-di","description":"Asynchronous dependency injection using Q promises","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"q-di","version":"0.1.0","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nAsynchronous dependency injection using Q Promises\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.0","dist":{"shasum":"51245ae3673795cdf431be14deb8c2960e3b96b6","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.0.tgz","integrity":"sha512-PthcWoMEXSXsoQBJUF0buN6SbCUFSJ1jC6j1Ax2xblazTIH7m0JNmXpVHIlaF7X6P3KC940DCb0gGyvLkfYfzg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC84CHw34X7b6Gz7jzMwiEToHe4UlyCf0mMRP5bDQ6R9AIhAIWenW+wMLyf2bygmad/3nbAHTeNq6+l+69XdxmkWF6l"}]},"_from":"./","_npmVersion":"1.3.14","_npmUser":{"name":"allenc256","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc256","email":"allenc256@yahoo.com"}],"directories":{}},"0.1.1":{"name":"q-di","version":"0.1.1","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nMinimalistic dependency injection capable of handling asynchronous dependencies (using the promise library [Q](http://github.com/kriskowal/q)). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function, where the arguments to the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Promises/asynchrony\n\nMost importantly, dependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, you might want to define a module where the `server` object depends on a `database` object which needs to first establish a connection to the database before it's initialized.\n\nThat's the entire API!\n\n## Notes\n\n### Constants\n\nDependencies can be specified as constants instead of functions. The following is a valid module specification:\n\n```coffeescript\nMODULE = {\n  foo : 'foo' # constant\n  bar : (foo) -> foo + 'bar'\n}\n```\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.1","dist":{"shasum":"0edde4fa7ca7b23c23e90850b026fc5fc145c183","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.1.tgz","integrity":"sha512-qxtrvANibdFaKZ3pAEiPgsZazlyse77O14eoHUsXjnlk+U8tObnUUob0FSNvUPzP7cMKQglQ1eUMgvtmSO5g8w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDJUpQrGhuG9dwpS/lfV7Vdca26+p6xrLUkvWpe+BRYdwIgCkotxWMW54B+QrujbU9L1TiF7y7Hha/BZvJK3ErVURY="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.1.2":{"name":"q-di","version":"0.1.2","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nMinimalistic dependency injection capable of handling asynchronous dependencies (using the promise library [Q](http://github.com/kriskowal/q)). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function, where the arguments to the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods or colons in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeee\nMODULE = {\n  server: {\n    deps   : ['cache', 'database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Promises/asynchrony\n\nMost importantly, dependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, you might want to define a module where the `server` object depends on a `database` object which needs to first establish a connection to the database before it's initialized.\n\nThat's the entire API!\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.2","dist":{"shasum":"04e83387764fd51d8338d9e2c6c2e60d153629b9","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.2.tgz","integrity":"sha512-EQyZnhokguybKrAfacfvsEAs5NzpHahi7eBWwffEhINHhzkx6R/baeBMwPMFPmDSi/vtcMcSyeDSkzU74LQkWg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHDS5uK+se67QBg6KJGHgvqr0p6MdGiSgYyASCh+9xMFAiAMQ50Bh6opUvrx0HTlJ9MOz9aWSZahTyCPdOti4SlJ9w=="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.1.3":{"name":"q-di","version":"0.1.3","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nMinimalistic dependency injection capable of handling asynchronous dependencies (using the promise library [Q](http://github.com/kriskowal/q)). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function, where the arguments to the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods or colons in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeescript\nMODULE = {\n  server: {\n    deps   : ['cache', 'database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Promises/asynchrony\n\nMost importantly, dependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, you might want to define a module where the `server` object depends on a `database` object which needs to first establish a connection to the database before it's initialized.\n\nThat's the entire API!\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.3","dist":{"shasum":"168d3989d9c3210187b11a3b7595a88f445aaeba","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.3.tgz","integrity":"sha512-Zbu0mUVnkisXBGRfujEkDe6My1CfGDCMtCHfXGt8CLvOEpLmXWIzQlGKzjzAC00P53KWgzcnss/cmel66WMV5Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA11DTbIFKsq5JxWFl2I0YBd4VTrreAY746N5pO781OWAiAnxaWGxTw8FDiBKZKMNff+bWjfbFYS4w081iod3f8Wzw=="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.1.4":{"name":"q-di","version":"0.1.4","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nMinimalistic dependency injection capable of handling asynchronous dependencies (using the promise library [Q](http://github.com/kriskowal/q)). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function, where the arguments to the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods or colons in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeescript\nMODULE = {\n  server: {\n    args   : ['cache', 'database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Promises/asynchrony\n\nMost importantly, dependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, you might want to define a module where the `server` object depends on a `database` object which needs to first establish a connection to the database before it's initialized.\n\nThat's the entire API!\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.4","dist":{"shasum":"f335144b989f78a192199adbdfeee1f94fc18479","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.4.tgz","integrity":"sha512-4sy6oxCgMqjB+M2DKKFHyDNgPKoPZJkBY7Qt9Ndm6kkwmJ4v2UqdDjHhKYGpiShOtaU8/BOhICsk9gSFifv7Qg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICuEoFHn5XAQPPvqjRJbJkFWai6a3x8Uo9jLFVsFTZO3AiA6NLJqmRAN68eKGTqpb6j4/vk+GxNR37M5fqWo5YHxxA=="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.1.5":{"name":"q-di","version":"0.1.5","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nMinimalistic dependency injection capable of handling asynchronous dependencies (using the promise library [Q](http://github.com/kriskowal/q)). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function, where the arguments to the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods or colons in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeescript\nMODULE = {\n  server: {\n    args   : ['cache', 'database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Promises/asynchrony\n\nMost importantly, dependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, you might want to define a module where the `server` object depends on a `database` object which needs to first establish a connection to the database before it's initialized.\n\nThat's the entire API!\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.5","dist":{"shasum":"0d3ac70cd5a4c7ffabaa9c914491197e50f45a79","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.5.tgz","integrity":"sha512-e6KMBdzV248Hfk4Y9icJVwdxZ9H8Bl3DHDOc5RgeNWu8EitZkORCdQNas9InqQ+47Z8lbYRQpVqje2l13qmijw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFSAErVmxyL/7jWdCZO+MRSp6f//dJl4dcjxLYRmdWbgIhAK0M6hebiGzsyNdrLEgPBNuAI/r7AVi8DyVx60ZJKNWx"}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.1.6":{"name":"q-di","version":"0.1.6","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nMinimalistic dependency injection capable of handling asynchronous dependencies (using the promise library [Q](http://github.com/kriskowal/q)). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function, where the arguments to the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods or colons in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeescript\nMODULE = {\n  server: {\n    args   : ['cache', 'database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Promises/asynchrony\n\nMost importantly, dependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, you might want to define a module where the `server` object depends on a `database` object which needs to first establish a connection to the database before it's initialized.\n\nThat's the entire API!\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.1.6","dist":{"shasum":"c4c04c0954c42945ac5993bb0caebe54d1ee219f","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.1.6.tgz","integrity":"sha512-4s5UIJr/yibndrI0JqH+9oRimJWaMaRJ18bqIuzKivRcwsY97SE1cqL+EAonkeNcH69M3SV605FuAcmRD0GStg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSkyUr03xod63C5cd7MMdILvuhK5OLlXxFnHepa/gzfwIhAJaOB7S1plzsqPXqjd3cAsUoBnFR3fdvQ+E2ujAEccmj"}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.2.0":{"name":"q-di","version":"0.2.0","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7","lodash":"~2.4.1"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nDependency injection capable of handling asynchronous dependencies using the promise library [Q](http://github.com/kriskowal/q). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function. The arguments of the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeescript\nMODULE = {\n  server: {\n    args   : ['services.cache', 'services.database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Hierarchical dependencies\n\nDependency names containing periods ('.') can be treated hierarchically if the `hierarchical` flag is set to `true`, as below:\n\n```coffeescript\nMODULE = {\n  'services.component1' : -> new MyComponent1()\n  'services.component2' : -> new MyComponent2()\n  'services.component3' :\n    args   : ['services.component1', 'services.component2']\n    create : (c1, c2) -> new MyComponent3(c1, c2)\n}\n\ninjector = new di.Injector(MODULE, { hierarchical: true })\n\n# Returns promise for services \"container object\" containing the 3 components.\ninjector.services()\n\n# Returns promise for component 1.\ninjector['services.component1']()\n```\n\nThis introduces implicit \"container object\" dependencies into the created injector which will automatically create all dependencies within the container when invoked. Containers can be nested arbitrarily deep:\n\n```coffeescript\ninjector = new di.Injector({\n  'foo.bar.baz' : -> ...\n}, { hierarchical: true })\n\n# Returns promise for bar container.\ninjector.foo().then -> foo.bar\n\n# Also returns promise for bar container.\ninjector['foo.bar']() \n```\n\nThis is another feature which can be useful when organizing larger codebases.\n\n### Promises/asynchrony\n\nDependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, your `server` object might depend on a `database` object which needs to first establish a connection to the database before it's initialized.\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.2.0","dist":{"shasum":"3525188f611af1067d4a55c25088b774b985e201","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.2.0.tgz","integrity":"sha512-XMC/ej6ZVp2cQAA9D1MaZm9lQW4aTC+qIFqoNt1Kt6td6PX+mJCwNUwsjk2xhYF+jwUx76YK3URpCqKWoZrMnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEIIODQyOJeDApZA/jwugkyM3GdhXZ0qWgLybLChlBalAiEA+Y3V2+bhz+w0G99OhLiyPv4HYX8yG7Cd/Hy++oEcNAU="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"directories":{}},"0.2.1":{"name":"q-di","version":"0.2.1","description":"Asynchronous dependency injection using Q promises","main":"lib/index.js","repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"scripts":{"test":"mocha"},"dependencies":{"q":"~0.9.7","lodash":"~2.4.1"},"devDependencies":{"coffee-script":"~1.6.3","mocha":"~1.16.2","coffee-errors":"~0.8.5","grunt":"~0.4.2","grunt-contrib-coffee":"~0.8.0"},"keywords":["di","dependency","injector","injection","q","async","promise"],"license":"MIT","readme":"q-di\n====\n\nDependency injection capable of handling asynchronous dependencies using the promise library [Q](http://github.com/kriskowal/q). Some inspiration drawn from the Java DI frameworks [Guice](https://code.google.com/p/google-guice/) and [Dagger](http://square.github.io/dagger/).\n\n## How to use\n\nA set of dependencies (henceforth referred to as a \"module\") is specified via a Javascript object. Each dependency is a named function. The arguments of the function specify the prerequisite dependencies that must be satisfied before the dependency itself can be satisfied. A module for a hypothetical server might look like (source code in [CoffeeScript](http://coffeescript.org/) for succinctness):\n\n```coffee\nMODULE = {\n  server  : (cache, database) -> new MyServer(cache, database)\n  cache   : -> new MyCache()\n  database: -> new MyDatabase()\n}\n```\n\nHere we see that constructing a `server` object depends on first constructing a `cache` object and a `database` object. To actually construct a `server` object, we need to create an `Injector` and call the correspondingly named function on it:\n\n```coffeescript\ndi = require('q-di')\ninjector = new di.Injector(MODULE)\ninjector.server() # construct a server (returns a Q promise)\n```\n\n### Promises/asynchrony\n\nDependencies can return promises instead of raw values. For example, the following module introduces a 100 ms delay when constructing a `foo` object:\n\n```coffeescript\nMODULE = {\n  foo : -> Q.delay(100).then(-> 'foo')\n}\n\n# Prints \"foobar\" (after 100 ms):\nnew di.Injector(MODULE).foo().done((result) -> console.log(result))\n```\n\nThe above example is contrived, but more realistically, some of your components may need to perform IO asynchronously before they are fully initialized. For example, your `server` object might depend on a `database` object which needs to first establish a connection to the database before it's initialized.\n\n### Explicit argument names\n\nNames of dependency arguments can also be specified explicitly, as shown below. This method for specifying dependencies might be useful if you want to use periods in your dependency names (e.g., to namespace things, such as 'server.backend.cache'):\n\n```coffeescript\nMODULE = {\n  server: {\n    args   : ['services.cache', 'services.database']\n    create : (c, d) -> new MyServer(c, d)\n  }\n  # ...\n}\n```\n\n### Hierarchical dependencies\n\nDependency names containing periods ('.') can be treated hierarchically if the `hierarchical` flag is set to `true`, as below:\n\n```coffeescript\nMODULE = {\n  'services.component1' : -> new MyComponent1()\n  'services.component2' : -> new MyComponent2()\n  'services.component3' :\n    args   : ['services.component1', 'services.component2']\n    create : (c1, c2) -> new MyComponent3(c1, c2)\n}\n\ninjector = new di.Injector(MODULE, { hierarchical: true })\n\n# Returns promise for services \"container object\" containing the 3 components.\ninjector.services()\n\n# Returns promise for component 1.\ninjector['services.component1']()\n```\n\nThis introduces implicit \"container object\" dependencies into the created injector which will automatically create all dependencies within the container when invoked. Containers can be nested arbitrarily deep:\n\n```coffeescript\ninjector = new di.Injector({\n  'foo.bar.baz' : -> ...\n}, { hierarchical: true })\n\n# Returns promise for bar container.\ninjector.foo().then -> foo.bar\n\n# Also returns promise for bar container.\ninjector['foo.bar']() \n```\n\nThis is another feature which can be useful when organizing larger codebases.\n\n## Notes\n\n### Scoping\n\nAll constructed objects are singleton-scoped to the injector. This means that calling a method on an injector multiple times will return the same instance of the object (actually, promise), e.g. the following returns true:\n\n```coffeescript\ninjector.foo() == injector.foo() # always equal\n```\n\nObjects are not shared across injectors, however, e.g. if injector1 and injector2 are separate objects:\n\n```coffeescript\ninjector1.foo() != injector2.foo() # never equal\n```\n\n### Cycles\n\nCyclic dependencies will result in an error being thrown, e.g. the following fails:\n\n```coffeescript\nnew di.Injector({ foo: (foo) -> }).foo() # throws error\n```\n\n### Promise coercion\n\nThe Q library is compatible with many other promise implementations (as long as they follow the [Promises/A+ specification](http://promises-aplus.github.io/promises-spec/)). This means module dependencies may return non-Q promises. Note, however, that the injector will always coerce such promises into Q promises.\n","readmeFilename":"README.md","bugs":{"url":"https://github.com/allenc256/q-di/issues"},"homepage":"https://github.com/allenc256/q-di","_id":"q-di@0.2.1","dist":{"shasum":"844f0f5a917c145da5802fe03a27555174d155c6","tarball":"https://registry.npmjs.org/q-di/-/q-di-0.2.1.tgz","integrity":"sha512-NHR530mxEJFuwtOXScEEpwMG7ULfQmfXhWb1rL6ILW2mRYqLM8iT0kkDm06aFx7k8RuJ7tgAOluTYVg/Cf3qgA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGRtVqB0mT59AGXYYFOTm9ZWBD/B7xR1QBooR8wI2GS/AiB9FjjGGZshDYF+qtTbsoEAqCnwSvqY3YfF6slG6iwElg=="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"allenc","email":"allenc256@yahoo.com"},"maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}]}},"readme":"q-di\n====\n\nAsynchronous dependency injection using Q Promises\n","maintainers":[{"name":"allenc","email":"allenc256@yahoo.com"}],"time":{"modified":"2022-06-25T03:19:16.869Z","created":"2014-01-01T20:17:52.565Z","0.1.0":"2014-01-01T20:17:53.319Z","0.1.1":"2014-01-02T02:29:36.011Z","0.1.2":"2014-01-06T02:38:29.813Z","0.1.3":"2014-01-06T19:20:00.535Z","0.1.4":"2014-01-06T23:17:46.906Z","0.1.5":"2014-01-07T05:33:45.014Z","0.1.6":"2014-01-07T05:53:47.065Z","0.2.0":"2014-01-12T21:51:33.855Z","0.2.1":"2014-01-12T21:54:12.686Z"},"repository":{"type":"git","url":"git://github.com/allenc256/q-di.git"},"users":{"mpinteractiv":true}}