Created
January 18, 2016 22:47
-
-
Save gaperton/7a8a8951cc166af57c98 to your computer and use it in GitHub Desktop.
More elegant way
This file contains hidden or 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 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