For example, I have list of product objects:
I don't want to to leave only unique objects, but group them into one
    [
            {
                name: "some product",
                type: "other",
                options: [
                    {
                        label: "price",
                        value: 10
                    }
                ]
            },
            {
                name: "merge product",
                type: "merge",
                options: [
                    {
                        label: "size",
                        value: "L"
                    },
                    {
                        label: "color",
                        value: "white"
                    },
                ]
            },
            {
                name: "merge product",
                type: "merge",
                options: [
                    {
                        label: "size",
                        value: "XL"
                    },
                    {
                        label: "color",
                        value: "red"
                    },
                ]
            },
        ]
what I want to get in result, is:
    [
            {
                name: "some product",
                type: "other",
                options: [
                    {
                        label: "price",
                        value: 10
                    }
                ]
            },
            {
                name: "merge product",
                type: "merge",
                options: [
                    {
                        label: "size",
                        value: "L"
                    },
                    {
                        label: "color",
                        value: "white"
                    },
                    {
                        label: "size",
                        value: "XL"
                    },
                    {
                        label: "color",
                        value: "red"
                    },
                ]
            }
    }
Where "merge product" should have options of all objects same name and type "merge".
I used to achieve this by for and simple iterations with intermediate list as storage and comparison, but is there any other nice functional way for getting this done?
 
     
    