I have two arrays. One is the pattern, which contains 12 months and second is fetched from api. Pattern:
[
{
total: 0,
month_name: "Jan",
},
{
total: 0,
month_name: "Feb",
},
{
total: 0,
month_name: "Mar",
},
{
total: 0,
month_name: "Apr",
},
...
]
fetched:
[
{
"total": 4,
"month_name": "Mar"
},
{
"total": 1,
"month_name": "Apr"
}
]
I want to compare fetched array to pattern, find matching "month_name" and update "total". Fetched array contains objects with months only when they are above 0.