| export function findDuplicates(items: string[]): string[] { | |
| const seen = new Set<string>() | |
| const duplicates: string[] = [] | |
| for (const item of items) { | |
| if (seen.has(item)) { | |
| duplicates.push(item) | |
| } | |
| seen.add(item) | |
| } | |
| return duplicates | |
| } | |
| export function findDuplicates(items: string[]): string[] { | |
| const seen = new Set<string>() | |
| const duplicates: string[] = [] | |
| for (const item of items) { | |
| if (seen.has(item)) { | |
| duplicates.push(item) | |
| } | |
| seen.add(item) | |
| } | |
| return duplicates | |
| } | |