Kaustubh
10 months ago

Merging Nested Array Boolean Values

Posted 10 months ago by Kaustubh

I have an array Output something like this and i want to merge them by page_id

    Object
        data: Array(2)
        0: Array(3)
            0: {page_id: 1, view: true, edit: true, update: true, delete: true}
            1: {page_id: 2, view: true, edit: false, update: false, delete: true}
            2: {page_id: 3, view: true, edit: false, update: false, delete: false}
            length: 3
            __proto__: Array(0)
        1: Array(3)
            0: {page_id: 1, view: false, edit: false, update: false, delete: true}
            1: {page_id: 2, view: false, edit: false, update: false, delete: true}
            2: {page_id: 3, view: false, edit: false, update: false, delete: false}
            length: 3
            __proto__: Array(0)
        .
        .
        .
        .
        
        length: 2

I need Output something like this

    result[0] => {
        0: {page_id: 1, view: true, edit: true, update: true, delete: true}
        1: {page_id: 2, view: true, edit: false, update: false, delete: true}
        2: {page_id: 3, view: true, edit: false, update: false, delete: false}          
    }

Thanks in advance

Please sign in or create an account to participate in this conversation.