UNPKG

remove-array-duplicates-bysets

Version:

14 lines (12 loc) 300 B
let uniqueArr = [] function removeArrayDuplicatesBySet(arr){ // Accepts an array from which the duplicates // will be removed if (!Array.isArray(arr)){ arr = [] } let theSet = new Set(arr) let uniqueArr = [...theSet] return uniqueArr } module.exports = removeArrayDuplicatesBySet