The where
function from the Underscore library is used for filtering an array of objects based on certain criteria. Here is an example of how to use the where
function:
index.tsx293 chars13 lines
In this example, we define an array of objects with properties name
and age
. We then use the where
function to filter the array for objects where the age
property matches the value 35
.
The syntax for the where
function is _.where(list, properties)
, where list
is the array to filter and properties
is an object containing the properties to match.
gistlibby LogSnag