summaryrefslogtreecommitdiff
path: root/src/api/common/text/elements/mention.ts
blob: e0fac4dd765679ed68822ebf985343883301cfca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/**
 * Mention
 */

module.exports = text => {
	const match = text.match(/^@[a-zA-Z0-9\-]+/);
	if (!match) return null;
	const mention = match[0];
	return {
		type: 'mention',
		content: mention,
		username: mention.substr(1)
	};
};