If you want to create a new data structure based on unique values like the name field in your example, you can use something like const unique_names = [...new Set(test.map(item => test.name))];. You can then loop through your unique values, filter items and build your result set as needed.
Check out the example posted over here to see this piece in a workflow context.
Thank you for your answer,
that’s almost what I want, but I don’t want to cumulate the results but create new fields with the data that there are duplicates, here is the example, my API return is Table1, and this I want to have at the end is Tableau2