[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

@ -2,7 +2,15 @@
* Link
*/
module.exports = text => {
export type TextElementLink = {
type: "link"
content: string
title: string
url: string
silent: boolean
};
export default function(text: string) {
const match = text.match(/^\??\[([^\[\]]+?)\]\((https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+?)\)/);
if (!match) return null;
const silent = text[0] == '?';
@ -15,5 +23,5 @@ module.exports = text => {
title: title,
url: url,
silent: silent
};
};
} as TextElementLink;
}