yoastseo-dep
Version:
Yoast clientside page analysis
25 lines (21 loc) • 652 B
JavaScript
import { languageProcessing } from "yoastseo-dep";
const { getWords } = languageProcessing;
import participles from "../../config/internal/participles.js";
import { forEach, includes } from "lodash-es";
/**
* Creates an array of participles found in a clause.
*
* @param {string} clauseText The clause to finds participles in.
*
* @returns {Array} The array with the participles.
*/
export default function( clauseText ) {
const words = getWords( clauseText );
const foundParticiples = [];
forEach( words, function( word ) {
if ( includes( participles, word ) ) {
foundParticiples.push( word );
}
} );
return foundParticiples;
}