feat: look for email and phone number for contact
This commit is contained in:
parent
5f82884c62
commit
b44fd20e33
2 changed files with 10 additions and 3 deletions
2
package-lock.json
generated
2
package-lock.json
generated
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
"name": "or-uk-data-quality-checker",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "or-uk-data-quality-checker",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"commander": "^12.1.0"
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
const hasValidId = (s) =>
|
||||
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i.test(s.id.trim());
|
||||
// const hasValidId = (s) =>
|
||||
// /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/i.test(s.id.trim());
|
||||
|
||||
const hasValidId = (s) => !!s.id?.trim();
|
||||
|
||||
const hasValidName = (s) => typeof s.name === "string" && s.name.length > 0;
|
||||
|
||||
|
@ -16,7 +18,10 @@ const hasValidUrl = (s) => {
|
|||
|
||||
const hasValidOrganisation = (s) => !!s.organization?.id && !!s.organization?.name;
|
||||
|
||||
const hasValidContact = (s) => !!s.email?.length > 0;
|
||||
const hasValidContact = (s) =>
|
||||
s.email?.length > 0 ||
|
||||
(s.contacts?.[0]?.phones?.some(x => !!x.number) ?? false);
|
||||
|
||||
|
||||
const hasValidStatus = (s) => s.status === "active";
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue