iceshrimp-legacy/packages/client/src/scripts/extract-mfm.ts
ThatOneCalculator b5eb374e62
fix fade
2023-05-22 17:26:27 -07:00

23 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;
}