c86dde1311
# Conflicts: # src/app/_eth/accountIndex.ts # src/app/_eth/token-registry.ts # src/app/_helpers/mock-backend.ts # src/app/_models/token.ts # src/app/_pgp/pgp-key-store.ts
32 lines
934 B
TypeScript
32 lines
934 B
TypeScript
// Third party imports
|
|
import { validatePerson, validateVcard } from '@cicnet/schemas-data-validator';
|
|
|
|
/**
|
|
* Validates a person object against the defined Person schema.
|
|
*
|
|
* @param person - A person object to be validated.
|
|
*/
|
|
async function personValidation(person: any): Promise<void> {
|
|
const personValidationErrors: any = await validatePerson(person);
|
|
|
|
if (personValidationErrors) {
|
|
personValidationErrors.map((error) => console.error(`${error.message}`, person, error));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Validates a vcard object against the defined Vcard schema.
|
|
*
|
|
* @param vcard - A vcard object to be validated.
|
|
*/
|
|
async function vcardValidation(vcard: any): Promise<void> {
|
|
const vcardValidationErrors: any = await validateVcard(vcard);
|
|
|
|
if (vcardValidationErrors) {
|
|
vcardValidationErrors.map((error) => console.error(`${error.message}`, vcard, error));
|
|
}
|
|
}
|
|
|
|
/** @exports */
|
|
export { personValidation, vcardValidation };
|