@trapcode/codebase
Version:
For TrapCode
40 lines (33 loc) • 839 B
JavaScript
// import {validate, Validator} from "object-validator-pro";
/*import phone from 'phone'
const ng = window.ng;
new Validator('phone', (value, ifYes = null) => {
if (value[0] !== '+') {
value = '+' + value
}
let phoneNumber = phone(value);
if (phoneNumber.length) {
if (typeof ifYes == 'function') {
ifYes(phoneNumber[0])
}
return true
} else {
return false
}
}, 'Invalid :param');*/
export default {
data() {
return {
usingFormValidator: null
};
},
methods: {
usingValidator(validator) {
this.usingFormValidator = validator;
return this;
},
validateFormObj(form, validateWith, functions) {
return validate(form, validateWith, functions);
}
}
};