diff options
Diffstat (limited to 'src/text/parse/elements/url.ts')
| -rw-r--r-- | src/text/parse/elements/url.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/text/parse/elements/url.ts b/src/text/parse/elements/url.ts index 1003aff9c3..bbc27b4fd7 100644 --- a/src/text/parse/elements/url.ts +++ b/src/text/parse/elements/url.ts @@ -2,7 +2,13 @@ * URL */ -module.exports = text => { +export type TextElementUrl = { + type: "url" + content: string + url: string +}; + +export default function(text: string) { const match = text.match(/^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+/); if (!match) return null; const url = match[0]; @@ -10,5 +16,5 @@ module.exports = text => { type: 'url', content: url, url: url - }; -}; + } as TextElementUrl; +} |