Skip to content

Commit 0e3d37b

Browse files
committed
fix: ensure all functions return a promise
Closes github-tools#326
1 parent 34a350d commit 0e3d37b

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/Issue.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Issue extends Requestable {
3030
* @return {Promise} - the promise for the http request
3131
*/
3232
createIssue(issueData, cb) {
33-
this._request('POST', `/repos/${this.__repository}/issues`, issueData, cb);
33+
return this._request('POST', `/repos/${this.__repository}/issues`, issueData, cb);
3434
}
3535

3636
/**
@@ -41,7 +41,7 @@ class Issue extends Requestable {
4141
* @return {Promise} - the promise for the http request
4242
*/
4343
listIssues(options, cb) {
44-
this._requestAllPages(`/repos/${this.__repository}/issues`, options, cb);
44+
return this._requestAllPages(`/repos/${this.__repository}/issues`, options, cb);
4545
}
4646

4747
/**
@@ -52,7 +52,7 @@ class Issue extends Requestable {
5252
* @return {Promise} - the promise for the http request
5353
*/
5454
listIssueComments(issue, cb) {
55-
this._request('GET', `/repos/${this.__repository}/issues/${issue}/comments`, null, cb); // jscs:ignore
55+
return this._request('GET', `/repos/${this.__repository}/issues/${issue}/comments`, null, cb); // jscs:ignore
5656
}
5757

5858
/**
@@ -63,7 +63,7 @@ class Issue extends Requestable {
6363
* @return {Promise} - the promise for the http request
6464
*/
6565
getIssueComment(id, cb) {
66-
this._request('GET', `/repos/${this.__repository}/issues/comments/${id}`, null, cb); // jscs:ignore
66+
return this._request('GET', `/repos/${this.__repository}/issues/comments/${id}`, null, cb); // jscs:ignore
6767
}
6868

6969
/**
@@ -75,7 +75,7 @@ class Issue extends Requestable {
7575
* @return {Promise} - the promise for the http request
7676
*/
7777
createIssueComment(issue, comment, cb) {
78-
this._request('POST', `/repos/${this.__repository}/issues/${issue}/comments`, {body: comment}, cb); // jscs:ignore
78+
return this._request('POST', `/repos/${this.__repository}/issues/${issue}/comments`, {body: comment}, cb); // jscs:ignore
7979
}
8080

8181
/**
@@ -87,7 +87,7 @@ class Issue extends Requestable {
8787
* @return {Promise} - the promise for the http request
8888
*/
8989
editIssueComment(id, comment, cb) {
90-
this._request('PATCH', `/repos/${this.__repository}/issues/comments/${id}`, {body: comment}, cb); // jscs:ignore
90+
return this._request('PATCH', `/repos/${this.__repository}/issues/comments/${id}`, {body: comment}, cb); // jscs:ignore
9191
}
9292

9393
/**
@@ -98,7 +98,7 @@ class Issue extends Requestable {
9898
* @return {Promise} - the promise for the http request
9999
*/
100100
deleteIssueComment(id, cb) {
101-
this._request('DELETE', `/repos/${this.__repository}/issues/comments/${id}`, null, cb); // jscs:ignore
101+
return this._request('DELETE', `/repos/${this.__repository}/issues/comments/${id}`, null, cb); // jscs:ignore
102102
}
103103

104104
/**
@@ -110,7 +110,7 @@ class Issue extends Requestable {
110110
* @return {Promise} - the promise for the http request
111111
*/
112112
editIssue(issue, issueData, cb) {
113-
this._request('PATCH', `/repos/${this.__repository}/issues/${issue}`, issueData, cb);
113+
return this._request('PATCH', `/repos/${this.__repository}/issues/${issue}`, issueData, cb);
114114
}
115115

116116
/**
@@ -121,7 +121,7 @@ class Issue extends Requestable {
121121
* @return {Promise} - the promise for the http request
122122
*/
123123
getIssue(issue, cb) {
124-
this._request('GET', `/repos/${this.__repository}/issues/${issue}`, null, cb);
124+
return this._request('GET', `/repos/${this.__repository}/issues/${issue}`, null, cb);
125125
}
126126
}
127127

lib/Organization.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Organization extends Requestable {
3030
* @return {Promise} - the promise for the http request
3131
*/
3232
createRepo(options, cb) {
33-
this._request('POST', `/orgs/${this.__name}/repos`, options, cb);
33+
return this._request('POST', `/orgs/${this.__name}/repos`, options, cb);
3434
}
3535

3636
/**

lib/Repository.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ class Repository extends Requestable {
530530
return cb(null, this.__currentTree.sha);
531531
}
532532

533-
this.getRef(`heads/${branch}`, function(err, sha) {
533+
return this.getRef(`heads/${branch}`, function(err, sha) {
534534
this.__currentTree.branch = branch;
535535
this.__currentTree.sha = sha;
536536
cb(err, sha);

0 commit comments

Comments
 (0)