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