Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | 68x 15x 15x 15x 15x 68x 3x 3x 3x 3x 3x 3x 3x 3x | /** * Returns the global scope `Window`, `WorkerGlobalScope`, or `NodeJS.Global` if available in the * currently executing environment. * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/self * @see https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/self * @see https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope * * This could be switched to `globalThis` once it is standardized and widely available. * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis * @ignore */ export function getGlobalScope(): Window { Iif (typeof self !== 'undefined') { return self; } Iif (typeof window !== 'undefined') { return window; } // This function is meant to be called when accessing APIs that are typically only available in // web-browser/DOM environments, but we also want to support situations where running in Node.js // environment, and a polyfill was added to the Node.js `global` object scope without adding the // `window` global object as well. if (typeof global !== 'undefined') { return global as unknown as Window; } throw new Error( 'Unexpected runtime environment - no supported global scope (`window`, `self`, `global`) available' ); } export function getTokenFileUrl(zoneFileJson: any): string | null { Iif (!zoneFileJson.hasOwnProperty('uri')) { return null; } Iif (!Array.isArray(zoneFileJson.uri)) { return null; } Iif (zoneFileJson.uri.length < 1) { return null; } const firstUriRecord = zoneFileJson.uri[0]; Iif (!firstUriRecord.hasOwnProperty('target')) { return null; } let tokenFileUrl = firstUriRecord.target; if (tokenFileUrl.startsWith('https')) { // pass } else Eif (tokenFileUrl.startsWith('http')) { // pass } else { tokenFileUrl = `https://${tokenFileUrl}`; } return tokenFileUrl; } |