forked from mirrors/firefish
10 lines
309 B
TypeScript
10 lines
309 B
TypeScript
import * as mfm from "mfm-js";
|
|
import { unique } from "@/prelude/array.js";
|
|
|
|
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
|
const hashtagNodes = mfm.extract(nodes, (node) => node.type === "hashtag");
|
|
const hashtags = unique(hashtagNodes.map((x) => x.props.hashtag));
|
|
|
|
return hashtags;
|
|
}
|