I have an array of objects below
const response =
[
{
id: 105,
label: 'test',
directories: [ '/api/1/directories/500' ]
},
{
id: 337,
label: 'test2',
directories: [ '/api/1/directories/766' ]
},
{
id: 200,
label: 'test20',
directories: [ '/api/1/directories/95' ]
}
]
And I have an array called directories
directories = [ '/api/1/directories/766', '/api/1/directories/95' ]
I am trying to search/filter response to only return the ids of objects that matches the directories in directories array
so the sample output can be something like below, which is only the IDs of the matched objects
sampleOut= [337, 200]