I want to add a variable from array of objects and combine them.
Example data :
const item = [{
"act": "Q",
"line": 1,
"qty": 6,
"type": 00
},
{
"act": "Q",
"line": 1,
"qty": 6,
"type": 00
},
{
"act": "Q",
"line": 2,
"qty": 6,
"type": 00
},
{
"act": "Q",
"line": 2,
"qty": 4,
"type": 00
}]
I want to check if act is Q and type is 00 then get the output with line and sum of qty for the line.
[{
"line": 1,
"qty": 12,
},
{
"line": 2,
"qty": 10,
}]