Removed unused validation function isValid

This commit is contained in:
Alexander Cerutti
2021-10-25 01:14:32 +02:00
parent 1dac910421
commit eabee97d89

View File

@@ -165,26 +165,6 @@ export const Template = Joi.object<Template>({
// --------- UTILITIES ---------- // // --------- UTILITIES ---------- //
/**
* Checks if the passed options are compliant with the indicated schema
* @param {any} opts - options to be checks
* @param {string} schemaName - the indicated schema (will be converted)
* @returns {boolean} - result of the check
*/
export function isValid<T extends Object>(
opts: T,
schema: Joi.ObjectSchema<T>,
): boolean {
const validation = schema.validate(opts);
if (validation.error) {
throw new TypeError(validation.error.message);
}
return !validation.error;
}
/** /**
* Performs validation of a schema on an object. * Performs validation of a schema on an object.
* If it fails, will throw an error. * If it fails, will throw an error.