Skip to content

Commit

Permalink
Fix getVersion returning an undefined version
Browse files Browse the repository at this point in the history
  • Loading branch information
bastimeyer committed Jul 22, 2016
1 parent 0d43c4d commit 8a44ee6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,15 @@ module.exports = {
getVersion: function(args){
return (isLegacyVersion(args.desiredVersion) ? getLegacyVersions : getVersionsFromManifest)(args.downloadUrl)
.then(function(versions) {
var version = versions.find(function(version){
var version = _.find(versions, function(version){
if(version.version === args.desiredVersion) {
return version;
}
});

if(version){
return version;
}
throw new Error('Version ' + args.desiredVersion + ' not found.');
return version && version !== -1
? Promise.resolve(version)
: Promise.reject('Version ' + args.desiredVersion + ' not found.');
});
},
/**
Expand Down

0 comments on commit 8a44ee6

Please sign in to comment.