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.1.2 to 1.1.3

4

docs/koa.md

@@ -32,3 +32,3 @@ # Koa.js usage:

// now di is already bootstrapped and ready to work.
// In koa app you can right di as `app.context.di`
// In koa app you can reach di as `app.context.di`
// In di you can get koa app as `App` dependency.

@@ -95,2 +95,2 @@ app.use({

app.listen(3004);
```
```
{
"name": "hekdi",
"version": "1.1.2",
"version": "1.1.3",
"description": "Depedency injection framework for node.js",

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

@@ -10,7 +10,7 @@ /**

/**
* @param ctx {Object}
* @param app {Object}
* @param original {Function}
* @returns {Function}
*/
const diResolver = function(ctx, original) {
const diResolver = function(app, original) {
/** @param diConfig {Function|String|Object<{controller: string, action: string, [params]: Array}>} */

@@ -20,8 +20,8 @@ return function(diConfig) {

case 'string':
original.call(ctx, ctx.context.di.resolve(diConfig));
original.call(app, app.context.di.resolve(diConfig));
break;
case 'object': // array
case 'object':
const { controller, action, params } = diConfig;
const dependency = ctx.context.di.resolve(controller);
original.call(ctx, async (ctx, next) => {
original.call(app, async (ctx, next) => {
const dependency = app.context.di.resolve(controller);
if (next) {

@@ -35,5 +35,5 @@ await dependency[action](ctx, next, params);

default: // function
original.call(ctx, diConfig);
original.call(app, diConfig);
}
return ctx;
return app;
};

@@ -58,6 +58,6 @@ };

break;
case 'object': // array
case 'object':
const { controller, action, params } = diConfig;
const dependency = app.context.di.resolve(controller);
original.call(ctx, path, async (ctx, next) => {
const dependency = app.context.di.resolve(controller);
if (next) {

@@ -64,0 +64,0 @@ await dependency[action](ctx, next, params);

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