push
travis-ci
34 of 34 new or added lines in 8 files covered. (100.0%)
4855 of 5027 relevant lines covered (96.58%)
2897.28 hits per line
1 |
var Types = require('../constants/types'); |
1,368✔ |
2 |
|
|
3 |
module.exports = Field; |
1,368✔ |
4 |
function Field(options) { |
1,368✔ |
5 |
options = options || {}; |
7,254✔ |
6 |
|
|
7 |
this.parser = options.parser;
|
7,254✔ |
8 |
this.packet = options.packet;
|
7,254✔ |
9 |
this.db = options.packet.db;
|
7,254✔ |
10 |
this.table = options.packet.table;
|
7,254✔ |
11 |
this.name = options.packet.name;
|
7,254✔ |
12 |
this.type = typeToString(options.packet.type);
|
7,254✔ |
13 |
this.length = options.packet.length;
|
7,254✔ |
14 |
} |
|
15 |
|
|
16 |
Field.prototype.string = function () { |
1,368✔ |
17 |
return this.parser.parseLengthCodedString(); |
1,854✔ |
18 |
}; |
|
19 |
|
|
20 |
Field.prototype.buffer = function () { |
1,368✔ |
21 |
return this.parser.parseLengthCodedBuffer(); |
× |
22 |
}; |
|
23 |
|
|
24 |
Field.prototype.geometry = function () { |
1,368✔ |
25 |
return this.parser.parseGeometryValue(); |
× |
26 |
}; |
|
27 |
|
|
28 |
function typeToString(t) { |
1,368✔ |
29 |
for (var k in Types) { |
7,254✔ |
30 |
if (Types[k] == t) return k; |
135,108✔ |
31 |
} |
|
32 |
|
|
|
return undefined; |
× |
34 |
} |