param url returns export function isExternalUrl ( url ) { try { return ! ! new URL ( url ) ; } catch ( _ ) { return false ; } } param urlOrPath param baseUrl returns export function createUrl ( urlOrPath , baseUrl ? ) { let base = baseUrl ; if ( ! base && ! isExternalUrl ( urlOrPath ) ) { base = 'http://tmp.com' ; } return new URL ( urlOrPath , base ) ; }