@knowark/injectarkjs
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -51,28 +51,2 @@ import { Factory } from './factory.js' // eslint-disable-line | ||
/** @param {string} resource @param {boolean} persist */ | ||
t_dependencyBuild (resource, persist = true) { | ||
let instance = null | ||
const rule = this.strategy[resource] || { 'method': '' } | ||
const builder = this.factory.extract(rule['method']) | ||
if (!builder) { | ||
const parent = this.parent | ||
return parent ? parent._dependencyBuild(resource, persist) : instance | ||
} | ||
const dependencies = builder['dependencies'] || [] | ||
const dependencyInstances = [] | ||
for (const dependency of dependencies) { | ||
const dependencyInstance = this.resolve(dependency) | ||
dependencyInstances.push(dependencyInstance) | ||
} | ||
instance = builder(...dependencyInstances) | ||
if (persist) { | ||
this.registry[resource] = instance | ||
} | ||
return instance | ||
} | ||
_dependencyBuild (resource, persistent = true) { | ||
@@ -79,0 +53,0 @@ let instance = null |
{ | ||
"name": "@knowark/injectarkjs", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Dependency Injector for Javascript", | ||
@@ -8,4 +8,3 @@ "main": "index.js", | ||
"clear": "rm -rf node_modules/", | ||
"test": "babel-node tests/run.js", | ||
"coverage": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text jasmine tests/*.js" | ||
"test": "cross-env NODE_ENV=test nyc --reporter=lcov --reporter=text babel-node tests/run.js" | ||
}, | ||
@@ -25,2 +24,9 @@ "repository": { | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"**/*.spec.js", | ||
"**/run.js", | ||
"build" | ||
] | ||
}, | ||
"author": "Nubark", | ||
@@ -45,2 +51,2 @@ "license": "MIT", | ||
} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10
11081
303