How to transform an array to an object?

I have an array:

        const y = [
            {
                key: 'field',
                value: 'companyproject'
            },
            {
                key: 'comparisonoperator',
                value: '=='
            },
            {
                key: 'value',
                value: '62378525f7005c49080df965'
            },
            {
                key: '',
                value: ''
            },
        ]

And I want to create a single object using the keys and values of the array:

        const x = {
            field: 'companyproject',
            comparison_operator: '==',
            value: '62378525f7005c49080df965'
        }