mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-24 21:19:07 +01:00
17 lines
407 B
TypeScript
17 lines
407 B
TypeScript
|
import * as mfm from "mfm-js";
|
||
|
|
||
|
const animatedMfm = ["tada", "jelly", "twitch", "shake", "spin", "jump", "bounce", "rainbow"];
|
||
|
|
||
|
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;
|
||
|
}
|