From 752f64f66da9fb424a4f78fc2d4ad0ef096ba65d Mon Sep 17 00:00:00 2001 From: James Halliday Date: Fri, 19 Nov 2010 14:46:11 +0000 Subject: [PATCH] exclude to remove keys --- lib/hash.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/hash.js b/lib/hash.js index 5bd7512..ed2b8be 100644 --- a/lib/hash.js +++ b/lib/hash.js @@ -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 }; @@ -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) });