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.