Permalink
Browse files

bugfixed named collection key exists check

  • Loading branch information...
1 parent 35b8f29 commit 87c20cb28dd9483ffed1dde11446b72229230124 @patricklodder committed May 27, 2012
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/datacollector.js
View
@@ -23,10 +23,10 @@ DataCollector.prototype.collect = function(name, value) {
var k = (this.named) ? name : this.items.length;
var val = (this.named) ? value : name;
- if (this.named && !this.expected.hasOwnProperty(k)) {
+ if (this.named && !this.expected.indexOf(k) !== -1) {
// do nothing;
- } else if (val !== undefined || this.recordEmpty) {
- this.items[k] = (val !== undefined) ? val : null;
+ } else if (typeof(val) !== 'undefined' || this.recordEmpty) {
+ this.items[k] = (typeof(val) !== 'undefined') ? val : null;
} else if (this.named) {
var idx = this.expected.indexOf(k);
if (idx !== -1) delete this.expected[idx];

0 comments on commit 87c20cb

Please sign in to comment.