Created
August 10, 2018 14:10
-
-
Save ldmarz/4db4d7c52a02596c3cb1a62ee4350b36 to your computer and use it in GitHub Desktop.
Example of Filter from lodash library
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
| var users = [ | |
| { firstName: "Ldmarz", lastName: "martinez", age: 28, gender: "male" }, | |
| { firstName: "Suli", lastName: "bern", age: 5, gender: "female" }, | |
| { firstName: "Marianis", lastName: "Carrey", age: 54, gender: "female" }, | |
| { firstName: "Jhon", lastName: "carret", age: 40, gender: "male" } | |
| ]; | |
| var femaleUsers = _.filter(users, function(user) { | |
| return user.gender === 'female' | |
| }); | |
| // femaleUsers ===> [ | |
| // { firstName: "Suli", lastName: "bern", age: 5, gender: "female" }, | |
| // { firstName: "Marianis", lastName: "Carrey", age: 54, gender: "female" } | |
| // ]; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment