UNPKG

@sergiomarques/sword-validation

Version:

Field validation tooling and defaults for SWORD Health Web Clients

42 lines (35 loc) 905 B
import { helpers } from 'vuelidate/lib/validators'; import { required, minLength, maxLength } from 'vuelidate/lib/validators'; const addParam = (attributes, callback) => { return helpers.withParams(attributes, callback); }; const maxLeng = (max) => { const attributes = { type: 'maxLength', max: max, }; const doThis = (value) => { console.log(value); console.log(maxLength(max)); return maxLength(max); }; return addParam(attributes, doThis); }; const anotherLeng = (max) => { const attributes = { type: 'maxLength', max: max, }; const doThis = (value) => { console.log(value); console.log(maxLength(max)); return maxLength(max); }; return helpers.withParams(attributes, (value) => { console.log(value); console.log(max); console.log(maxLength(max)()); return maxLength(max)(); }); }; export { maxLeng, anotherLeng };