Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

law

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

law - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc