# dedupe

> easy deduplication of array values

Latest version **4.0.3** (published 2024-02-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install dedupe
pnpm add dedupe
yarn add dedupe
bun add dedupe
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.3 |
| Published | 2024-02-15 |
| First published | 2013-07-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=4.0 |
| Dependencies | 0 |
| Unpacked size | 3.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Manuel Ernst |
| Maintainers | zaphod1984 |
| Keywords | duplicates, dupes, array, remove duplicates, distinct, deduplicate, deduplication |

## Links

- npm: https://www.npmjs.com/package/dedupe
- Repository: https://github.com/seriousManual/dedupe
- Homepage: https://github.com/seriousManual/dedupe#readme
- Issues: https://github.com/seriousManual/dedupe/issues
- npm.io page: https://npm.io/package/dedupe

## Recent versions

- 4.0.3 (latest) — 2024-02-15
- 4.0.2 — 2022-12-23
- 4.0.1 — 2022-09-16
- 4.0.0 — 2022-09-16
- 3.0.3 — 2022-05-20
- 3.0.2 — 2020-02-27
- 3.0.1 — 2018-11-23
- 2.1.0 — 2016-10-12
- 2.0.3 — 2016-06-28
- 2.0.2 — 2016-06-28
- 2.0.1 — 2016-03-14
- 2.0.0 — 2016-03-14
- 1.0.2 — 2015-09-08
- 1.0.1 — 2015-02-18
- 1.0.0 — 2014-09-27
- … 10 more at https://npm.io/package/dedupe/versions

## README

# dedupe

removes duplicates from your array.

## Installation

````bash
npm install dedupe
````

## Usage

### primitive types

```javascript
import dedupe from 'dedupe'

const a = [1, 2, 2, 3]
const b = dedupe(a)
console.log(b)

//result: [1, 2, 3]
```

### complex types

Here the string representation of the object is used for comparism. Internal `JSON.stringify` is used for serialization.
That means that `{}` is considered equal to `{}`.

```javascript
import dedupe from 'dedupe'

const aa = [{a: 2}, {a: 1}, {a: 1}, {a: 1}]
const bb = dedupe(aa)
console.log(bb)

//result: [{a: 2}, {a: 1}]
```

### complex types types with custom hasher

You can use a custom hasher to overwrite the default behaviour.

```javascript
import dedupe from 'dedupe'

const aaa = [{a: 2, b: 1}, {a: 1, b: 2}, {a: 1, b: 3}, {a: 1, b: 4}]
const bbb = dedupe(aaa, value => value.a)
console.log(bbb)

//result: [{a: 2, b: 1}, {a: 1,b: 2}]
```

---
_Source: https://npm.io/package/dedupe · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
