New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.9 to 0.3.0-beta-1

41

dist/container.js

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

module.exports = Container = (function() {
function Container(conf, _parent) {
function Container(conf, _parents) {
if (conf == null) {
conf = {};
}
this._parent = _parent;
this._parents = _parents != null ? _parents : [];
this._modules = conf.modules || {};

@@ -61,6 +61,8 @@ this._registrations = {};

Container.prototype.get = function(name) {
var registeredAt;
if (!this.isRegistered(name)) {
throwNotFound(name);
}
if (this._registeredAt(name) === 'local') {
registeredAt = this._registeredAt(name);
if (registeredAt === 'local') {
if (this._instances[name] == null) {

@@ -71,3 +73,3 @@ this._instantiate(name);

} else {
return this._parent.get(name);
return this._parents[registeredAt].get(name);
}

@@ -77,6 +79,16 @@ };

Container.prototype._registeredAt = function(name) {
var i, p, parentIndex, _i, _len, _ref;
if (this._registrations[name] != null) {
return 'local';
} else if ((this._parent != null) && this._parent.isRegistered(name)) {
return 'parent';
} else {
i = 0;
_ref = this._parents;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
p = _ref[_i];
if (p._registeredAt(name) === 'local') {
parentIndex = i;
}
i++;
}
return parentIndex;
}

@@ -98,4 +110,7 @@ };

Container.prototype.loadAll = function() {
if (this._parent != null) {
this._parent.loadAll();
var p, _i, _len, _ref;
_ref = this._parents;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
p = _ref[_i];
p.loadAll();
}

@@ -136,6 +151,10 @@ return Object.keys(this._registrations).forEach((function(_this) {

return function(depName) {
if (_this._registeredAt(depName) === 'parent') {
return _this._parent.get(depName);
var registeredAt;
registeredAt = _this._registeredAt(depName);
if (registeredAt === 'local') {
return _this._instances[depName] || _this._instantiate(depName, name);
} else if (registeredAt != null) {
return _this._parents[registeredAt].get(depName);
} else {
return _this._instances[depName] || _this._instantiate(depName, name);
return throwNotFound(depName, name);
}

@@ -142,0 +161,0 @@ };

@@ -41,7 +41,5 @@ // Generated by CoffeeScript 1.8.0

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

@@ -48,0 +46,0 @@ throw new TypeError('No configuration was provided for loadConfig');

{
"name": "amend",
"version": "0.2.9",
"version": "0.3.0-beta-1",
"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

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