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

hekdi

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hekdi - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

package.json
{
"name": "hekdi",
"version": "1.4.0",
"version": "1.5.0",
"description": "Depedency injection framework for node integrated with koa.js",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -122,4 +122,3 @@ [![Build Status](https://travis-ci.org/IvanProdaiko94/hekdi.svg?branch=master)](https://travis-ci.org/IvanProdaiko94/hekdi)

{ name: 'PublicDependency', strategy: 'service', value: class Y {} },
{ name: 'Arr', strategy: 'value', value: [1, 2, 3] },
{ name: 'ZProvider', strategy: 'provider', value: () => ({ name: 'Z', strategy: 'service', value: class Z {} })}
{ name: 'Arr', strategy: 'value', value: [1, 2, 3] }
],

@@ -139,4 +138,2 @@ exports: ['PublicDependency', 'Arr'], // if '*' set, module will export all of the dependencies including imported

- `alias` - used to create an alias for some dependency.
- `provider` - function that will be called, to get dependency config.
Providers register dependencies before others do. Providers can't be exported from module.

@@ -143,0 +140,0 @@ # Koa.js usage:

@@ -51,23 +51,2 @@ 'use strict';

Injector.prototype.register = function(...dependencies) {
const providers = [];
dependencies = dependencies.filter(config => {
if (config.strategy === 'provider') {
providers.push(config);
return false;
}
return true;
});
const providersValues = providers.map(provider => {
const dConf = provider.value();
if (dConf.strategy === 'provider') {
throw new Error(errors.providerDoNotRegisterProviders(provider.name));
}
return dConf;
});
if (providersValues.length > 0) {
this.register(...providersValues);
}
dependencies.forEach(config => {

@@ -74,0 +53,0 @@ const dConf = this.getConfigOf(config.name);

@@ -9,4 +9,3 @@ 'use strict';

`strategy ${strategy} is incorrect. Allowable values are ${Object.keys(strategies).join(', ')}`
),
providerDoNotRegisterProviders: providerName => `Providers may not register providers ${providerName}`
)
};
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