Completed
Push — master ( e3ee1d...5cbb1b )
by Justin
01:36
created

src/records/Coverage.js   A

Complexity

Total Complexity 5
Complexity/F 1.25

Size

Lines of Code 35
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 35
rs 10
wmc 5
mnd 1
bc 5
fnc 4
bpm 1.25
cpm 1.25
noi 0
1
/**
2
 * Record extensions to Coverage
3
 */
4
module.exports = function(GedcomX){
5
  
6
  // Extend serialization properties
7
  GedcomX.Coverage.jsonProps.push('recordType');
8
  
9
  // Override init()
10
  var oldCoverageInit = GedcomX.Coverage.prototype.init;
11
  GedcomX.Coverage.prototype.init = function(json){
12
    oldCoverageInit.call(this, json);
13
    if(json){
14
      this.setRecordType(json.recordType);
15
    }
16
  };
17
  
18
  /**
19
   * Set the record type
20
   * 
21
   * @param {String} recordType
22
   * @return {Coverage} this
23
   */
24
  GedcomX.Coverage.prototype.setRecordType = function(recordType){
25
    this.recordType = recordType;
26
    return this;
27
  };
28
  
29
  /**
30
   * Get the record type
31
   * 
32
   * @return {String} recordType
33
   */
34
  GedcomX.Coverage.prototype.getRecordType = function(){
35
    return this.recordType;
36
  };
37
  
38
};