Created
June 28, 2016 06:48
-
-
Save futurist/a40359b2ae1dfae7c4e4037b251303d7 to your computer and use it in GitHub Desktop.
get total count lines for repo during 1 week
This file contains hidden or 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
//replace jquery/jquery with the repo you're interested in | |
fetch('https://api.github.com/repos/jquery/jquery/stats/contributors') | |
.then(response => response.json()) | |
.then(contributors => contributors | |
.map(contributor => contributor.weeks | |
.reduce((lineCount, week) => lineCount + week.a - week.d, 0))) | |
.then(lineCounts => lineCounts.reduce((lineTotal, lineCount) => lineTotal + lineCount)) | |
.then(lines => window.alert(lines)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment