forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvenient_hunk.js
More file actions
34 lines (30 loc) · 739 Bytes
/
convenient_hunk.js
File metadata and controls
34 lines (30 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
function ConvenientHunk(raw, i) {
this.raw = raw;
this.i = i;
}
/**
* Diff header string that represents the context of this hunk
* of the diff. Something like `@@ -169,14 +167,12 @@ ...`
* @return {String}
*/
ConvenientHunk.prototype.header = function() {
return this.raw.hunk(this.i).header;
};
/**
* Number of lines in this hunk
* @return {Number}
*/
ConvenientHunk.prototype.size = function() {
return this.raw.hunk(this.i).lines;
};
/**
* The lines in this hunk
* @return {[String]} array of strings
*/
ConvenientHunk.prototype.lines = function() {
var result = [];
for (var i = 0; i < this.size(); i++)
result.push(this.raw.line(this.i, i));
return result;
};
exports.ConvenientHunk = ConvenientHunk;