Skip to content

Instantly share code, notes, and snippets.

@gcpantazis
Created April 3, 2015 00:17
Show Gist options
  • Save gcpantazis/03cf5fdd87cf710210ca to your computer and use it in GitHub Desktop.
Save gcpantazis/03cf5fdd87cf710210ca to your computer and use it in GitHub Desktop.
Getting sum halstead effort from jscomplexity.org
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