Skip to content

Commit

Permalink
code refactoring for container package
Browse files Browse the repository at this point in the history
  • Loading branch information
artemgurzhii committed Mar 8, 2017
1 parent d018532 commit 56957eb
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/container/lib/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ Container.prototype = {
@param {String} fullName optional key to reset; if missing, resets everything
*/
reset(fullName) {
if (arguments.length > 0) {
if (fullName) {
resetMember(this, this.registry.normalize(fullName));
} else {
resetCache(this);
Expand Down Expand Up @@ -341,7 +341,7 @@ function lookup(container, fullName, options = {}) {

function isSingletonClass(container, fullName, { instantiate, singleton }) {
return (singleton !== false && isSingleton(container, fullName)) &&
(!instantiate && !shouldInstantiate(container, fullName));
(instantiate === false && !shouldInstantiate(container, fullName));
}

function isSingletonInstance(container, fullName, { instantiate, singleton }) {
Expand Down Expand Up @@ -487,11 +487,9 @@ function injectionsFor(container, fullName) {
return injections;
}

function instantiate(factory, props, container, fullName) {
function instantiate(factory, props = {}, container, fullName) {
let lazyInjections, validationCache;

props = props || {};

if (container.registry.getOption(fullName, 'instantiate') === false) {
return factory;
}
Expand Down

0 comments on commit 56957eb

Please sign in to comment.