All files / lib/util has-module.js

100% Statements 15/15
66.66% Branches 2/3
100% Functions 1/1
100% Lines 15/15

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 162x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 2x 7x 7x  
import globalThis from './global';
 
// Safely lookup if we have access to a SCRIPT element for testing module support.
const element = /** @type {any} */ (globalThis).document
  ? /** @type {HTMLScriptElement} */ (document.createElement('script'))
  : null;
 
/**
 * Determines if the executing environment supports modules or not.
 *
 * @return {Boolean} - Whether or not modules are supported.
 */
export default function hasModule() {
  return Boolean(element && 'noModule' in element);
}