Skip to content

Commit

Permalink
top-level Hash functions more closely mirror Hash() functions
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Sep 9, 2010
1 parent 67b6d3d commit 35298be
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ Hash.map = function (ref, f) {
return Hash(ref).map(f).items;
};

Hash.forEach = function (ref, f) {
Hash(ref).forEach(f);
};

Hash.filter = function (ref, f) {
return Hash(ref).filter(f).items;
};
Expand All @@ -134,6 +138,30 @@ Hash.reduce = function (ref, f, acc) {
return Hash(ref).reduce(f, acc);
};

Hash.some = function (ref, f) {
return Hash(ref).some(f);
};

Hash.update = function (a, b) {
return Hash(a).update(b).items;
};

Hash.merge = function (a, b) {
return Hash(a).merge(b).items;
};

Hash.valuesAt = function (ref, keys) {
return Hash(ref).valuesAt(keys);
};

Hash.tap = function (ref, f) {
return Hash(ref).tap(f).items;
};

Hash.extract = function (ref, keys) {
return Hash(ref).extract(keys).items;
};

Hash.concat = function (xs) {
var hash = Hash({});
xs.forEach(function (x) { hash.update(x) });
Expand Down

0 comments on commit 35298be

Please sign in to comment.