blob: 2ad27883009935a02ad08ff5b25db8a00d16d80c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/**
* Mention
*/
import parseAcct from '../../../acct/parse';
module.exports = text => {
const match = text.match(/^@[a-z0-9_]+(?:@[a-z0-9\.\-]+[a-z0-9])?/i);
if (!match) return null;
const mention = match[0];
const { username, host } = parseAcct(mention.substr(1));
return {
type: 'mention',
content: mention,
username,
host
};
};
|