mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 19:25:23 +00:00
Removed unused validation function isValid
This commit is contained in:
@@ -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.
|
||||||
|
|||||||
Reference in New Issue
Block a user