Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ { game_id: 1171,
- date: '2016-11-17T05:00:00.000Z',
- time: '08:00:00',
- category: 'Ch B Coed',
- background: '#FFFF00',
- textcolor: '#000000',
- bold: 0,
- sport: 'Newcomb',
- location: 'Plaza',
- text: 'COL2 vs. USA1 1171' },
- { game_id: 1189,
- date: '2016-11-17T05:00:00.000Z',
- time: '08:50:00',
- category: 'Ch A Coed',
- background: '#FF33CC',
- textcolor: '#000000',
- bold: 0,
- sport: 'Kickball',
- location: 'Field - Kickball',
- text: 'COL1 vs. USA1 1189' },
- { game_id: 1489,
- date: '2016-2-17T05:00:00.000Z',
- time: '04:50:00',
- category: 'Ch B Coed',
- background: '#FF33CC',
- textcolor: '#000000',
- bold: 0,
- sport: 'Kickball',
- location: 'Field - Kickball',
- text: 'COL2 vs. USA3 1489' }
- ]
- [
- {title:"2016-11-17T05:00:00.000Z",data: [
- {
- game_id: 1489,
- date: '2016-2-17T05:00:00.000Z',
- time: '04:50:00',
- category: 'Ch B Coed',
- background: '#FF33CC',
- textcolor: '#000000',
- bold: 0,
- sport: 'Kickball',
- location: 'Field - Kickball',
- text: 'COL2 vs. USA3 1489'
- },
- {
- game_id: 1189,
- date: '2016-11-17T05:00:00.000Z',
- time: '08:50:00',
- category: 'Ch A Coed',
- background: '#FF33CC',
- textcolor: '#000000',
- bold: 0,
- sport: 'Kickball',
- location: 'Field - Kickball',
- text: 'COL1 vs. USA1 1189' },
- }
- },
- {title: "2016-11-17T05:00:00.000Z", data: [
- {
- game_id: 1171,
- date: '2016-11-17T05:00:00.000Z',
- time: '08:00:00',
- category: 'Ch B Coed',
- background: '#FFFF00',
- textcolor: '#000000',
- bold: 0,
- sport: 'Newcomb',
- location: 'Plaza',
- text: 'COL2 vs. USA1 1171'
- }
- ]
- ]
- const games = [data here]
- var groups = _(games)
- .groupBy(x => x.date)
- .map(value => {
- return _.groupBy(value, 'location')
- .map(({key, value}) => ({title: key, data: value}))
- })
- .map((value, key) => {
- return ({title: value[Object.keys(value)[0]][0].date, data: value})
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement