JSFiddle - React, Tailwind, and code Playground
by mrtoxas
JavaScript
const files = [
{
id: 1,
name: "1"
},
{
id: 2,
name: "2",
children: [
{
id: 21,
name: "21"
},
{
id: 22,
name: "22"
},
{
id: 23,
name: "23"
}
]
},
{
id: 3,
name: "3"
}
];
const del = [1, 3, 21];
var images = [];
_.eachDeep(files,function(value, key, path, depth, parent){
if(key=="key1" && value=="take this")
images.push(parent);
});
console.log('images')