Created
April 3, 2015 00:17
-
-
Save gcpantazis/03cf5fdd87cf710210ca to your computer and use it in GitHub Desktop.
Getting sum halstead effort from jscomplexity.org
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
var labels = document.querySelectorAll('.label'); | |
var matchedLabels = []; | |
for (var i = 0; i < labels.length; i++) { | |
if (labels[i].innerText.match('Halstead effort')) { | |
matchedLabels.push(labels[i]); | |
} | |
} | |
matchedLabels.reduce(function(memo, item) { | |
var value = item.parentNode.querySelector('.value').innerText * 1; | |
return memo + value | |
}, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment