<commit_before>var sportVu = {
  speed: {
    url: "http://stats.nba.com/js/data/sportvu/speedData.js",
    varName: "speedData",
    hasLoaded: false
  },
  touches: {
    url: "http://stats.nba.com/js/data/sportvu/touchesData.js",
    varName: "touchesData",
    hasLoaded: false
  },
  passing: {
    url: "http://stats.nba.com/js/data/sportvu/passingData.js",
    varName: "passingData",
    hasLoaded: false
  },
  defense: {
    url: "http://stats.nba.com/js/data/sportvu/defenseData.js",
    varName: "defenseData",
    hasLoaded: false
  },
  rebounding: {
    url: "http://stats.nba.com/js/data/sportvu/reboundingData.js",
    varName: "reboundingData",
    hasLoaded: false
  },
  drives: {
    url: "http://stats.nba.com/js/data/sportvu/drivesData.js",
    varName: "drivesData",
    hasLoaded: false
  },
  shooting: {
    url: "http://stats.nba.com/js/data/sportvu/shootingData.js",
    varName: "shootingData",
    hasLoaded: false
  },
  catchShoot: {
    url: "http://stats.nba.com/js/data/sportvu/catchShootData.js",
    varName: "catchShootData",
    hasLoaded: false
  },
  pullUpShoot: {
    url: "http://stats.nba.com/js/data/sportvu/pullUpShootData.js",
    varName: "pullUpShootData",
    hasLoaded: false
  }
};

var cache = {};

function getSportVu ( key ) {
  if ( cache[key] ) {
    return cache[key];
  }
  var item = sportVu[key];
  var prev = window[item.varName];


}



module.exports = {};

Object.keys( sportVu ).reduce( function ( obj, key ) {
  obj[key] = function () {
    return getSportVu( key );
  };
}, module.exports );
<commit_msg>working on sportVu<commit_after>var defer = require( "./defer" );

var sportVu = {
  speed: {
    url: "http://stats.nba.com/js/data/sportvu/speedData.js",
    varName: "speedData",
    hasLoaded: false
  },
  touches: {
    url: "http://stats.nba.com/js/data/sportvu/touchesData.js",
    varName: "touchesData",
    hasLoaded: false
  },
  passing: {
    url: "http://stats.nba.com/js/data/sportvu/passingData.js",
    varName: "passingData",
    hasLoaded: false
  },
  defense: {
    url: "http://stats.nba.com/js/data/sportvu/defenseData.js",
    varName: "defenseData",
    hasLoaded: false
  },
  rebounding: {
    url: "http://stats.nba.com/js/data/sportvu/reboundingData.js",
    varName: "reboundingData",
    hasLoaded: false
  },
  drives: {
    url: "http://stats.nba.com/js/data/sportvu/drivesData.js",
    varName: "drivesData",
    hasLoaded: false
  },
  shooting: {
    url: "http://stats.nba.com/js/data/sportvu/shootingData.js",
    varName: "shootingData",
    hasLoaded: false
  },
  catchShoot: {
    url: "http://stats.nba.com/js/data/sportvu/catchShootData.js",
    varName: "catchShootData",
    hasLoaded: false
  },
  pullUpShoot: {
    url: "http://stats.nba.com/js/data/sportvu/pullUpShootData.js",
    varName: "pullUpShootData",
    hasLoaded: false
  }
};

var cache = {};

function getSportVu ( key ) {
  var script, item, prev;
  var deferred = defer();

  if ( cache[key] ) {
    deferred.resolve( cache[key] );
  } else {

    item = sportVu[key];
    prev = window[item.varName];
    script = document.body.createElement( "script" );

    script.src = item.url;

    script.onload = function () {
      cache[key] = window[item.varName];
      window[item.varName] = prev;
      deferred.resolve( cache[key] );
    };

    script.onerror = function () {
      window[item.varName] = prev;
      deferred.reject();
    };

    document.body.appendChild( script );

  }

  return deferred.promise;
}



module.exports = {};

Object.keys( sportVu ).reduce( function ( obj, key ) {
  obj[key] = function () {
    return getSportVu( key );
  };
}, module.exports );

{'fraction_non_alphanumeric': 0.16830065359477125, 'fraction_numerical': 0.0, 'mean_word_length': 2.895015906680806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '2919892', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1405, 'n_words': 220}