mirror of
https://git.joinfirefish.org/firefish/firefish.git
synced 2024-05-05 11:21:12 +02:00
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;
|
|
}
|