The intersectionBy
function from Lodash returns an array of unique values that are present in all the given arrays, where the uniqueness is determined by iteratee
function. Here's an example of how to use the intersectionBy
function:
index.tsx380 chars10 lines
In this example, intersectionBy
is used to find the values that have the same x
property in both arr1
and arr2
. The returned array contains only { 'x': 2 }
and { 'x': 3 }
.
gistlibby LogSnag