MCPcopy
hub / github.com/resume/resume.github.com / github_user_starred_resume

Function github_user_starred_resume

js/githubresume.js:104–147  ·  view source on GitHub ↗
(username, page)

Source from the content-addressed store, hash-verified

102//
103// Returns true/false.
104var github_user_starred_resume = function(username, page) {
105 var star = false;
106 var repos = [];
107 var page = (page ? page : 1);
108 var url = 'https://api.github.com/users/' + username + '/starred?per_page=100&page=' + page;
109 var errorMsg;
110
111 $.ajax({
112 url: url,
113 async: false,
114 dataType: 'json',
115 success: function(data) {
116 repos = data;
117 },
118 error: function(e) {
119 if (e.status == 403) {
120 errorMsg = 'api_limit'
121 } else if (e.status == 404) {
122 errorMsg = 'not_found'
123 }
124 }
125 });
126
127 if (errorMsg === 'api_limit' || errorMsg === 'not_found') {
128 return errorMsg;
129 }
130
131 $.each(repos, function(i, repo) {
132 if (repo.full_name == "resume/resume.github.com") {
133 star = true;
134 return false; // stop iterating
135 }
136 });
137
138 if (star) {
139 return star;
140 }
141
142 if (repos.length == 100) {
143 star = github_user_starred_resume(username, page + 1);
144 }
145
146 return star;
147}
148
149var run = function() {
150 var itemCount = 0,

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected