UNPKG

yoastseo

Version:

Yoast client-side content analysis

29 lines (28 loc) 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _getWords = _interopRequireDefault(require("./getWords")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Matches the sentence against transition words. * * @param {string} sentence The sentence to match against. * @param {Array} transitionWords The array containing transition words. * @returns {Array} The found transitional words. */ function _default(sentence, transitionWords) { // Retrieve the words from the segmenter, join into string for easier comparison through the contains function. const words = (0, _getWords.default)(sentence).join("|"); const results = []; transitionWords.forEach(function (transitionWord) { // The transitionWords are segmented, like the sentence, so join here as well. const target = transitionWord.join("|"); if (words.includes(target)) { results.push(transitionWord); } }); return results; } //# sourceMappingURL=matchTransitionWords.js.map