javascript I want to make an array of tags with different overlapping values in objectArray

Before

  const array = [
    { group: '1', tag: ['sins'] },
    { group: '1', tag: ['sun'] },
    { group: '2', tag: ['red'] },
    { group: '2', tag: ['blue'] },
    { group: '2', tag: ['black'] },
  ];

After

  const array = [
    { group: '1', tag: ['sins', 'sun'] },
    { group: '2', tag: ['red', 'blue', 'black'] },
  ];

I want to change it like the chord above. I want someone to create a cool chord.