mirror of
https://github.com/misskey-dev/misskey
synced 2024-06-02 16:50:02 +02:00
c1514ce91d
Fix #13290
15 lines
436 B
TypeScript
15 lines
436 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import * as mfm from 'mfm-js';
|
|
import { unique } from '@/misc/prelude/array.js';
|
|
|
|
export function extractHashtags(nodes: mfm.MfmNode[]): string[] {
|
|
const hashtagNodes = mfm.extract(nodes, (node) => node.type === 'hashtag') as mfm.MfmHashtag[];
|
|
const hashtags = unique(hashtagNodes.map(x => x.props.hashtag));
|
|
|
|
return hashtags;
|
|
}
|