mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-25 14:45:48 +00:00
[CHORE] require specific entity types
This commit is contained in:
@@ -53,6 +53,12 @@ var identityFields = [
|
||||
'birthplace'
|
||||
];
|
||||
|
||||
var entityTypes = [
|
||||
'individual',
|
||||
'organization',
|
||||
'corporation'
|
||||
]
|
||||
|
||||
var addressFields = [
|
||||
'contact',
|
||||
'line1',
|
||||
@@ -691,7 +697,13 @@ 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){
|
||||
|
||||
Reference in New Issue
Block a user