remove_duplicates_array
Report bug | New feature | Change Log
This is the array that handle duplicate item, either objects are inside the array, or number inside the array.
To test this code you can see the test case in test/array.test.js
,
and use the npm test
for trigger the jest
toArray()
will make the inputs returning as a array
toString()
will return the array as string, like 'A,B,C,D'
const removeArrayDuplicate = require("@hinng/remove_duplicates_array");
const array = [1234, 234, 123, 1234];
let test = new removeArrayDuplicate(array);
console.log(test.removeDuplicate()); // return [1234, 234, 123]
const removeArrayDuplicate = require("@hinng/remove_duplicates_array");
const array = ["AA", "AB", "AC", "AD", "AA"];
let test = new removeArrayDuplicate(array);
console.log(test.removeDuplicate()); // return ['AA', 'AB', 'AC', 'AD']
const removeArrayDuplicate = require("@hinng/remove_duplicates_array");
const array = [{ a: 1 }, { b: 2 }, { c: 3 }, { a: 1 }];
let test = new removeArrayDuplicate(array);
console.log(test.removeDuplicate()); // return [{a: 1}, {b: 2}, {c: 3}]