Skip to content

Commit

Permalink
Merge pull request #97 from young-steveo/release-v1.6.2
Browse files Browse the repository at this point in the history
Release v1.6.2
  • Loading branch information
young-steveo authored Nov 27, 2017
2 parents 791f075 + d5b2a8b commit acd4843
Show file tree
Hide file tree
Showing 6 changed files with 1,771 additions and 26 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bottlejs",
"version": "1.6.1",
"version": "1.6.2",
"description": "A powerful dependency injection micro container",
"main": "dist/bottle.min.js",
"license": "MIT",
Expand Down
32 changes: 11 additions & 21 deletions dist/bottle.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
;(function(undefined) {
'use strict';
/**
* BottleJS v1.6.1 - 2017-05-17
* BottleJS v1.6.2 - 2017-11-27
* A powerful dependency injection micro container
*
* Copyright (c) 2017 Stephen Young
Expand Down Expand Up @@ -48,7 +48,15 @@
* @return Bottle
*/
var getNestedBottle = function getNestedBottle(name) {
return this.nested[name] || (this.nested[name] = Bottle.pop());
var bottle;
if (!this.nested[name]) {
bottle = Bottle.pop();
this.nested[name] = bottle;
this.factory(name, function SubProviderFactory() {
return bottle.container;
});
}
return this.nested[name];
};

/**
Expand Down Expand Up @@ -314,7 +322,7 @@
name = parts.shift();

if (parts.length) {
createSubProvider.call(this, name, Provider, parts);
getNestedBottle.call(this, name).provider(parts.join('.'), Provider);
return this;
}
return createProvider.call(this, name, Provider);
Expand Down Expand Up @@ -379,24 +387,6 @@
return this;
};

/**
* Creates a bottle container on the current bottle container, and registers
* the provider under the sub container.
*
* @param String name
* @param Function Provider
* @param Array parts
* @return Bottle
*/
var createSubProvider = function createSubProvider(name, Provider, parts) {
var bottle;
bottle = getNestedBottle.call(this, name);
this.factory(name, function SubProviderFactory() {
return bottle.container;
});
return bottle.provider(parts.join('.'), Provider);
};

/**
* Register a service, factory, provider, or value based on properties on the object.
*
Expand Down
4 changes: 2 additions & 2 deletions dist/bottle.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit acd4843

Please sign in to comment.