@writetome51/array-remove-duplicates
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

removeDuplicates(array): void

Removes any extra instances of each item in array.

Examples

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

import {removeDuplicates} from '@writetome51/array-remove-duplicates';

Package Sidebar

Install

npm i @writetome51/array-remove-duplicates

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

2.87 kB

Total Files

5

Last publish

Collaborators

  • writetome51