*/
export function twemojify(text, opts, linkify = false, sanitize = true) {
if (typeof text !== 'string') return text;
- let content = sanitize ? twemoji.parse(sanitizeText(text), opts) : twemoji.parse(text, opts);
+ let content = text;
+
+ if (sanitize) {
+ content = sanitizeText(content);
+ }
+ content = twemoji.parse(content, opts);
if (linkify) {
- content = linkifyHtml(content, { target: '_blank', rel: 'noreferrer noopener' });
+ content = linkifyHtml(content, {
+ target: '_blank',
+ rel: 'noreferrer noopener',
+ });
}
return parse(content);
}