yoda-seo-tips
Version:
SEO tips from Yoda
33 lines • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
function mustHaveAttribute(tagName, attribute, message) {
return function ($, report) {
let errorCount = 0;
$(tagName).each((i, e) => {
if (e.attribs[attribute] === undefined) {
errorCount += 1;
}
});
if (errorCount > 0) {
report(message(errorCount));
}
};
}
exports.mustHaveAttribute = mustHaveAttribute;
function mustHaveElement(selector, message) {
return function ($, report) {
if ($(selector).length == 0) {
report(message());
}
};
}
exports.mustHaveElement = mustHaveElement;
function mustHaveNoMoreThan(selector, howMany, message) {
return function ($, report) {
if ($(selector).length > howMany) {
report(message($(selector).length));
}
};
}
exports.mustHaveNoMoreThan = mustHaveNoMoreThan;
//# sourceMappingURL=rules.js.map