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

x/fathym_common/src/src.deps.ts>union

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

Returns all distinct elements that appear in any of the given arrays.

Examples

Example 1

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

const soupIngredients = ["Pepper", "Carrots", "Leek"];
const saladIngredients = ["Carrots", "Radicchio", "Pepper"];
const shoppingList = union(soupIngredients, saladIngredients);

assertEquals(shoppingList, ["Pepper", "Carrots", "Leek", "Radicchio"]);

Parameters

...arrays: Iterable<T>[]