code: function loadScripts(transformFn, scripts) {
    const result = [];
    const count = scripts.length;
  
    function check() {
      let script, i;
  
      for (i = 0; i < count; i++) {
        script = result[i];
  
        if (script.loaded && !script.executed) {
          script.executed = true;
          run(transformFn, script);
        } else if (!script.loaded && !script.error && !script.async) {
          break;
        }
      }
    }
  
    scripts.forEach((script, i) => {
      const scriptData = {
        // script.async is always true for non-JavaScript script tags
        async: script.hasAttribute("async"),
        error: false,
        executed: false,
        plugins: getPluginsOrPresetsFromScript(script, "data-plugins"),
        presets: getPluginsOrPresetsFromScript(script, "data-presets"),
      };
  
      if (script.src) {
        result[i] = {
          ...scriptData,
          content: null,
          loaded: false,
          url: script.src,
        };
  
        load(
          script.src,
          content => {
            result[i].loaded = true;
            result[i].content = content;
            check();
          },
          () => {
            result[i].error = true;
            check();
          },
        );
      } else {
        result[i] = {
          ...scriptData,
          content: script.innerHTML,
          loaded: true,
          url: script.getAttribute("data-module") || null,
        };
      }
    });
  
    check();
  }
docs: Loop over provided script tags and get the content, via innerHTML if an
  inline script, or by using XHR. Transforms are applied if needed. The scripts
  are executed in the order they are found on the page.