2022-03-12 13:01:00 -08:00
|
|
|
/**
|
|
|
|
* Emoji normalizer:
|
|
|
|
* Converts API emojis into our internal format.
|
|
|
|
* @see {@link https://docs.joinmastodon.org/entities/emoji/}
|
|
|
|
*/
|
2022-03-16 19:33:09 -07:00
|
|
|
import { Record as ImmutableRecord, Map as ImmutableMap, fromJS } from 'immutable';
|
2022-03-11 18:48:00 -08:00
|
|
|
|
|
|
|
// https://docs.joinmastodon.org/entities/emoji/
|
2022-03-16 19:15:38 -07:00
|
|
|
export const EmojiRecord = ImmutableRecord({
|
2022-03-11 18:48:00 -08:00
|
|
|
category: '',
|
|
|
|
shortcode: '',
|
|
|
|
static_url: '',
|
|
|
|
url: '',
|
|
|
|
visible_in_picker: true,
|
|
|
|
});
|
|
|
|
|
2022-03-16 19:33:09 -07:00
|
|
|
export const normalizeEmoji = (emoji: Record<string, any>) => {
|
|
|
|
return EmojiRecord(
|
|
|
|
ImmutableMap(fromJS(emoji)),
|
|
|
|
);
|
2022-03-11 18:48:00 -08:00
|
|
|
};
|