2023-01-13 05:40:33 +01:00
|
|
|
import * as mfm from "mfm-js";
|
|
|
|
import { unique } from "@/prelude/array.js";
|
2021-04-02 03:36:11 +02:00
|
|
|
|
2021-04-10 10:50:18 +02:00
|
|
|
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
2023-01-13 05:40:33 +01:00
|
|
|
const hashtagNodes = mfm.extract(nodes, (node) => node.type === "hashtag");
|
|
|
|
const hashtags = unique(hashtagNodes.map((x) => x.props.hashtag));
|
2021-04-02 03:36:11 +02:00
|
|
|
|
2021-04-10 17:18:29 +02:00
|
|
|
return hashtags;
|
2018-12-20 11:41:04 +01:00
|
|
|
}
|