hippofish/packages/backend/src/misc/extract-custom-emojis-from-mfm.ts
ThatOneCalculator 623cadf981
Revert "chore: lint import order"
This reverts commit 8d3c35c0c6.
2023-12-04 23:12:10 -08: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));
}