Last active
December 19, 2018 09:24
-
-
Save rescribet/8723c2e6aa6326352ac3d1f9f3d37810 to your computer and use it in GitHub Desktop.
Snippet to count the amount of lines added/removed in bitbucket pull requests
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
(function countLines() { | |
let addedArr = []; | |
let removedArr = []; | |
document.querySelectorAll('#commit-files-summary .lines-added').forEach((n) => { addedArr.push(n.innerText) }); | |
document.querySelectorAll('#commit-files-summary .lines-removed').forEach((n) => { removedArr.push(n.innerText) }); | |
let added = addedArr | |
.map((n) => parseInt(n)) | |
.reduce((a, b) => { return b + a } ); | |
let removed = removedArr | |
.map((n) => parseInt(n)) | |
.reduce((a, b) => { return b + a } ); | |
return added + removed; | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment