Skip to content

Commit b52067a

Browse files
committed
More constructors refactored
1 parent be111f0 commit b52067a

File tree

6 files changed

+36
-32
lines changed

6 files changed

+36
-32
lines changed

lib/convenient_hunk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ ConvenientHunk.prototype.lines = function() {
3232
return result;
3333
};
3434

35-
exports.ConvenientHunk = ConvenientHunk;
35+
module.exports = ConvenientHunk;

lib/convenient_patch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var git = require("../");
22
var Diff = git.Diff;
3-
var ConvenientHunk = require("./convenient_hunk").ConvenientHunk;
3+
var ConvenientHunk = require("./convenient_hunk");
44

55
function ConvenientPatch(delta, patch) {
66
this.delta = delta;

lib/index.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
1-
var git = require("../"),
2-
Index = git.Index;
1+
var NodeGit = require("../");
2+
3+
var Index = NodeGit.Index;
34

45
/**
56
* Return an array of the entries in this index.
67
* @return {[IndexEntry]} an array of IndexEntrys
78
*/
89
Index.prototype.entries = function() {
9-
var size = this.size(),
10-
result = [];
10+
var size = this.size();
11+
var result = [];
12+
1113
for (var i = 0; i < size; i++) {
1214
result.push(this.entry(i));
1315
}
16+
1417
return result;
1518
};
19+
20+
module.exports = Index;

lib/object.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
var git = require("../");
1+
var NodeGit = require("../");
22

3-
git.Object.Type = {
4-
Any: -2, /**< Object can be any of the following */
5-
Bad: -1, /**< Object is invalid. */
3+
var Obj = NodeGit.Object;
4+
5+
Obj.Type = {
6+
Any: -2, /**< Obj can be any of the following */
7+
Bad: -1, /**< Obj is invalid. */
68
Ext1: 0, /**< Reserved for future use. */
79
Commit: 1, /**< A commit object. */
810
Tree: 2, /**< A tree (directory listing) object. */
@@ -17,30 +19,32 @@ git.Object.Type = {
1719
* Is this object a commit?
1820
* @return {Boolean}
1921
*/
20-
git.Object.prototype.isCommit = function() {
21-
return this.type() == git.Object.Type.Commit;
22+
Obj.prototype.isCommit = function() {
23+
return this.type() == Obj.Type.Commit;
2224
};
2325

2426
/**
2527
* Is this object a tree?
2628
* @return {Boolean}
2729
*/
28-
git.Object.prototype.isTree = function() {
29-
return this.type() == git.Object.Type.Tree;
30+
Obj.prototype.isTree = function() {
31+
return this.type() == Obj.Type.Tree;
3032
};
3133

3234
/**
3335
* Is this object a blob?
3436
* @return {Boolean}
3537
*/
36-
git.Object.prototype.isBlob = function() {
37-
return this.type() == git.Object.Type.Blob;
38+
Obj.prototype.isBlob = function() {
39+
return this.type() == Obj.Type.Blob;
3840
};
3941

4042
/**
4143
* Is this object a tag?
4244
* @return {Boolean}
4345
*/
44-
git.Object.prototype.isTag = function() {
45-
return this.type() == git.Object.Type.Tag;
46+
Obj.prototype.isTag = function() {
47+
return this.type() == Obj.Type.Tag;
4648
};
49+
50+
module.exports = Obj;

lib/odb.js

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
1-
var git = require("../"),
2-
util = require("./util.js"),
3-
Odb = git.Odb;
1+
var git = require("../");
42

5-
/**
6-
* Retrieve the object identified by oid.
7-
*
8-
* @param {String|Oid} String sha or Oid
9-
* @param {Function} callback
10-
* @return {git.Object} a git odb object
11-
*/
12-
util.normalizeOid(Odb.prototype, "read");
13-
util.makeSafe(Odb.prototype, "read");
3+
var Odb = git.Odb;
4+
5+
module.exports = Odb;

lib/oid.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
var git = require("../"),
2-
Oid = git.Oid;
1+
var NodeGit = require("../");
2+
3+
var Oid = NodeGit.Oid;
34

45
// Backwards compatibility.
56
Object.defineProperties(Oid.prototype, {
@@ -19,3 +20,5 @@ Object.defineProperties(Oid, {
1920
Oid.prototype.inspect = function() {
2021
return "[Oid " + this.allocfmt() + "]";
2122
};
23+
24+
module.exports = Oid;

0 commit comments

Comments
 (0)