Last active
January 17, 2020 20:46
-
-
Save jasdeepkhalsa/1d4a2f13ef6a0dd2ae3b to your computer and use it in GitHub Desktop.
Filters an object by a property value (designed for use on an array of objects)
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
const filterByObjPropValue = (arrayOfObjects, property, value) => { | |
return arrayOfObjects.filter((obj) => { | |
return obj[property] === value; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment