[CHORE] require specific entity types

This commit is contained in:
Matthew Fettig
2014-05-30 13:00:41 -07:00
parent 5ef7e5462e
commit 95b7858c8f

View File

@@ -53,6 +53,12 @@ var identityFields = [
'birthplace'
];
var entityTypes = [
'individual',
'organization',
'corporation'
]
var addressFields = [
'contact',
'line1',
@@ -692,6 +698,12 @@ Identity.prototype.set = function (pointer, key, value, fn) {
}
}
}
//validate entity type
} else if (pointer === 'entityType') {
if (entityTypes.indexOf(value) === -1) {
return fn(new Error("invalid entity type"));
}
}
this.validate(function(err, res){