My current data structure looks like this:
var data = [
{ MainHeader: Header1, SubHeader: 'one'},
{ MainHeader: Header1, SubHeader: 'two'},
{ MainHeader: Header2, SubHeader: 'three'},
{ MainHeader: Header2, SubHeader: 'four'},
{ MainHeader: Header2, SubHeader: 'five'}
];
I am looking to transform it into the following format:
var groupheaders = [
{ startColName: 'one', numberofCols: 2, title: Header1},
{ startColName: 'three', numberofCols: 3, title: Header2}
];
Does anyone know of a graceful solution to achieve this using Lodash?