Fix split (with unknown)

This commit is contained in:
Jaco Greeff 2020-09-30 18:40:57 +02:00
parent 32ee7ef17f
commit 8ca090f5b6

View File

@ -32,9 +32,9 @@ interface UrlState {
function textToParts (text: string): [string, string, string] {
const [first, remainder] = text.replace(')', '').split(' (');
const [middle, last] = remainder.split(', ');
const [middle, last] = (remainder || '').split(', ');
return [first, middle, last];
return [first, middle || '', last || ''];
}
function isValidUrl (url: string): boolean {