https://github.com/writetome51/array-remove-duplicates
Function that removes any duplicate items in the array
https://github.com/writetome51/array-remove-duplicates
array array-manipulations duplicates javascript remove remove-duplicates
Last synced: 11 months ago
JSON representation
Function that removes any duplicate items in the array
- Host: GitHub
- URL: https://github.com/writetome51/array-remove-duplicates
- Owner: writetome51
- License: mit
- Created: 2018-10-01T04:29:25.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-08-05T21:28:16.000Z (over 5 years ago)
- Last Synced: 2025-02-02T11:32:22.885Z (11 months ago)
- Topics: array, array-manipulations, duplicates, javascript, remove, remove-duplicates
- Language: TypeScript
- Size: 19.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# removeDuplicates(array): void
Removes any extra instances of each item in `array`.
## Examples
```js
let arr = [1, 2, 3, 4, 1, 2, 3, 4, 5];
removeDuplicates(arr);
// arr is now [1,2,3,4,5]
arr = [1, 2, ['a','b'], 9, 1, 2, 3, 4, ['a','b']];
removeDuplicates(arr);
// arr is now [1, 2, ['a','b'], 9, 3, 4]
let obj = {name: 'jon'};
arr = [ obj, obj, [obj], [obj] ];
removeDuplicates(arr);
// arr is now [ obj, [obj] ]
```
## Installation
`npm i @writetome51/array-remove-duplicates`
## Loading
```js
import {removeDuplicates} from '@writetome51/array-remove-duplicates';
```