Total Complexity | 5 |
Complexity/F | 1.25 |
Lines of Code | 35 |
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.ResourceReference.jsonProps.push('resourceId'); |
||
8 | |||
9 | // Override init() so that we can deserialize normalized values |
||
10 | var oldInit = GedcomX.ResourceReference.prototype.init; |
||
11 | GedcomX.ResourceReference.prototype.init = function(json){ |
||
12 | oldInit.call(this, json); |
||
13 | if(json){ |
||
14 | this.setResourceId(json.resourceId); |
||
15 | } |
||
16 | }; |
||
17 | |||
18 | /** |
||
19 | * Set the resourceId |
||
20 | * |
||
21 | * @param {Boolean} resourceId |
||
22 | * @return {ResourceReference} this |
||
23 | */ |
||
24 | GedcomX.ResourceReference.prototype.setResourceId = function(resourceId){ |
||
25 | this.resourceId = resourceId; |
||
26 | return this; |
||
27 | }; |
||
28 | |||
29 | /** |
||
30 | * Get the resourceId |
||
31 | * |
||
32 | * @return {Boolean} resourceId |
||
33 | */ |
||
34 | GedcomX.ResourceReference.prototype.getResourceId = function(){ |
||
35 | return this.resourceId; |
||
36 | }; |
||
37 | |||
38 | }; |