1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-15 01:05:42 +02:00

[noImplicitAny: true] src/text

This commit is contained in:
rinsuki
2018-06-17 19:55:39 +09:00
parent 871f886702
commit 8c40917cc2
16 changed files with 166 additions and 44 deletions

View File

@@ -3,7 +3,14 @@
*/
import parseAcct from '../../../acct/parse';
module.exports = text => {
export type TextElementMention = {
type: "mention"
content: string
username: string
host: string
};
export default function(text: string) {
const match = text.match(/^@[a-z0-9_]+(?:@[a-z0-9\.\-]+[a-z0-9])?/i);
if (!match) return null;
const mention = match[0];
@@ -13,5 +20,5 @@ module.exports = text => {
content: mention,
username,
host
};
};
} as TextElementMention;
}