Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/fathym_common/deps.ts>intersect

The Fathym Reference Architecture provides the common foundation for applications built in Typescript.
Go to Latest
function intersect
import { intersect } from "https://deno.land/x/fathym_common@v0.0.184/deps.ts";

Returns all distinct elements that appear at least once in each of the given arrays.

Examples

Example 1

import { intersect } from "https://deno.land/std@0.224.0/collections/intersect.ts";
import { assertEquals } from "https://deno.land/std@0.224.0/assert/assert_equals.ts";

const lisaInterests = ["Cooking", "Music", "Hiking"];
const kimInterests = ["Music", "Tennis", "Cooking"];
const commonInterests = intersect(lisaInterests, kimInterests);

assertEquals(commonInterests, ["Cooking", "Music"]);

Parameters

...arrays: (readonly T[])[]