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

boxed-injector

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

boxed-injector - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

32

dist/Injector/Injector.js

@@ -179,25 +179,31 @@ 'use strict';

if (!this.factories[name] && !this.instances[name]) {
if (!Array.isArray(name) && !this.factories[name] && !this.instances[name]) {
return [];
}
var entity = this.factories[name] ? this.factories[name] : this.instances[name];
var entityKeys = Array.isArray(name) ? name : [name];
var deps = entityKeys.reduce(function (children, key) {
var entity = _this4.factories[key] ? _this4.factories[key] : _this4.instances[key];
return children.concat(entity.depends);
}, []);
var graph = entity.depends.reduce(function (obj, elem) {
if (!obj.hash[elem]) {
obj.all.push(elem);
obj.hash[elem] = true;
}
var graph = deps.reduce(function (obj, elem) {
var add = function add(e) {
if (!obj.hash[e]) {
obj.all.push(e);
obj.hash[e] = true;
}
};
add(elem);
var child = _this4.graph(elem, true);
child.all.forEach(function (childDep) {
if (!obj.hash[childDep]) {
obj.all.push(childDep);
obj.hash[childDep] = true;
}
add(childDep);
});
return obj;
}, { all: [], hash: {} });
}, {
all: [],
hash: {}
});

@@ -204,0 +210,0 @@ if (!nested) {

@@ -188,3 +188,2 @@ 'use strict';

injector.factory('foo', function (txt) {
console.log(txt);
this.bar = txt;

@@ -233,2 +232,5 @@ }, { depends: ['asdf'] });

}, { depends: [], function: true });
injector.factory('g', function () {
return 'g';
}, { depends: [], function: true });
injector.factory('b', function (x) {

@@ -246,2 +248,5 @@ return x;

}, { depends: ['d', 'a'], function: true });
injector.factory('f', function (x) {
return x;
}, { depends: ['d', 'g'], function: true });
expect(injector.graph('a')).toEqual([]);

@@ -254,2 +259,3 @@ expect(injector.graph('asdf')).toEqual([]);

expect(eResult).toEqual(['d', 'c', 'b', 'a']);
expect(injector.graph(['e', 'f'])).toEqual(['d', 'c', 'b', 'a', 'g']);
});

@@ -256,0 +262,0 @@ });

{
"name": "boxed-injector",
"version": "1.1.0",
"version": "1.1.1",
"description": "Dependency Injection Tools",

@@ -5,0 +5,0 @@ "homepage": "",

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