Mirror of https://github.com/roostorg/coop
github.com/roostorg/coop
1// Solution from https://stackoverflow.com/questions/10992921/how-to-remove-emoji-code-using-javascript
2export function stripEmojis(input: string) {
3 return input.replace(
4 /(?![*#0-9]+)[\p{Emoji}\p{Emoji_Modifier}\p{Emoji_Component}\p{Emoji_Modifier_Base}\p{Emoji_Presentation}]/gu,
5 '',
6 );
7}
8
9export function replaceEmptyStringWithNull(input: string | null | undefined) {
10 return input === '' ? null : input;
11}