2018-08-19 19:31:54 -07:00
|
|
|
import { replaceAll } from './strings'
|
2018-11-20 00:01:23 -08:00
|
|
|
import { replaceEmoji } from './replaceEmoji'
|
2018-08-19 19:31:54 -07: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 00:01:23 -08:00
|
|
|
// remove native emoji
|
|
|
|
return replaceEmoji(text, () => '').trim()
|
2018-08-19 19:31:54 -07:00
|
|
|
}
|