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

amend

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amend - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

25

dist/container.js

@@ -31,6 +31,7 @@ // Generated by CoffeeScript 1.8.0

module.exports = Container = (function() {
function Container(conf) {
function Container(conf, _parent) {
if (conf == null) {
conf = {};
}
this._parent = _parent;
this._modules = conf.modules || {};

@@ -63,10 +64,22 @@ this._registrations = {};

}
if (this._instances[name] == null) {
this._instantiate(name);
if (this._registeredAt(name) === 'local') {
if (this._instances[name] == null) {
this._instantiate(name);
}
return this._instances[name];
} else {
return this._parent.get(name);
}
return this._instances[name];
};
Container.prototype._registeredAt = function(name) {
if (this._registrations[name] != null) {
return 'local';
} else if ((this._parent != null) && this._parent.isRegistered(name)) {
return 'parent';
}
};
Container.prototype.isRegistered = function(name) {
return this._registrations[name] != null;
return this._registeredAt(name) !== void 0;
};

@@ -119,2 +132,4 @@

return _this._instances[d];
} else if (_this._registeredAt(d) === 'parent') {
return _this._parent._instantiate(d, name);
} else {

@@ -121,0 +136,0 @@ return _this._instantiate(d, name);

4

dist/load-config.js

@@ -41,3 +41,3 @@ // Generated by CoffeeScript 1.8.0

module.exports = function(config, basePath, opts) {
module.exports = function(config, basePath, opts, parent) {
var di, modules;

@@ -50,3 +50,3 @@ if (opts == null) {

}
di = new Container(opts);
di = new Container(opts, parent);
modules = config.modules || {};

@@ -53,0 +53,0 @@ Object.keys(modules).forEach(function(key) {

@@ -9,8 +9,8 @@ // Generated by CoffeeScript 1.8.0

function ModuleNotFound(module, parent) {
function ModuleNotFound(module, caller) {
this.module = module;
this.parent = parent;
this.caller = caller;
this.message = 'Could not find any module with name ' + module;
if (this.parent != null) {
this.message = this.message + ', required from module ' + this.parent;
if (this.caller != null) {
this.message = this.message + ', required from module ' + this.caller;
}

@@ -17,0 +17,0 @@ }

{
"name": "amend",
"version": "0.2.4",
"version": "0.2.5",
"description": "Dependency injection module and IoC container.",

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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