Created
January 26, 2017 00:23
-
-
Save xkxd/33bf6494f501721360fb461668a46c16 to your computer and use it in GitHub Desktop.
get total number of lines of code in github repository
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
| // go to `Contributors` and paste this in console | |
| function linesOfCode(addedCssSelector = '.a', removedCssSelector = '.d') { | |
| const repoName = document.querySelector('[itemprop=name] a').innerText; | |
| const getLOC = (selector) => | |
| Array.from(document.querySelectorAll(`.cmeta ${selector}`)) | |
| .reduce(((sum, element) => | |
| sum += +element.innerText.replace(',','').slice(0, -2)), 0) | |
| return `Total number of LOC in >>${repoName}<< repository is ${getLOC(addedCssSelector) - getLOC(removedCssSelector)}`; | |
| } | |
| linesOfCode(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment