532 BJavaScriptView Raw
1'use strict';
2
3var gitUrl = require('giturl');
4
5function bestGuessHomepage(data) {
6 if (!data) {
7 return false;
8 }
9
10 var packageDataForLatest = data.versions[data['dist-tags'].latest];
11
12 return packageDataForLatest.homepage || packageDataForLatest.bugs && packageDataForLatest.bugs.url && gitUrl.parse(packageDataForLatest.bugs.url.trim()) || packageDataForLatest.repository && packageDataForLatest.repository.url && gitUrl.parse(packageDataForLatest.repository.url.trim());
13}
14
15module.exports = bestGuessHomepage;
\No newline at end of file