Consider the array of objects below,
const resource = [
{
id: 'tony',
shiftday: [
{active: '1', code: 'Sun'},
{active: '1', code: 'Mon'},
{active: '1', code: 'Tue'},
{active: '1', code: 'Wed'},
{active: '1', code: 'Thu'},
{active: '1', code: 'Fri'},
{active: '1', code: 'Sat'},
]
},
{
id: 'alex',
shiftday: [
{active: '0', code: 'Sun'},
{active: '1', code: 'Mon'},
{active: '1', code: 'Tue'},
{active: '0', code: 'Wed'},
{active: '1', code: 'Thu'},
{active: '1', code: 'Fri'},
{active: '0', code: 'Sat'},
]
},
{
id: 'trey',
shiftday: [
{active: '0', code: 'Sun'},
{active: '1', code: 'Mon'},
{active: '0', code: 'Tue'},
{active: '1', code: 'Wed'},
{active: '0', code: 'Thu'},
{active: '1', code: 'Fri'},
{active: '0', code: 'Sat'},
]
},
]
I need to get all values that has active day set to 1 (selected) and match it to the other id’s. And to be able to say that which id’s have matching active days.