Skip to content

Commit a89dcda

Browse files
committed
Merge pull request #132 from iamdanfox/jshint
JSHint
2 parents f55504b + dae1d2d commit a89dcda

File tree

3 files changed

+33
-33
lines changed

3 files changed

+33
-33
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ language: node_js
22
node_js:
33
- "0.11"
44
- "0.10"
5-
- "0.8"
6-
- "0.6"
5+
script:
6+
- npm test
7+
- npm run lint

github.js

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,18 @@
5252
cb({path: path, request: this, error: this.status});
5353
}
5454
}
55-
}
56-
};
55+
};
56+
}
5757
xhr.setRequestHeader('Accept','application/vnd.github.v3.raw+json');
5858
xhr.setRequestHeader('Content-Type','application/json;charset=UTF-8');
5959
if ((options.token) || (options.username && options.password)) {
60-
xhr.setRequestHeader('Authorization', options.token
61-
? 'token '+ options.token
62-
: 'Basic ' + Base64.encode(options.username + ':' + options.password)
63-
);
64-
}
65-
data ? xhr.send(JSON.stringify(data)) : xhr.send();
60+
var authorization = options.token ? 'token ' + options.token : 'Basic ' + Base64.encode(options.username + ':' + options.password);
61+
xhr.setRequestHeader('Authorization', authorization);
62+
}
63+
if (data)
64+
xhr.send(JSON.stringify(data));
65+
else
66+
xhr.send();
6667
if (sync) return xhr.response;
6768
}
6869

@@ -252,18 +253,18 @@
252253
_request("DELETE", repoPath + "/git/refs/"+ref, options, cb);
253254
};
254255

255-
// Create a repo
256+
// Create a repo
256257
// -------
257258

258259
this.createRepo = function(options, cb) {
259260
_request("POST", "/user/repos", options, cb);
260261
};
261262

262-
// Delete a repo
263-
// --------
263+
// Delete a repo
264+
// --------
264265

265-
this.deleteRepo = function(cb) {
266-
_request("DELETE", repoPath, options, cb);
266+
this.deleteRepo = function(cb) {
267+
_request("DELETE", repoPath, options, cb);
267268
};
268269

269270
// List all tags of a repository
@@ -455,9 +456,9 @@
455456
_request("POST", repoPath + "/forks", null, cb);
456457
};
457458

458-
// Branch repository
459-
// --------
460-
459+
// Branch repository
460+
// --------
461+
461462
this.branch = function(oldBranch,newBranch,cb) {
462463
if(arguments.length === 2 && typeof arguments[1] === "function") {
463464
cb = newBranch;
@@ -471,7 +472,7 @@
471472
sha: ref
472473
},cb);
473474
});
474-
}
475+
};
475476

476477
// Create pull request
477478
// --------
@@ -549,24 +550,24 @@
549550
});
550551
});
551552
};
552-
553+
553554
// Delete a file from the tree
554555
// -------
555-
556+
556557
this.delete = function(branch, path, cb) {
557558
that.getSha(branch, path, function(err, sha) {
558559
if (!sha) return cb("not found", null);
559560
var delPath = repoPath + "/contents/" + path;
560561
var params = {
561562
"message": "Deleted " + path,
562-
"sha": sha
563+
"sha": sha
563564
};
564565
delPath += "?message=" + encodeURIComponent(params.message);
565566
delPath += "&sha=" + encodeURIComponent(params.sha);
566567
_request("DELETE", delPath, null, cb);
567-
})
568-
}
569-
568+
});
569+
};
570+
570571
// Move a file to a new location
571572
// -------
572573

@@ -741,9 +742,7 @@
741742
var path = "/repos/" + options.user + "/" + options.repo + "/issues";
742743

743744
this.list = function(options, cb) {
744-
_request("GET", path, options, function(err, res) {
745-
cb(err,res)
746-
});
745+
_request("GET", path, options, cb);
747746
};
748747
};
749748

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
"underscore": "*"
99
},
1010
"devDependencies": {
11-
"mocha": "*",
12-
"chai": "*"
11+
"chai": "*",
12+
"jshint": "^2.5.8",
13+
"mocha": "*"
1314
},
1415
"scripts": {
15-
"test": "mocha"
16-
16+
"test": "mocha",
17+
"lint": "jshint github.js"
1718
},
1819
"repository": {
1920
"type": "git",
@@ -96,5 +97,4 @@
9697
],
9798
"harness": "mocha"
9899
}
99-
100100
}

0 commit comments

Comments
 (0)