hippofish/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts
syuilo d071d18dd7
refactor: Use ESM (#8358)
* wip

* wip

* fix

* clean up

* Update tsconfig.json

* Update activitypub.ts

* wip
2022-02-27 11:07:39 +09:00

10 lines
335 B
TypeScript

import * as mfm from 'mfm-js';
import { unique } from '@/prelude/array.js';
export function extractCustomEmojisFromMfm(nodes: mfm.MfmNode[]): string[] {
const emojiNodes = mfm.extract(nodes, (node) => {
return (node.type === 'emojiCode' && node.props.name.length <= 100);
});
return unique(emojiNodes.map(x => x.props.name));
}