# uniq-by

> Removes duplicates from an array based on a key

Latest version **1.0.1** (published 2019-10-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install uniq-by
pnpm add uniq-by
yarn add uniq-by
bun add uniq-by
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-10-01 |
| First published | 2019-10-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 1.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | mikemcbride |
| Maintainers | mikemcbride |
| Keywords | array, unique, javascript |

## Links

- npm: https://www.npmjs.com/package/uniq-by
- Repository: https://github.com/mikemcbride/uniq-by
- Homepage: https://github.com/mikemcbride/uniq-by#readme
- Issues: https://github.com/mikemcbride/uniq-by/issues
- npm.io page: https://npm.io/package/uniq-by

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-10-01
- 1.0.0 — 2019-10-01

## README

# uniq-by

For when you just need lodash uniqBy without all the baggage of lodash. It removes duplicate items from an array based on a key.

## Installation

```sh
npm install uniq-by
```

## Usage

It takes an array and a key and returns unique elements by that key.

```js
const uniqBy = require('uniq-by')
const arr = [
  {
    id: 1,
    name: 'Alice'
  },
  {
    id: 2,
    name: 'Alice'
  },
  {
    id: 1,
    name: 'Bob'
  }
]

uniqBy(arr, 'id') // [{ id: 1, name: 'Alice'}, { id: 2, name: 'Alice'}]
uniqBy(arr, 'name') // [{ id: 1, name: 'Alice'}, { id: 1, name: 'Bob'}]
```

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