diff --git a/src/vine/validator.ts b/src/vine/validator.ts index 7a83af8..d0cd607 100644 --- a/src/vine/validator.ts +++ b/src/vine/validator.ts @@ -124,15 +124,16 @@ export class VineValidator< ? [options?: ValidationOptions | undefined] : [options: ValidationOptions] ): Promise> { - if (options?.meta && this.#metaDataValidator) { - this.#metaDataValidator(options.meta) + let normalizedOptions = options || ({} as ValidationOptions) + if (normalizedOptions.meta && this.#metaDataValidator) { + this.#metaDataValidator(normalizedOptions.meta) } - const errorReporter = options?.errorReporter || this.errorReporter - const messagesProvider = options?.messagesProvider || this.messagesProvider + const errorReporter = normalizedOptions.errorReporter || this.errorReporter + const messagesProvider = normalizedOptions.messagesProvider || this.messagesProvider return this.#validateFn( data, - options?.meta || {}, + normalizedOptions.meta || {}, this.#refs, messagesProvider, errorReporter()