MCPcopy Create free account
hub / github.com/Tjatse/node-readability / getClassWeight

Function getClassWeight

lib/reader.js:609–621  ·  view source on GitHub ↗

* Get a node's weight by regular expressions. * @param node the node element. * @return {Number}

(node)

Source from the content-addressed store, hash-verified

607 * @return {Number}
608 */
609function getClassWeight(node){
610 var weight = 0;
611
612 var classAndId = [node.attr('class') || '', node.attr('id') || ''].join(' ');
613 if (classAndId.search(regexps.negative) >= 0) {
614 weight -= 25;
615 }
616 if (classAndId.search(regexps.positive) >= 0) {
617 weight += 25;
618 }
619
620 return weight;
621}
622
623/**
624 * Get the density of links as a percentage of the content.

Callers 1

initNodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…