function PlayerData(data) {
    var playerData = {};
    
    playerData._data = data;
    
    playerData.getStatHeaders = function() {
	    var firstKey = Object.keys(this._data)[0]
	    var headers = [];
        for (var propertyName in this._data[firstKey]) {
            headers.push({name: propertyName, value: propertyName})
        }
        return headers;
    };
    
    playerData.getPlayerData = function(key) {
        return this._data[key];
    }
    
    playerData.getPlayerKey = function(player) {
        return player.firstName + " " + player.lastName;
    }
    
    playerData.hasData = function(key) {
        if (!this._data[key]) return false;
        else return true;
    }
    
    playerData.getPlayerDatum = function(key, id) {
        return this.getPlayerData(key)[id];
    }
    
    return playerData;
}