intersectionBy (Functional Programming) es-toolkit
Creates a function that keeps values by a mapped key. Use it with pipe.
Info
Prefer the original es-toolkit intersectionBy in ordinary code. Use this fp variant when composing transformations with pipe.
Usage
intersectionBy compares the values returned by mapper. Values from the piped array are kept when their mapped key appears in secondArray.
Parameters
secondArrayreadonly U[]required
The array containing values whose mapped keys should be kept.
mapper(item: T | U) => unknownrequired
The function that returns the comparison key.
Returns
A function that maps a readonly T[] to values whose keys are found in secondArray.
Source: es-toolkit
Re-exported verbatim from es-toolkit. Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.