UNPKG

yoastseo

Version:

Yoast client-side content analysis

23 lines (22 loc) 815 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = areWordsInSentence; var _lodash = require("lodash"); var _getWords = _interopRequireDefault(require("./getWords.js")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Checks if one or more words of a list occur in a sentence. * * @param {Array} words The list of words. * @param {string} sentence The sentence to match against. * @returns {Boolean} Whether the sentence contains the word. */ function areWordsInSentence(words, sentence) { const matches = (0, _lodash.filter)((0, _getWords.default)(sentence), function (word) { return words.includes(word.toLocaleLowerCase()); }); return matches.length !== 0; } //# sourceMappingURL=areWordsInSentence.js.map