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

x/fathym_common/deps.ts>distinct

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

Returns all distinct elements in the given array, preserving order by first occurrence.

Examples

Example 1

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

const numbers = [3, 2, 5, 2, 5];
const distinctNumbers = distinct(numbers);

assertEquals(distinctNumbers, [3, 2, 5]);

Parameters

array: Iterable<T>