forked from cameroncondry/cbc-kitten-scientists
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontributors.js
60 lines (51 loc) · 1.46 KB
/
contributors.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/env node
"use strict";
var Promise = require('bluebird');
var _ = require('lodash');
var request = Promise.promisifyAll(require('superagent'));
var staticContributors = [
{
login: 'SphtMarathon',
html_url: 'https://www.reddit.com/user/SphtMarathon'
},
{
login: 'FancyRabbitt',
html_url: 'https://www.reddit.com/user/FancyRabbitt'
},
{
login: 'Azulan',
html_url: 'https://www.reddit.com/user/Azulan'
},
{
login: 'Mewnine',
html_url: 'https://www.reddit.com/user/Mewnine'
},
{
login: 'pefoley2',
html_url: 'https://www.reddit.com/user/pefoley2'
},
{
login: 'DirCattus',
html_url: 'https://www.reddit.com/user/DirCattus'
}
];
request
.get('https://api.github.com/repos/cameroncondry/cbc-kitten-scientists/contributors')
.endAsync()
.then(parseContributors);
function parseContributors(response) {
var contributors = _.chain(response.body.concat(staticContributors))
.sortBy(function nameToLowerCase(contributor) {
return contributor.login.toLowerCase();
})
.remove(function excludeCameron(contributor) {
return contributor.login !== "cameroncondry";
})
.map(toMarkdown)
.value()
.join('\n');
console.log(contributors);
}
function toMarkdown(contributor) {
return '- [' + contributor.login + '](' + contributor.html_url + ')';
}