yoastseo
Version:
Yoast client-side content analysis
26 lines (24 loc) • 727 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
exports.imageRegex = void 0;
/**
* @returns {RegExp} A precompiled regex for recognizing self-closing image tags.
*/
const imageRegex = exports.imageRegex = new RegExp("<img(?:[^>]+)?>(</img>)*", "ig");
/**
* Retrieves all image tags from a given text string.
*
* @param {string} text The text string to check for images.
* @returns {RegExpMatchArray|[]} An array containing all types of found images.
*/
function _default(text) {
// Early return if the text is not a string.
if (typeof text !== "string") {
return [];
}
return text.match(imageRegex) || [];
}
//# sourceMappingURL=imageInText.js.map