-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhomepage.js
34 lines (27 loc) · 795 Bytes
/
homepage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
'use strict';
const getOwner = require('./helpers/owner');
const utils = require('../utils');
const merge = require('../merge');
module.exports = function(val, key, config, schema) {
merge(config, schema);
let res;
val = val || config[key];
if (utils.isString(val) && /:\/\//.test(val)) {
return val;
}
schema.update('repository', config);
if (utils.isString(config.repository)) {
res = utils.repo.homepage(config.repository);
schema.checked[key] = true;
return res;
}
let owner = config.owner;
if (!utils.isString(owner)) {
owner = getOwner(val, key, config, schema);
}
if (utils.isString(owner) && utils.isString(config.name)) {
res = utils.repo.homepage(owner + '/' + config.name);
schema.checked[key] = true;
return res;
}
};