no packages and conf copied

This commit is contained in:
Stefan Pejcic
2024-09-18 16:27:40 +02:00
parent fa69cae01f
commit ae4c612987
2611 changed files with 4571 additions and 591498 deletions

View File

@@ -1,24 +0,0 @@
import { findDuplicates } from "@utils/array";
test("Find duplicates from array", () => {
const testCases = [
{
input: [],
output: [],
},
{
input: [1, 2, 3, 3, "3", "3"],
output: [3, "3"],
},
{
input: [1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5],
output: [1, 2, 3, 4, 5],
},
];
testCases.forEach((testCase) => {
const result = findDuplicates(testCase.input);
expect(result).toEqual(testCase.output);
});
});

View File

@@ -1,5 +0,0 @@
export const findDuplicates = (arr: (string | number)[]) => {
const duplicates = arr.filter((item, index) => arr.indexOf(item) !== index);
const unique = new Set(duplicates);
return Array.from(unique);
};