Skip to content

Commit

Permalink
fix copy bug
Browse files Browse the repository at this point in the history
  • Loading branch information
justincy committed Jun 6, 2016
1 parent a1859d6 commit 8b163e4
Show file tree
Hide file tree
Showing 62 changed files with 797 additions and 35 deletions.
20 changes: 19 additions & 1 deletion src/Address.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var ExtensibleData = require('./ExtensibleData');
var ExtensibleData = require('./ExtensibleData'),
utils = require('./utils');

/**
* An address.
Expand All @@ -13,6 +14,11 @@ var Address = function(json){
return new Address(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Address.isInstance(json)){
return json;
}

ExtensibleData.call(this, json);

if(json){
Expand All @@ -32,6 +38,18 @@ var Address = function(json){

Address.prototype = Object.create(ExtensibleData.prototype);

Address._gedxClass = Address.prototype._gedxClass = 'GedcomX.Address';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Address.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the complete address value
*
Expand Down
20 changes: 19 additions & 1 deletion src/Agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ var ExtensibleData = require('./ExtensibleData'),
OnlineAccount = require('./OnlineAccount'),
Address = require('./Address'),
Identifiers = require('./Identifiers'),
TextValue = require('./TextValue');
TextValue = require('./TextValue'),
utils = require('./utils');

/**
* Someone or something that curates genealogical data, such as a genealogical
Expand All @@ -19,6 +20,11 @@ var Agent = function(json){
return new Agent(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Agent.isInstance(json)){
return json;
}

ExtensibleData.call(this, json);

if(json){
Expand All @@ -36,6 +42,18 @@ var Agent = function(json){

Agent.prototype = Object.create(ExtensibleData.prototype);

Agent._gedxClass = Agent.prototype._gedxClass = 'GedcomX.Agent';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Agent.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the identifiers
*
Expand Down
20 changes: 19 additions & 1 deletion src/Attribution.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var ExtensibleData = require('./ExtensibleData'),
ResourceReference = require('./ResourceReference');
ResourceReference = require('./ResourceReference'),
utils = require('./utils');

/**
* Define who is contributing information, when they contributed it,
Expand All @@ -15,6 +16,11 @@ var Attribution = function(json){
return new Attribution(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Attribution.isInstance(json)){
return json;
}

ExtensibleData.call(this, json);

if(json){
Expand All @@ -28,6 +34,18 @@ var Attribution = function(json){

Attribution.prototype = Object.create(ExtensibleData.prototype);

Attribution._gedxClass = Attribution.prototype._gedxClass = 'GedcomX.Attribution';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Attribution.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the change message.
*
Expand Down
20 changes: 19 additions & 1 deletion src/Conclusion.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ var ExtensibleData = require('./ExtensibleData'),
Attribution = require('./Attribution'),
ResourceReference = require('./ResourceReference'),
Note = require('./Note'),
SourceReference = require('./SourceReference');
SourceReference = require('./SourceReference'),
utils = require('./utils');

/**
* An abstract concept for a basic genealogical data item.
Expand All @@ -17,6 +18,11 @@ var Conclusion = function(json){
return new Conclusion(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Conclusion.isInstance(json)){
return json;
}

ExtensibleData.call(this, json);

if(json){
Expand All @@ -31,6 +37,18 @@ var Conclusion = function(json){

Conclusion.prototype = Object.create(ExtensibleData.prototype);

Conclusion._gedxClass = Conclusion.prototype._gedxClass = 'GedcomX.Conclusion';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Conclusion.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the attribution.
*
Expand Down
20 changes: 19 additions & 1 deletion src/Coverage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var ExtensibleData = require('./ExtensibleData'),
GDate = require('./Date'),
PlaceReference = require('./PlaceReference');
PlaceReference = require('./PlaceReference'),
utils = require('./utils');

/**
* A description of the spatial and temporal coverage of a resource.
Expand All @@ -15,6 +16,11 @@ var Coverage = function(json){
return new Coverage(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Coverage.isInstance(json)){
return json;
}

ExtensibleData.call(this, json);

if(json){
Expand All @@ -25,6 +31,18 @@ var Coverage = function(json){

Coverage.prototype = Object.create(ExtensibleData.prototype);

Coverage._gedxClass = Coverage.prototype._gedxClass = 'GedcomX.Coverage';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Coverage.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the spatial coverage
*
Expand Down
20 changes: 19 additions & 1 deletion src/Date.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var ExtensibleData = require('./ExtensibleData');
var ExtensibleData = require('./ExtensibleData'),
utils = require('./utils');

/**
* A date.
Expand All @@ -14,6 +15,11 @@ var GDate = function(json){
return new GDate(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(GDate.isInstance(json)){
return json;
}

ExtensibleData.call(this, json);

if(json){
Expand All @@ -24,6 +30,18 @@ var GDate = function(json){

GDate.prototype = Object.create(ExtensibleData.prototype);

GDate._gedxClass = GDate.prototype._gedxClass = 'GedcomX.Date';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
GDate.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the original date value
*
Expand Down
20 changes: 19 additions & 1 deletion src/Document.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var Conclusion = require('./Conclusion'),
Attribution = require('./Attribution');
Attribution = require('./Attribution'),
utils = require('./utils');

/**
* A textual document
Expand All @@ -14,6 +15,11 @@ var Document = function(json){
return new Document(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Document.isInstance(json)){
return json;
}

Conclusion.call(this, json);

if(json){
Expand All @@ -27,6 +33,18 @@ var Document = function(json){

Document.prototype = Object.create(Conclusion.prototype);

Document._gedxClass = Document.prototype._gedxClass = 'GedcomX.Document';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Document.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the type
*
Expand Down
20 changes: 19 additions & 1 deletion src/Event.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var Subject = require('./Subject'),
GDate = require('./Date'),
PlaceReference = require('./PlaceReference'),
EventRole = require('./EventRole');
EventRole = require('./EventRole'),
utils = require('./utils');

/**
* An event.
Expand All @@ -16,6 +17,11 @@ var Event = function(json){
return new Event(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Event.isInstance(json)){
return json;
}

Subject.call(this, json);

if(json){
Expand All @@ -28,6 +34,18 @@ var Event = function(json){

Event.prototype = Object.create(Subject.prototype);

Event._gedxClass = Event.prototype._gedxClass = 'GedcomX.Event';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Event.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the type
*
Expand Down
20 changes: 19 additions & 1 deletion src/EventRole.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var Conclusion = require('./Conclusion'),
ResourceReference = require('./ResourceReference');
ResourceReference = require('./ResourceReference'),
utils = require('./utils');

/**
* A role that a specific person plays in an event.
Expand All @@ -14,6 +15,11 @@ var EventRole = function(json){
return new EventRole(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(Conclusion.isInstance(json)){
return json;
}

Conclusion.call(this, json);

if(json){
Expand All @@ -25,6 +31,18 @@ var EventRole = function(json){

EventRole.prototype = Object.create(Conclusion.prototype);

Conclusion._gedxClass = Conclusion.prototype._gedxClass = 'GedcomX.Conclusion';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
Conclusion.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the person
*
Expand Down
20 changes: 19 additions & 1 deletion src/EvidenceReference.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var ResourceReference = require('./ResourceReference'),
Attribution = require('./Attribution');
Attribution = require('./Attribution'),
utils = require('./utils');

/**
* A generic reference to a resource.
Expand All @@ -14,6 +15,11 @@ var EvidenceReference = function(json){
return new EvidenceReference(json);
}

// If the given object is already an instance then just return it. DON'T copy it.
if(ResourceReference.isInstance(json)){
return json;
}

ResourceReference.call(this, json);

if(json){
Expand All @@ -23,6 +29,18 @@ var EvidenceReference = function(json){

EvidenceReference.prototype = Object.create(ResourceReference.prototype);

ResourceReference._gedxClass = ResourceReference.prototype._gedxClass = 'GedcomX.ResourceReference';

/**
* Check whether the given object is an instance of this class.
*
* @param {Object} obj
* @returns {Boolean}
*/
ResourceReference.isInstance = function(obj){
return utils.isInstance(obj, this._gedxClass);
};

/**
* Get the attribution.
*
Expand Down
Loading

0 comments on commit 8b163e4

Please sign in to comment.