Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / modules / groups / lib / get-github-username-from-group.js
blobfa5f6d067d84a0868371c8c2ed610ce50530342d
1 'use strict';
3 function getGithubUsernameFromGroup(group) {
4 const type = group.sd && group.sd.type;
5 const linkPath = group.sd && group.sd.linkPath;
7 let githubUsername;
8 switch (type) {
9 case 'GH_ORG':
10 case 'GH_USER':
11 githubUsername = linkPath;
12 break;
14 case 'GH_REPO':
15 githubUsername = linkPath.split('/')[0];
18 return githubUsername;
21 module.exports = getGithubUsernameFromGroup;