hubkit
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -503,13 +503,6 @@ if (typeof require !== 'undefined') { | ||
case 'ghe': | ||
if (fullOptions.host === 'https://api.github.com') return contents; | ||
if (satisfiesGheVersion(fullOptions, arg)) return contents; | ||
if (!fullOptions.gheVersion) { | ||
throw new Error('Hubkit unable to process #ghe directive: gheVersion missing'); | ||
} | ||
var neededVersion = arg.split('.').map(function(x) {return parseInt(x, 10);}); | ||
var actualVersion = | ||
fullOptions.gheVersion.split('.').map(function(x) {return parseInt(x, 10);}); | ||
if (actualVersion[0] > neededVersion[0] || | ||
actualVersion[0] === neededVersion[0] && actualVersion[1] >= neededVersion[1]) { | ||
return contents; | ||
} | ||
return ''; | ||
@@ -628,3 +621,5 @@ case 'scope': | ||
} | ||
if (options.apiVersion) config.headers['X-GitHub-Api-Version'] = options.apiVersion; | ||
if (options.apiVersion && satisfiesGheVersion(options, '3.9')) { | ||
config.headers['X-GitHub-Api-Version'] = options.apiVersion; | ||
} | ||
/* eslint-enable dot-notation */ | ||
@@ -688,3 +683,12 @@ } | ||
function satisfiesGheVersion(options, minVersion) { | ||
if (options.host === 'https://api.github.com') return true; | ||
if (!options.gheVersion) return false; | ||
var neededVersion = minVersion.split('.').map(function(x) {return parseInt(x, 10);}); | ||
var actualVersion = options.gheVersion.split('.').map(function(x) {return parseInt(x, 10);}); | ||
return actualVersion[0] > neededVersion[0] || | ||
actualVersion[0] === neededVersion[0] && actualVersion[1] >= neededVersion[1]; | ||
} | ||
return Hubkit; | ||
}); |
{ | ||
"name": "hubkit", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "GitHub API library for JavaScript, promise-based, for both NodeJS and the browser", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
48525
880