New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

di-helper

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

di-helper - npm Package Compare versions

Comparing version 2.1.0 to 2.1.2

7

lib/context.js

@@ -86,2 +86,7 @@ (function (global, factory) {

_proto.alias = function alias(key, existingKey) {
this.modules[key] = this.modules[existingKey];
return this;
};
_proto.resolve = function resolve(key, options) {

@@ -203,5 +208,5 @@ if (options === void 0) {

return Context;
}(), _class2.repo = {}, _temp), (_applyDecoratedDescriptor(_class.prototype, "addHook", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "addHook"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "provide", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "provide"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resolve", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "resolve"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resolveAll", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "resolveAll"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "using", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "using"), _class.prototype)), _class);
}(), _class2.repo = {}, _temp), (_applyDecoratedDescriptor(_class.prototype, "addHook", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "addHook"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "provide", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "provide"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "alias", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "alias"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resolve", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "resolve"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resolveAll", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "resolveAll"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "using", [_autobindDecorator.default], Object.getOwnPropertyDescriptor(_class.prototype, "using"), _class.prototype)), _class);
var _default = Context;
_exports.default = _default;
});

26

lib/hooks/LazyHook.js

@@ -40,7 +40,11 @@ (function (global, factory) {

_proto.onProvide = function onProvide(key, value, originalValue, options) {
var _wrappedValue;
if (options !== undefined && options !== null && options.lazy !== undefined) {
var _ref;
var isDisabled = options && options.lazy === false;
var wrappedValue = (_wrappedValue = {}, _wrappedValue[ENABLED] = (0, _isCallable.default)(value) && !isDisabled, _wrappedValue[VALUE] = value, _wrappedValue);
return wrappedValue;
return _ref = {}, _ref[ENABLED] = !!options.lazy, _ref[VALUE] = value, _ref;
} else {
var _ref2;
return _ref2 = {}, _ref2[ENABLED] = (0, _isCallable.default)(value), _ref2[VALUE] = value, _ref2;
}
};

@@ -51,6 +55,14 @@

if (wrappedValue[ENABLED]) {
return value();
if (options !== undefined && options !== null && options.lazy !== undefined) {
if (options.lazy) {
return value();
} else {
return _BaseHook.prototype.onResolve.call(this, key, value, originalValue, options);
}
} else {
return _BaseHook.prototype.onResolve.call(this, key, value, originalValue, options);
if (wrappedValue[ENABLED]) {
return value();
} else {
return _BaseHook.prototype.onResolve.call(this, key, value, originalValue, options);
}
}

@@ -57,0 +69,0 @@ };

@@ -17,3 +17,3 @@ (function (global, factory) {

_exports.__esModule = true;
_exports.using = _exports.resolveAll = _exports.resolve = _exports.provide = _exports.context = void 0;
_exports.using = _exports.resolveAll = _exports.resolve = _exports.alias = _exports.provide = _exports.context = void 0;
_context = _interopRequireDefault(_context);

@@ -29,2 +29,3 @@ _exports.Context = _context.default;

var provide = context.provide,
alias = context.alias,
resolve = context.resolve,

@@ -36,3 +37,4 @@ resolveAll = context.resolveAll,

_exports.resolve = resolve;
_exports.alias = alias;
_exports.provide = provide;
});
{
"name": "di-helper",
"version": "2.1.0",
"version": "2.1.2",
"description": "A concise JavaScript dependency injector",

@@ -5,0 +5,0 @@ "repository": "https://github.com/g6123/di-helper",

@@ -29,4 +29,4 @@ # di-helper

// Default instance and its methods
import { context, provide, resolve, resolveAll, using } from 'di-helper';
const { context, provide, resolve, resolveAll, using } = require('di-helper');
import { context, provide, alias, resolve, resolveAll, using } from 'di-helper';
const { context, provide, alias, resolve, resolveAll, using } = require('di-helper');

@@ -44,2 +44,6 @@ // Context class

### `alias()`
_WIP_
### `resolve()`

@@ -46,0 +50,0 @@

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