Skip to content

Commit

Permalink
key and value tests
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Aug 27, 2010
1 parent 459def9 commit 92212e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ function Hash (ref) {
});
return acc;
},
end : hash
end : hash,
items : hash
};

Object.defineProperty(self, 'keys', { get : function () {
Expand Down
3 changes: 3 additions & 0 deletions test/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,8 @@ exports['hash traversal'] = function (assert) {
var ref3 = { a : 5, b : 2, c : 7, 1337 : 'leet' };
var f1 = Hash.filter(ref3, function (v, k) { return v > 5 || k > 5 });
assert.equal(Object.keys(f1).sort().join(' '), '1337 c');

assert.equal(Hash(ref3).keys.sort().join(' '), '1337 a b c');
assert.equal(Hash(ref3).values.sort().join(' '), '2 5 7 leet');
};

0 comments on commit 92212e5

Please sign in to comment.