0.1.0 • Published 5 years ago

dedupe-compare v0.1.0

Weekly downloads
33
License
MIT
Repository
github
Last release
5 years ago

Dedupe Compare

De-duplicate arrays of arbitrary objects with a equality function.

Installation

npm install --save dedupe-compare

Ussage

With standart comparator function

const dedupe = require("dedupe-compare");

const array = [1, 1, 2, 2, 3, 1, 5];

const result = dedupe(array);
// [1, 2, 3, 5];

With a custom comparator function.

const dedupe = require("dedupe-compare");

const array = [{ a: "x", b: "y" }, { a: "x", b: "y" }, { a: "b", b: "y" }];

const equal = (x, y) => x.a === y.a;
const result = dedupe(array, equal);
// [{ a: "x", b: "y" }, { a: "b", b: "y" }]