1 | 'use strict';
|
2 |
|
3 | var gitUrl = require('giturl');
|
4 |
|
5 | function 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 |
|
15 | module.exports = bestGuessHomepage; |
\ | No newline at end of file |