I have an array like this:
var array = [ {
'data-price': '0.00',
'data-term': '532',
'data-model_id': '409',
},
{
'data-price': '0.00',
'data-term': '483',
'data-model_id': '384',
},
{ text: 'dffdfddgfdgf' } ];
I want to filter out the last object and extract [{data-model_id:409},{data-model_id:384}] from the first two objects. I have tried this code:
var k = _(array).filter('data-model_id').pluck('data-model_id').value();
console.log(k);
and it returns an array of the values only, ["409", "384"] . Is there a function to return the whole objects in lodash or underscore?