Skip to content

Commit

Permalink
Add names array. Closes hapijs#1
Browse files Browse the repository at this point in the history
  • Loading branch information
Eran Hammer committed Sep 7, 2014
1 parent df69788 commit 47f6545
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ exports.Definitions = internals.Definitions = function (options) {
this.settings = Hoek.applyToDefaults(internals.defaults.global, options || {});
this.cookieDefaults = Hoek.applyToDefaults(internals.defaults.cookie, this.settings);
this.cookies = {};
this.names = [];
};


Expand All @@ -43,6 +44,7 @@ internals.Definitions.prototype.add = function (name, options) {
Hoek.assert(!this.cookies[name], 'State already defined:', name);

this.cookies[name] = Hoek.applyToDefaults(this.cookieDefaults, options || {});
this.names.push(name);
};


Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "statehood",
"description": "HTTP State Management Utilities",
"version": "1.0.0",
"version": "1.1.0",
"repository": "git://github.com/hapijs/statehood",
"main": "index",
"keywords": [
Expand Down
8 changes: 8 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ describe('Statehood', function () {
});
done();
});

it('records name', function (done) {

var definitions = new Statehood.Definitions();
definitions.add('test');
expect(definitions.names).to.deep.equal(['test']);
done();
});
});
});

Expand Down

0 comments on commit 47f6545

Please sign in to comment.