How to construct an object literal based on multiple objects that have identical keys but respective values if they differ should be put in an array

From:

(2) [{…}, {…}]
0: {name: 'Apple', qty: 10}
1: {name: 'Apple', qty: 8}

To:

const resultObj = {
name: ‘Apple’,
qty: [10, 8],
};

The number of objects from which the new object literal should be created, and the number of key-value pairs within them may vary.
If the value for a given key is identical across the “parent” objects then this key-value pair should “migrate” unchanged into the new object literal, but if the values for a given key differ, then these values should be listed in an array and assigned to the respective key in the new object literal.

All I could come up with so far created more problems taking me farther and farther away from the desired outcome- to such extent that I ended up at string manipulations with split and splice methods , the point at which I have to ask for help.