In my angular 4 application I have the following array :
let sampleArray1 = [
{
"name":"Raman",
"prdList":[
{
"p_code":"20",
"crtList":[
{
"c_code":"087"
}
]
}
]
},
{
"name":"Laxman",
"prdList":[
{
"p_code":"10"
}
]
},
{
"name":"raj",
"prdList":[
{
"p_code":"202"
}
]
},
{
"name":"raghav",
"prdList":[
{
"p_code":"30",
"crtList":[
{
"c_code":"97"
}
]
}
]
}
]
In this array some of the objects are missing crtList. I need to filter out all such objects and need to have the array which must and should has crtList.
So my result sampleArray2 should have the following result :
[
{
"name":"Raman",
"prdList":[
{
"p_code":"20",
"crtList":[
{
"c_code":"087"
}
]
}
]
},
{
"name":"raghav",
"prdList":[
{
"p_code":"30",
"crtList":[
{
"c_code":"97"
}
]
}
]
} ]
How can I achieve this using lodash?