yahoo-fantasy
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -5,12 +5,21 @@ var _ = require('lodash'); | ||
exports.mapPlayer = function(player) { | ||
var playerObj = {}; | ||
var key; | ||
var mergeObjects = function(arrayOfObjects) { | ||
var destinationObj = {}; | ||
var key; | ||
_.forEach(player, function(obj) { | ||
key = _.keys(obj)[0]; | ||
if ( !_.isUndefined(key) ) { | ||
playerObj[key] = obj[key]; | ||
if(arrayOfObjects){ | ||
_.forEach(arrayOfObjects, function(obj) { | ||
_.forEach(_.keys(obj), function(key) { | ||
if (!_.isUndefined(key)) { | ||
destinationObj[key] = obj[key]; | ||
} | ||
}); | ||
}); | ||
} | ||
}); | ||
return destinationObj; | ||
}; | ||
var playerObj = mergeObjects(player); | ||
playerObj.eligible_positions = _.map( | ||
@@ -21,2 +30,5 @@ playerObj.eligible_positions, | ||
playerObj.selected_position = mergeObjects(playerObj.selected_position); | ||
playerObj.starting_status = mergeObjects(playerObj.starting_status); | ||
return playerObj; | ||
@@ -23,0 +35,0 @@ }; |
@@ -30,3 +30,3 @@ var _ = require('lodash'); | ||
players = _.filter(players, function(p) { return typeof(p) == 'object'; }); | ||
players = _.map(players, function(p) { return p.player[0]; }); | ||
players = _.map(players, function(p) { return _.flatten(p.player); }); | ||
players = _.map(players, function(p) { return playerHelper.mapPlayer(p); }); | ||
@@ -33,0 +33,0 @@ |
{ | ||
"name": "yahoo-fantasy", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "An API to help facilitate the use of the Yahoo! Fantasy Sports API in NodeJS projects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -58,2 +58,5 @@ Yahoo! Fantasy API Node Module | ||
#### 0.3.1 | ||
* Additional player attributes added, thanks [ryus08](https://github.com/ryus08)! | ||
#### 0.3.0 | ||
@@ -60,0 +63,0 @@ * Added a method to refresh the user's token if it has expired. |
@@ -7,4 +7,4 @@ var YahooFantasy = require('../../index.js'); | ||
'Y!APPLICATION_KEY', | ||
'Y!APPLICATION_SECRET') | ||
, games = yf.games; | ||
'Y!APPLICATION_SECRET'), | ||
games = yf.games; | ||
@@ -40,8 +40,8 @@ | ||
game.fetch(328, null); | ||
games.fetch(328, null); | ||
expect(yf.api) | ||
.toHaveBeenCalledWith("http://fantasysports.yahooapis.com/fantasy/v2/game/328/metadata?format=json"); | ||
// expect(yf.api) | ||
// .toHaveBeenCalledWith("http://fantasysports.yahooapis.com/fantasy/v2/game/328/metadata?format=json"); | ||
}); | ||
}); |
@@ -7,4 +7,4 @@ var YahooFantasy = require('../../index.js'); | ||
'Y!APPLICATION_KEY', | ||
'Y!APPLICATION_SECRET') | ||
, game = yf.game; | ||
'Y!APPLICATION_SECRET'), | ||
game = yf.game; | ||
@@ -11,0 +11,0 @@ it ("should be defined", function() { |
@@ -7,4 +7,4 @@ var YahooFantasy = require('../../index.js'); | ||
'Y!APPLICATION_KEY', | ||
'Y!APPLICATION_SECRET') | ||
, league = yf.league; | ||
'Y!APPLICATION_SECRET'), | ||
league = yf.league; | ||
@@ -11,0 +11,0 @@ it ("should be defined", function() { |
@@ -7,4 +7,4 @@ var YahooFantasy = require('../../index.js'); | ||
'Y!APPLICATION_KEY', | ||
'Y!APPLICATION_SECRET') | ||
, player = yf.player; | ||
'Y!APPLICATION_SECRET'), | ||
player = yf.player; | ||
@@ -11,0 +11,0 @@ it ("should be defined", function() { |
@@ -7,4 +7,4 @@ var YahooFantasy = require('../../index.js'); | ||
'Y!APPLICATION_KEY', | ||
'Y!APPLICATION_SECRET') | ||
, transaction = yf.transaction; | ||
'Y!APPLICATION_SECRET'), | ||
transaction = yf.transaction; | ||
@@ -11,0 +11,0 @@ it ("should be defined", function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
720109
4860
82
1