mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-29 21:37:34 -07:00
22 lines
414 B
TypeScript
22 lines
414 B
TypeScript
import * as mfm from "mfm-js";
|
|
|
|
const animatedMfm = [
|
|
"tada",
|
|
"jelly",
|
|
"twitch",
|
|
"shake",
|
|
"spin",
|
|
"jump",
|
|
"bounce",
|
|
"rainbow",
|
|
"fade",
|
|
];
|
|
|
|
export function extractMfmWithAnimation(nodes: mfm.MfmNode[]): string[] {
|
|
const mfmNodes = mfm.extract(nodes, (node) => {
|
|
return node.type === "fn" && animatedMfm.indexOf(node.props.name) > -1;
|
|
});
|
|
const mfms = mfmNodes.map((x) => x.props.fn);
|
|
|
|
return mfms;
|
|
}
|