Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function scoreByLength(fnode) {
let length = Futils.inlineTextLength(fnode.element) * 2;
if (Number.isNaN(length))
length = 0; // Penalize empty nodes
return {
score: length,
note: {length},
};
}
function scoreByLength(fnode) {
let length = Futils.inlineTextLength(fnode.element) * 2;
if (Number.isNaN(length))
length = 0; // Penalize empty nodes
return {
score: length,
note: {length},
};
}
function scoreByImageSize(fnode) {
const img = fnode.element.querySelector('img');
const width = img.getAttribute('width');
const height = img.getAttribute('height');
let length = Futils.inlineTextLength(fnode.element) * 2;
if (Number.isNaN(length))
length = 1; // Don't penalize empty captions
return {
score: width && height ? width * height / 100 : 100,
note: {length},
};
}
function scoreByImageSize(fnode) {
const img = fnode.element.querySelector('img');
const width = img.getAttribute('width');
const height = img.getAttribute('height');
let length = Futils.inlineTextLength(fnode.element) * 2;
if (Number.isNaN(length))
length = 1; // Don't penalize empty captions
return {
score: width && height ? width * height / 100 : 100,
note: {length},
};
}
const scoreByLength = ({ element }) => ({
score: inlineTextLength(element),
})