<commit_before>/*!
 * Dope.js - The aerogel-weight & dead-simple conditional resource loader.
 * Encoded by <NAME> <<EMAIL>>
 * Version 1.0
 *
 * Dual licensed under the MIT and BSD-2-clause licenses.
 * Examples and documentation at: https://github.com/bricss/dope
 */
(function() {'use strict';
  this.dope = function(deps, callback, delay, decay) {
    var head = document.documentElement && document.documentElement.firstChild || document.getElementsByTagName('head')[0];
    var list = [];
    var queue = null;
    // typeof (deps) === 'string' ? deps = [deps] : deps = deps;
    // deps instanceof Array ? deps = deps : deps = [deps];
    // deps.constructor === String ? deps = [deps] : deps = deps;
    deps && deps.constructor !== Array && ( deps = [deps]);
    // fastest
    deps.reverse();
    for (var i = queue = deps.length; i--; ) {
      var el = null;
      // var type = /(\.js|\.css)/.exec(deps[i])[0].replace('.', '').toLowerCase();
      var type = deps[i].substr(deps[i].lastIndexOf('.') + 1).toLowerCase();
      switch(type) {
        case 'js':
          el = document.createElement('script');
          el.async = false;
          el.src = deps[i];
          break;
        case 'css':
          el = document.createElement('link');
          el.href = deps[i];
          el.rel = 'stylesheet';
          break;
        default:
          console.warn('Something went wrong:', deps[i]);
          throw 'Unsupported type';
      }

      if (callback && typeof (callback) === 'function') {
        el.onload = el.onreadystatechange = function(ev) {
          if (ev && ev.type === 'load' || /loaded|complete/.test(this.readyState)) {
            this.onload = this.onreadystatechange = null;
            (!--queue) && setTimeout(function() {
              callback();
            }, delay);
          }
        }
      }

      el.onerror = function(ev) {
        console.warn('Target is not defined:', ev.target);
      }

      list.push(head.appendChild(el));
    }

    var waste = function() {
      for (var i = list.length; i--; ) {
        head.removeChild(list[i]);
        delete list[i];
      }
    }
    if (decay) {
      setTimeout(function() {
        if (!queue || queue > 0) {
          waste();
        }
      }, decay);
    }

  }
}).call(this);<commit_msg>Release<commit_after>/*!
 * Dope.js - The aerogel-weight & dead-simple conditional resource loader.
 * Encoded by <NAME> <<EMAIL>>
 * Version 1.0
 *
 * Dual licensed under the MIT and BSD-2-clause licenses.
 * Examples and documentation at: https://github.com/bricss/dope
 */
(function() {'use strict';
  this.dope = function(deps, callback, delay, decay) {
    var head = document.documentElement && document.documentElement.firstChild || document.getElementsByTagName('head')[0];
    var list = [];
    var queue = null;
    // typeof (deps) === 'string' ? deps = [deps] : deps = deps;
    // deps instanceof Array ? deps = deps : deps = [deps];
    // deps.constructor === String ? deps = [deps] : deps = deps;
    deps && deps.constructor !== Array && (deps = [deps]); // fastest
    deps.reverse();
    for (var i = queue = deps.length; i--;) {
      var el = null;
      // var type = /(\.js|\.css)/.exec(deps[i])[0].replace('.', '').toLowerCase();
      var type = deps[i].substr(deps[i].lastIndexOf('.') + 1).toLowerCase();
      switch(type) {
        case 'js':
          el = document.createElement('script');
          el.async = false;
          el.src = deps[i];
          break;
        case 'css':
          el = document.createElement('link');
          el.href = deps[i];
          el.rel = 'stylesheet';
          break;
        default:
          console.warn('Something went wrong:', deps[i]);
          throw 'Unsupported type';
      }

      if (callback && typeof (callback) === 'function') {
        el.onload = el.onreadystatechange = function(ev) {
          if (ev && ev.type === 'load' || /loaded|complete/.test(this.readyState)) {
            this.onload = this.onreadystatechange = null;
            (!--queue) && setTimeout(function() {
              callback();
            }, delay);
          }
        }
      }

      el.onerror = function(ev) {
        console.warn('Target is not defined:', ev.target);
      }

      list.push(head.appendChild(el));
    }

    var waste = function() {
      for (var i = list.length; i--;) {
        head.removeChild(list[i]);
        delete list[i];
      }
    }
    if (decay) {
      setTimeout(function() {
        if (!queue || queue > 0) {
          waste();
        }
      }, decay);
    }

  }
}).call(this);
{'fraction_non_alphanumeric': 0.17177647314633615, 'fraction_numerical': 0.0030441400304414, 'mean_word_length': 2.0463576158940397, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '25405', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1438, 'n_words': 329}