const input_data = [
{name: 'target_tag', value: 'a'},
{name: 'animation_status', value: 'animation-1'},
{name: 'duration', value: ''},
{name: 'target_tag', value: 'div'},
{name: 'animation_status', value: 'animation-1'},
{name: 'duration', value: ''},
];
const collate = (input_data) => {
const result = [{}];
for(const input_info of input_data) {
// check to see if the last item in the results array has an entry for the
// current input name, create a new object at the end of the array if it does
if(result[result.length - 1].hasOwnProperty(input_info.name))
result.push({});
// add entry to object at end of result array
result[result.length - 1][input_info.name] = input_info.value;
}
// convert result array to object
return Object.fromEntries(Object.entries(result));
};
console.log(collate(input_data));