Remove duplicates multiple data

Question regarding removing duplicates. In the below workflow there are 3 urls each with a corresponding info field. How can I modify the script in the function node to delete the duplicate based on the url, but return the info as well?

Current Result:

[
    {
        "data": "https://www.bleepingcomputer.com/news/security/actively-exploited-bug-bypasses-authentication-on-millions-of-routers/"
    },
    {
        "data": "https://www.bleepingcomputer.com/news/security/go-rust-net-library-affected-by-critical-ip-address-validation-vulnerability/"
    }
]

Desired Result:

[
    {
        "data": "https://www.bleepingcomputer.com/news/security/actively-exploited-bug-bypasses-authentication-on-millions-of-routers/",
        "info": "abcdefg"
    },
    {
        "data": "https://www.bleepingcomputer.com/news/security/go-rust-net-library-affected-by-critical-ip-address-validation-vulnerability/",
        "info": "abcdefg"
    }
]

Hi @Davey, have you checked out the Item Lists node? It has a remove duplicates operation allowing you to de-duplicate data based on a given field:

2 Likes

I should have known I was overthinking it! :grin: You all make it too easy! Thanks @MutedJam

1 Like