Skip to content

Commit da95507

Browse files
committed
Added Node.js support.
1 parent 514124d commit da95507

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

github.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
// Github.js 0.7.0
2-
// (c) 2012 Michael Aufreiter, Development Seed
1+
// Github.js 0.8.0
2+
// (c) 2013 Michael Aufreiter, Development Seed
33
// Github.js is freely distributable under the MIT license.
44
// For all details and documentation:
55
// http://substance.io/michael/github
66

77
(function() {
8-
var Github;
8+
9+
// Initial Setup
10+
// -------------
11+
12+
if (typeof exports !== 'undefined') {
13+
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
14+
var _ = require('underscore');
15+
}
16+
917
var API_URL = 'https://api.github.com';
1018

11-
Github = window.Github = function(options) {
19+
var Github = function(options) {
1220

1321
// HTTP Request Abstraction
1422
// =======
@@ -48,6 +56,8 @@
4856
data ? xhr.send(JSON.stringify(data)) : xhr.send();
4957
}
5058

59+
60+
5161
// User API
5262
// =======
5363

@@ -496,4 +506,12 @@
496506
return new Github.Gist({id: id});
497507
};
498508
};
499-
}).call(this);
509+
510+
511+
if (typeof exports !== 'undefined') {
512+
// Github = exports;
513+
module.exports = Github;
514+
} else {
515+
window.Github = Github;
516+
}
517+
}).call(this);

0 commit comments

Comments
 (0)