0

I am trying to do something fairly simple - given an array strings as input I want to get an array of objects with specified attributes like

const summaryAggFields = ['f1', 'f2', 'f3', 'f4'];
const summaryAggFieldMap = lodash.map(summaryAggFields, f =>  {field: f, aggregate: 'sum'});

summaryAggFieldMap should be be like [{field:'f1', aggregate: 'sum'}, ...]

What is the correct way to do this? Thanks Anand

Anand
  • 1,387
  • 2
  • 26
  • 48

0 Answers0