Skip to content

Instantly share code, notes, and snippets.

@guipn
Created February 15, 2013 03:04
Show Gist options
  • Save guipn/4958253 to your computer and use it in GitHub Desktop.
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.
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