summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/extract-mentions.ts
blob: cc19b161a8788bed6a93b32ac90888a480e0eb0c (plain)
1
2
3
4
5
6
7
8
9
10
11
// test is located in test/extract-mentions

import * as mfm from 'mfm-js';

export function extractMentions(nodes: mfm.MfmNode[]): mfm.MfmMention['props'][] {
	// TODO: 重複を削除
	const mentionNodes = mfm.extract(nodes, (node) => node.type === 'mention');
	const mentions = mentionNodes.map(x => x.props);

	return mentions;
}