New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

singular

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

singular - npm Package Compare versions

Comparing version
4.2.0-beta1
to
4.2.1-beta1
+1
-1
package.json
{
"name": "singular",
"version": "4.2.0-beta1",
"version": "4.2.1-beta1",
"description": "Application dependency injection manager",

@@ -5,0 +5,0 @@ "dependencies": {

function Factory (layout) {
this.deps = Object.assign({}, this.constructor.deps)
layout = Object.assign({}, layout)
if (! layout) {

@@ -8,2 +10,3 @@ layout = layoutFromDeps(this.deps)

var deps = this.deps
Object.getOwnPropertyNames(layout)

@@ -14,3 +17,13 @@ .forEach(function(name) {

}
else if (layout[name] === true) {
layout[name] = name
}
})
Object.getOwnPropertyNames(deps)
.forEach(function(name) {
if (! layout.hasOwnProperty(name)) {
layout[name] = name
}
})
}

@@ -17,0 +30,0 @@

const assert = require('assert')
const Singular = require('../')
const {Factory} = Singular
function createUnit({layout = {}, deps, defaults = {}, start, stop = () => {}, value} = {}) {

@@ -403,17 +405,53 @@ if (! start) {

describe('Singular.Factory.from()', () => {
it('should create functional unit factory', () => {
const factory = Singular.Factory.from({
start: () => 'factory works',
describe('Singular.Factory', function() {
describe('Factory#Factory()', () => {
it('Should complete layout', () => {
function TestFactory() {
Factory.apply(this, arguments)
}
TestFactory.deps = {
a: true,
}
Object.setPrototypeOf(TestFactory.prototype, Factory.prototype)
const unit = new TestFactory()
assert.equal(unit.layout.a, 'a', 'layout.a is a')
})
const singular = new Singular({
units: {
test: new factory(),
},
it('Should substitute names to layout', () => {
function TestFactory() {
Factory.apply(this, arguments)
}
TestFactory.deps = {
a: true,
}
Object.setPrototypeOf(TestFactory.prototype, Factory.prototype)
const unit = new TestFactory({a: true})
assert.equal(unit.layout.a, 'a', 'layout.a is a')
})
})
return singular.start(1)
.then(({scope}) => {
assert.equal(scope.test, 'factory works', 'unit is initialized')
describe('from()', () => {
it('should create functional unit factory', () => {
const factory = Factory.from({
start: () => 'factory works',
})
const singular = new Singular({
units: {
test: new factory(),
},
})
return singular.start(1)
.then(({scope}) => {
assert.equal(scope.test, 'factory works', 'unit is initialized')
})
})

@@ -420,0 +458,0 @@ })