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

Filters out the non-unique values in an array, based on a provided comparator function.

Use Array.prototype.filter() and Array.prototype.every() for an array containing only the unique values, based on the comparator function, fn. The comparator function takes four arguments: the values of the two elements being compared and their indexes.

type

<T = any>(arr: T[], fn: (
obj1: T,
obj2: T,
index1: number,
index2: number,
) => any
) => unknown