UNPKG

fluent-vuelidate

Version:

A fluent, typescript-first validation library for Vue3

16 lines (15 loc) 889 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useFieldValidationFactory = void 0; const array_field_type_1 = require("./field-types/array-field-type"); const number_field_type_1 = require("./field-types/number-field-type"); const string_field_type_1 = require("./field-types/string-field-type"); const useFieldValidationFactory = (instance, propertyName, validations) => { const type = typeof instance[propertyName]; if (type === 'string') return (0, string_field_type_1.createStringValidator)(instance, propertyName, validations); if (type === 'number') return (0, number_field_type_1.createNumberValidator)(instance, propertyName, validations); return (0, array_field_type_1.createArrayValidator)(instance, propertyName, validations); }; exports.useFieldValidationFactory = useFieldValidationFactory;