Created
February 15, 2013 03:04
-
-
Save guipn/4958253 to your computer and use it in GitHub Desktop.
inAny is a predicate determining whether some property exists in any of its first parameter's elements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function inAny(a, prop) { | |
return a.some(function (each) { | |
return typeof each[prop] !== 'undefined'; | |
}; | |
} | |
var a = [{}, {}, {found: 0}]; | |
inAny(a, 'found'); // true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment