Comparing version 0.1.1 to 0.1.2
{ | ||
"name":"law", | ||
"description":"Tools to create policy and validations for services.", | ||
"version":"0.1.1", | ||
"version":"0.1.2", | ||
"homepage":"http://github.com/TorchlightSoftware/law", | ||
@@ -6,0 +6,0 @@ "repository":"git://github.com/TorchlightSoftware/law.git", |
@@ -91,2 +91,34 @@ # Law | ||
## Dependencies | ||
Since version 0.1.1 Law supports declarative dependency injection. The two built in loaders are: | ||
* services: call sibling services | ||
* lib: a shortcut to require | ||
This lets us do static analysis of dependencies, and can be used as a way of making side effects explicit. | ||
```coffee-script | ||
module.exports = | ||
required: ['sessionId'] | ||
dependencies: | ||
services: ['aHelperService'] | ||
lib: ['lodash'] | ||
service: (args, done, {services, require}) -> | ||
args = lib.lodash.merge {myOpt: 1}, args | ||
services.aHelperService args, done | ||
``` | ||
To add more loaders, just plug in a resolvers object when you load your services: | ||
```coffee-script | ||
resolvers = { | ||
myLoader: (name) -> loadIt(name) | ||
} | ||
law.create services, jargon, policy, resolvers | ||
``` | ||
## Value | ||
@@ -93,0 +125,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46734
237