Skip to content

Commit

Permalink
exclude to remove keys
Browse files Browse the repository at this point in the history
  • Loading branch information
James Halliday committed Nov 19, 2010
1 parent 04b1d50 commit 752f64f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ function Hash (hash, xs) {
});
return Hash(acc);
},
exclude : function (keys) {
return self.filter(function (_, key) {
return keys.indexOf(key) < 0
});
},
end : hash,
items : hash
};
Expand Down Expand Up @@ -189,6 +194,10 @@ Hash.extract = function (ref, keys) {
return Hash(ref).extract(keys).items;
};

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

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

0 comments on commit 752f64f

Please sign in to comment.