verb
Version:
Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.
22 lines (18 loc) • 594 B
JavaScript
;
var github = require('parse-github-url');
/**
* Called in the `username` transform, if the `git` transform
* was not able to find anything, this attempts to generate a
* username from other fields.
*/
module.exports = function(app) {
if (!app.get('data.github.username')) {
var author = app.get('data.author');
if (typeof author.url === 'string' && /\/github/.test(author.url)) {
var parsed = github(author.url);
var user = (parsed && parsed.user) || '';
app.set('data.github.username', user);
app.set('data.username', user);
}
}
};