RunKit + npm: form-validation-thieny

var thieny = require("form-validation-thieny") thieny.add_type({ type_name: 'email', error_data: { code: 1, msg: 'Invalid email' }, validate: str => { if (str) { return { value: str }; } else { return { error: true } } }, field_names: [{ name: 'new_email' }, { name: 'old_email', error_data: { code: 4, msg: 'Invalid old email' } }] }); let data = { email: 'testing@testing.local', new_email: 'new_email@testing.local' }; let result = thieny.required('email') .optional('new_email', 'old_email') .validate(data);
Created from: https://runkit.com/npm/form-validation-thieny
Loading…

no comments

    sign in to comment