yoastseo
Version:
Yoast client-side content analysis
26 lines (25 loc) • 770 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = buildFormRule;
/**
* Checks if the input word qualifies for the input regex and if so builds a required form.
* This function is used for other more specific functions.
*
* @param {string} word The word to build forms for.
* @param {Array} regexes The regex-based array of rules to compare the word against.
*
* @returns {string} The newly built form of the word.
*/
function buildFormRule(word, regexes) {
if (regexes.includes(null)) {
return word;
}
for (let i = 0; i < regexes.length; i++) {
if (regexes[i].reg.test(word) === true) {
return word.replace(regexes[i].reg, regexes[i].repl);
}
}
}
//# sourceMappingURL=buildFormRule.js.map