From 7758797467294960a0fcafbd00ad30e617ce7a3c Mon Sep 17 00:00:00 2001 From: David Schoonover Date: Mon, 2 Jul 2012 22:48:43 -0700 Subject: [PATCH] Adds _.isMember, a generic test for whether a collection contains a value. --- lib/util/underscore/object.co | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/lib/util/underscore/object.co b/lib/util/underscore/object.co index 6f07576..9bc6e23 100644 --- a/lib/util/underscore/object.co +++ b/lib/util/underscore/object.co @@ -90,6 +90,11 @@ _obj = do ### Delegating Accessors + isMember: (obj, v) -> + values = _.unique [].slice.call arguments, 1 + common = _.intersection _.values(obj), values + _.isEqual values, common + get: (obj, key, def, opts) -> return unless obj? getter = opts?.getter or 'get' -- 1.7.0.4