iceshrimp-legacy/src/misc/extract-hashtags.ts
marihachi 1ec3338d2e
update mfm.js (#7435)
* use mfm.js 0.14.0

* use mfm.extract

* use mfm.extract

* use mfm.extract
2021-04-11 00:18:29 +09:00

10 lines
304 B
TypeScript

import * as mfm from 'mfm-js';
import { unique } from '@/prelude/array';
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;
}