UNPKG

yoastseo

Version:

Yoast client-side content analysis

27 lines (26 loc) 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getParticiples; var _lodash = require("lodash"); var _yoastseo = require("yoastseo"); var _passiveVoiceIrregulars = _interopRequireDefault(require("../../config/internal/passiveVoiceIrregulars")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const { getWords, matchRegularParticiples } = _yoastseo.languageProcessing; /** * Creates an array of participle for the participles found in a clause. * * @param {string} clauseText The clause text to find participles in. * * @returns {Array} The list with participle. */ function getParticiples(clauseText) { const words = getWords(clauseText); const regexes = [/^(ge|be|ont|ver|her|er)\S+([dt])($|[ \n\r\t.,'()"+\-;!?:/»«‹›<>])/ig, /^(aan|af|bij|binnen|los|mee|na|neer|om|onder|samen|terug|tegen|toe|uit|vast)(ge)\S+([dtn])($|[ \n\r\t.,'()"+\-;!?:/»«‹›<>])/ig]; return words.filter(word => matchRegularParticiples(word, regexes).length !== 0 || (0, _lodash.includes)(_passiveVoiceIrregulars.default, word)); } //# sourceMappingURL=getParticiples.js.map