Skip to main content
variable intersectionBy
import { intersectionBy } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Returns a list of elements that exist in both arrays, after applying the provided function to each array element of both.

Create a Set by applying fn to all elements in b, then use Array.prototype.filter() on a to only keep elements, which produce values contained in b when fn is applied to them.

type

(
a: any[],
b: any[],
fn: MapFunc,
) => unknown