2018-08-20 02:31:54 +00:00
|
|
|
import { replaceAll } from './strings'
|
2018-11-20 08:01:23 +00:00
|
|
|
import { replaceEmoji } from './replaceEmoji'
|
2018-08-20 02:31:54 +00:00
|
|
|
|
|
|
|
export function removeEmoji (text, emojis) {
|
|
|
|
// remove custom emoji
|
|
|
|
if (emojis) {
|
|
|
|
for (let emoji of emojis) {
|
|
|
|
let shortcodeWithColons = `:${emoji.shortcode}:`
|
|
|
|
text = replaceAll(text, shortcodeWithColons, '')
|
|
|
|
}
|
|
|
|
}
|
2018-11-20 08:01:23 +00:00
|
|
|
// remove native emoji
|
|
|
|
return replaceEmoji(text, () => '').trim()
|
2018-08-20 02:31:54 +00:00
|
|
|
}
|