The matchesProperty
function in lodash checks if an object has a property that matches the specified value. Here's an example of how to use it:
index.tsx430 chars17 lines
In this example, we created a function isAgeTwenty
using the matchesProperty
function from lodash. This function checks if the age
property of an object is equal to 20.
We then use the filter
function from lodash to find all objects in the users
array that match the isAgeTwenty
function, which returns only the object with name Steve
.
Hope this helps!
gistlibby LogSnag