pinafore/src/routes/_utils/removeEmoji.js

15 lines
400 B
JavaScript
Raw Normal View History

import { replaceAll } from './strings'
import { replaceEmoji } from './replaceEmoji'
export function removeEmoji (text, emojis) {
// remove custom emoji
if (emojis) {
2019-08-03 13:49:37 -07:00
for (const emoji of emojis) {
const shortcodeWithColons = `:${emoji.shortcode}:`
text = replaceAll(text, shortcodeWithColons, '')
}
}
// remove native emoji
return replaceEmoji(text, () => '').trim()
}