Reputation: 207
I have an object like
var data = [
{
"inputDate":"2017-11-25T00:00:00.000Z",
"billingCycle":6,
"total":1
},{
"inputDate":"2017-11-28T00:00:00.000Z",
"billingCycle":1,"total":1
}
]
I need to get the result like
var result = [
{
"billingCycle":6,
"total":1
},{
"billingCycle":1,
"total":1
}
]
tried with
_.map(data, a => _.omit(a, 'inputDate'))
but not I'm not able to achieve the actual result. Please help me on this.
Upvotes: 1
Views: 1658
Reputation: 3748
You have to pass data
into the lodash's map
function.
_.map(data, a => _.omit(a, 'inputDate'))
The result:
[ { billingCycle: 6, total: 1 }, { billingCycle: 1, total: 1 } ]
Upvotes: 1