| Total Complexity | 5 |
| Complexity/F | 1.25 |
| Lines of Code | 41 |
| Function Count | 4 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | /** |
||
| 4 | module.exports = function(GedcomX){ |
||
| 5 | |||
| 6 | // Extend serialization properties |
||
| 7 | GedcomX.Fact.jsonProps.push('primary'); |
||
| 8 | |||
| 9 | // Override init() |
||
| 10 | var oldFactInit = GedcomX.Fact.prototype.init; |
||
| 11 | GedcomX.Fact.prototype.init = function(json){ |
||
| 12 | oldFactInit.call(this, json); |
||
| 13 | if(json){ |
||
| 14 | this.setPrimary(json.primary); |
||
| 15 | } |
||
| 16 | }; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * Set the primary flag |
||
| 20 | * |
||
| 21 | * @function setPrimary |
||
| 22 | * @instance |
||
| 23 | * @memberof Fact |
||
| 24 | * @param {Boolean} primary |
||
| 25 | * @return {Fact} this |
||
| 26 | */ |
||
| 27 | GedcomX.Fact.prototype.setPrimary = function(primary){ |
||
| 28 | this.primary = primary; |
||
| 29 | return this; |
||
| 30 | }; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get the primary flag |
||
| 34 | * |
||
| 35 | * @function getPrimary |
||
| 36 | * @instance |
||
| 37 | * @memberof Fact |
||
| 38 | * @return {Boolean} |
||
| 39 | */ |
||
| 40 | GedcomX.Fact.prototype.getPrimary = function(){ |
||
| 41 | return this.primary; |
||
| 42 | }; |
||
| 43 | |||
| 44 | }; |