1
0
mirror of https://github.com/misskey-dev/misskey synced 2024-12-23 19:19:05 +09:00
misskey/src/misc/extract-mentions.ts

11 lines
383 B
TypeScript
Raw Normal View History

// test is located in test/extract-mentions
2018-12-19 11:16:29 +09:00
import { MentionNode, MfmForest } from '../mfm/prelude';
import { preorderF } from '../prelude/tree';
2018-12-19 11:16:29 +09:00
export default function(mfmForest: MfmForest): MentionNode['props'][] {
// TODO: 重複を削除
const mentionNodes = preorderF(mfmForest).filter(x => x.type === 'mention') as MentionNode[];
return mentionNodes.map(x => x.props);
2018-12-19 11:16:29 +09:00
}