Skip to content

Instantly share code, notes, and snippets.

@gaperton
Created January 18, 2016 22:47
Show Gist options
  • Save gaperton/7a8a8951cc166af57c98 to your computer and use it in GitHub Desktop.
Save gaperton/7a8a8951cc166af57c98 to your computer and use it in GitHub Desktop.
More elegant way
function match( obj ){
return function( x ){
for( var name in obj ){
if( x.get( name ) !== obj[ name ] ){
return false;
}
}
return true;
}
}
people.filter( match({ name : 'David', lastName : 'Smith '}) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment