mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
20 lines
429 B
TypeScript
20 lines
429 B
TypeScript
import { UnsignedEvent } from 'nostr-tools';
|
|
|
|
import { EmojiTag, emojiTagSchema } from '@/schemas/nostr.ts';
|
|
import { filteredArray } from '@/schema.ts';
|
|
|
|
function renderEmoji([_, shortcode, url]: EmojiTag) {
|
|
return {
|
|
shortcode,
|
|
static_url: url,
|
|
url,
|
|
};
|
|
}
|
|
|
|
function renderEmojis({ tags }: UnsignedEvent) {
|
|
return filteredArray(emojiTagSchema)
|
|
.parse(tags)
|
|
.map(renderEmoji);
|
|
}
|
|
|
|
export { renderEmojis };
|