Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nescalante/distinct

get distinct values from an array
https://github.com/nescalante/distinct

Last synced: 20 days ago
JSON representation

get distinct values from an array

Awesome Lists containing this project

README

        

# distinct()

[![Greenkeeper badge](https://badges.greenkeeper.io/nescalante/distinct.svg)](https://greenkeeper.io/)

Because nobody wants repeated things

## Install

```shell
npm install distinct
```

Just call it and it will retrieve just all distinct values

```js
var distinct = require('distinct');
var arr = distinct([1, 1, 2, 3, 3, 3, 4]);

console.log(arr); // [1, 2, 3, 4]
```

Thats it!

Keep in mind that `distinct` uses the [`equals`](https://github.com/jkroso/equals) package to compare items.

## License

MIT