mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-14 21:31:50 +00:00
Fix error when getUrlsInString doesn't match any URLs
This commit is contained in:
parent
a905e82492
commit
490dc587a2
1 changed files with 1 additions and 1 deletions
|
@ -185,7 +185,7 @@ const urlRegex = /(\S+\.\S+)/g;
|
|||
const protocolRegex = /^[a-z]+:\/\//;
|
||||
|
||||
export function getUrlsInString(str: string, unique = false): url.URL[] {
|
||||
let matches = str.match(urlRegex).map(m => m[0]) || [];
|
||||
let matches = (str.match(urlRegex) || []).map(m => m[0]);
|
||||
if (unique) matches = Array.from(new Set(matches));
|
||||
|
||||
return matches.reduce((urls, match) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue