Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(url => {
const params = getAllUriParams(url)
const useProxy = params.proxyUrl !== undefined || url.match(/#(https?:\/\/\S+)$/) !== null
const documentUri = fetchUriParams(url, 'uri', undefined) || nth(1, url.match(/#(https?:\/\/\S+)$/)) || nth(1, document.URL.match(/#(examples\/\S+)$/))
const baseUri = window.location.origin // location.protocol + '//' + location.host + location.pathname
// console.log('useProxy', useProxy, documentUri, baseUri)
if (!documentUri) {
return undefined
}
const urlData = new URL(documentUri)
console.log('urlData', urlData, params, documentUri)
const documentUris = documentUri ? [documentUri] : undefined
const { protocol, origin, pathname } = urlData
return { documentUris, protocol: protocol.replace(':', ''), origin, path: pathname }
})
])