From: David Schoonover Date: Tue, 3 Jul 2012 05:48:43 +0000 (-0700) Subject: Adds _.isMember, a generic test for whether a collection contains a value. X-Git-Url: http://git.less.ly:3516/?a=commitdiff_plain;h=7758797467294960a0fcafbd00ad30e617ce7a3c;p=kraken-ui.git Adds _.isMember, a generic test for whether a collection contains a value. --- 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'