export function findDuplicates()

in runtimes/runtimes/lsp/router/util.ts [55:67]


export function findDuplicates<T>(array: T[]): T[] | undefined {
    const seen = new Set<T>()
    const dups = array
        .filter(a => a !== undefined)
        .filter(function (a) {
            if (seen.has(a)) {
                return true
            }
            seen.add(a)
            return false
        })
    return dups.length > 0 ? dups : undefined
}