https://github.com/gitfaf/unique-values
Get the unique values from array, objects etc.
https://github.com/gitfaf/unique-values
Last synced: 8 months ago
JSON representation
Get the unique values from array, objects etc.
- Host: GitHub
- URL: https://github.com/gitfaf/unique-values
- Owner: gitfaf
- License: mit
- Created: 2017-09-19T13:48:56.000Z (over 8 years ago)
- Default Branch: main
- Last Pushed: 2022-11-11T13:39:09.000Z (about 3 years ago)
- Last Synced: 2025-04-25T18:15:34.858Z (8 months ago)
- Language: TypeScript
- Size: 21.5 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# unique-values
Get the unique values from array, objects etc.
## Changes
### V4
- sort removed from returned array. Sort yourself `.sort((a, b) => a - b)`
### V3
- Uses set instead of loop
- returns only numbers
- works on numbers
### V2
- typescript
- dev dependencies
### V1
- still works.
- no need to update your code base if you are using it.
## Usage
```bash
npm i unique-values
```
```javascript
const uniqueValues = require('unique-values')
uniqueValues.getUniqueArrayValues([1, 2, 1, 2, 3, 4, 5, 10, 2, 3, 2, 3, 23, 2])
// returns
// [1, 2, 3, 4, 5, 10, 23]
uniqueValues.getUniqueObjectValues({'a': 12, 'b': 14, 'c': 14, 'd': 12})
// returns
// [12, 14]
```
## License
MIT © Git Faf 2017