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

@knowark/injectarkjs

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knowark/injectarkjs - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

lib/index.js

14

lib/injectark.js

@@ -60,3 +60,3 @@ import { Factory } from './factory.js' // eslint-disable-line

const dependencyInstances = []
for (const dependency of dependencies) {

@@ -68,9 +68,8 @@ const dependencyInstance = this.resolve(dependency)

} else {
instance = (this.parent ?
this.parent._dependencyBuild(resource, persist) :
instance)
const resourceStrategy = this.strategy[resource] || {}
persist = (persist && resourceStrategy['unique'])
instance = (this.parent
? this.parent._dependencyBuild(resource, persist)
: instance)
const resourceStrategy = this.strategy[resource] || {}
persist = (persist && resourceStrategy['unique'])
}

@@ -84,3 +83,2 @@

}
}
{
"name": "@knowark/injectarkjs",
"version": "0.2.0",
"version": "0.3.0",
"description": "Dependency Injector for Javascript",
"main": "index.js",
"main": "lib/index.js",
"scripts": {
"clear": "rm -rf node_modules/",
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text babel-node tests/run.js"
"test": "jest --coverage"
},

@@ -46,5 +46,5 @@ "repository": {

"cross-env": "^5.2.0",
"jasmine": "^3.3.1",
"nyc": "^13.2.0"
}
"jest": "^24.1.0"
},
"dependencies": {}
}
import { Factory } from '../lib/factory.js'
describe('Factory interface', function () {
let factory = null
beforeEach(function () {
factory = new Factory()
})
describe('Factory interface', function () {
beforeEach(function () {
this.factory = new Factory()
})
it('has an abstract extract method', function () {
try {
this.factory.extract('factoryMethod')
} catch(error) {
expect(error).toBeTruthy()
}
})
})
it('has an abstract extract method', function () {
try {
factory.extract('factoryMethod')
} catch (error) {
expect(error).toBeTruthy()
}
})
})

@@ -67,20 +67,21 @@ import { Injectark } from '../lib/injectark.js'

describe('Injectark default', function () {
let injector = null
beforeEach(function () {
this.injector = new Injectark()
injector = new Injectark()
})
it('can be instantiated', function () {
expect(this.injector).toBeTruthy()
expect(injector).toBeTruthy()
})
it('has a null parent', function () {
expect(this.injector.parent).toBeNull()
expect(injector.parent).toBeNull()
})
it('has an empty registry', function () {
expect(this.injector.registry).toEqual({})
expect(injector.registry).toEqual({})
})
it('has an empty strategy object', function () {
expect(this.injector.strategy).toEqual({})
expect(injector.strategy).toEqual({})
})

@@ -90,5 +91,5 @@ })

describe('Injectark params', function () {
var parent = new Injectark()
var factory = new StandardFactory()
var strategy = standardStrategy
let parent = new Injectark()
let factory = new StandardFactory()
let strategy = standardStrategy
let injector = null

@@ -237,4 +238,4 @@

expect(instance).toEqual(injector.parent.registry['Y'])
expect( Object.keys(injector.parent.registry).length).toEqual(2)
expect( Object.keys(injector.registry).length).toEqual(0)
expect(Object.keys(injector.parent.registry).length).toEqual(2)
expect(Object.keys(injector.registry).length).toEqual(0)
})

@@ -241,0 +242,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