Skip to content

Commit

Permalink
[fix] Pass in the options when constructed without new
Browse files Browse the repository at this point in the history
  • Loading branch information
3rd-Eden committed Jan 8, 2015
1 parent c63d01a commit 2faa976
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ function Layer(name, fn) {
* @api public
*/
function Supply(provider, options) {
if (!this) return new Supply();
if (!this) return new Supply(provider, options);

options = options || {};

this.provider = provider || this;
Expand Down
3 changes: 2 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ describe('supply', function () {

it('can be constructed without new', function () {
supply.destroy();
supply = Supply();
supply = Supply('provider');

assume(supply).is.instanceOf(Supply);
assume(supply.provider).equals('provider');
});

it('calls the supplied initialize method when contructed', function (next) {
Expand Down

0 comments on commit 2faa976

Please sign in to comment.