Skip to content

unique

Reduces an Array of values to unique instances, keeping the first of each. Dates compare by time.

Reduces [1, 2, 2, 3, 3, 3, 4] to [1, 2, 3, 4], keeping the first occurrence of each value and dropping later duplicates.

import {unique} from "@d3plus/data";

unique([1, 2, 2, 3, 3, 3, 4]);

Parameters

import {unique} from "@d3plus/data";
arrrequiredArray.<T>

The Array of objects to be filtered.

accessorFunctionDefault ...

An optional accessor function used to extract data points from an Array of Objects.