2021-04-02 01:36:11 +00:00
|
|
|
import * as mfm from 'mfm-js';
|
2022-02-27 02:07:39 +00:00
|
|
|
import { unique } from '@/prelude/array.js';
|
2021-04-02 01:36:11 +00:00
|
|
|
|
2021-04-10 08:50:18 +00:00
|
|
|
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
2021-04-10 15:18:29 +00:00
|
|
|
const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag');
|
|
|
|
const hashtags = unique(hashtagNodes.map(x => x.props.hashtag));
|
2021-04-02 01:36:11 +00:00
|
|
|
|
2021-04-10 15:18:29 +00:00
|
|
|
return hashtags;
|
2018-12-20 10:41:04 +00:00
|
|
|
}
|