Issue #952

Use ES6 Map

The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value (both objects and primitive values) may be used as either a key or a value.

type Deal = {
    name: string,
    link: string
}

removeDuplicates = (array: Deal[]) => {
    const map = new Map()
    array.forEach((item) => map.set(item.link, item))

    return [...map.values()]
}

We might need to update tsconfig.json

{
    "compilerOptions": {
        "target": "es6"
    }
}