This commit is contained in:
syuilo
2017-03-18 01:16:32 +09:00
parent 5ad77e8a3a
commit bc3006f3c4
9 changed files with 92 additions and 17 deletions

View File

@@ -3,11 +3,12 @@
*/
module.exports = text => {
const match = text.match(/^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+/);
const match = text.match(/^https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+/);
if (!match) return null;
const link = match[0];
const url = match[0];
return {
type: 'link',
content: link
type: 'url',
content: url,
url: url
};
};