https://github.com/lamansky/unique-object
[Node.js] Returns a copy of an Object or Map with duplicate values removed.
https://github.com/lamansky/unique-object
Last synced: 3 months ago
JSON representation
[Node.js] Returns a copy of an Object or Map with duplicate values removed.
- Host: GitHub
- URL: https://github.com/lamansky/unique-object
- Owner: lamansky
- License: mit
- Created: 2017-12-20T14:45:49.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-20T15:16:46.000Z (over 8 years ago)
- Last Synced: 2024-10-11T02:36:39.961Z (over 1 year ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# unique-object
Returns a copy of an Object or Map with duplicate values removed.
This module is an alias of [`unique-map`](https://github.com/lamansky/unique-map), which supports both Maps and Objects.
## Installation
```bash
npm install unique-object --save
```
## Usage Example
```javascript
const uniqueObject = require('unique-object')
const obj = {
1: 'A',
2: 'A',
3: 'B',
}
const u = uniqueObject(obj)
u[1] // 'A'
u[2] // undefined
u[3] // 'B'
```
For more details, see the documentation for the [`unique-map`](https://github.com/lamansky/unique-map) module.