Skip to content

Instantly share code, notes, and snippets.

@trieloff
Created March 9, 2017 20:09
Show Gist options
  • Save trieloff/d8055d7dd8cd959098ba58090a0553a5 to your computer and use it in GitHub Desktop.
Save trieloff/d8055d7dd8cd959098ba58090a0553a5 to your computer and use it in GitHub Desktop.
var github = {
checkLicense: function(uri) {
return request({
"method": "GET",
"uri": uri,
"json": true,
"headers": {
"Authorization": "Bearer " + github.token,
"User-Agent": "My little demo app"
}
}).then(function(fulfilled_body) {
return false;
}, function(rejected_body){
return uri;
});
}
};
function main(params) {
github.token = params.token;
return github.getUser()
.then(github.getUserReposUrl)
.then(github.getUserRepos)
.filter(github.isPublic)
.filter(github.isOriginal)
.map(github.licenseUrl)
.map(github.checkLicense);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment