Created
November 16, 2017 16:25
-
-
Save balthazar/57e4935f83d3f16b5c2194e53b60adc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const dates = stars.map(o => new Date(o.starredAt)) | |
const grouped = _.groupBy(dates, d => format(d, 'YYYY/MM/DD')) | |
const byDay = Object.keys(grouped).reduce((acc, date, i) => { | |
const count = grouped[date].length | |
return acc.concat({ date, stars: count, total: i === 0 ? count : count + acc[i - 1].total }) | |
}, []) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment