Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onMounted(() => {
validate(initialValue, isRef(rules) ? rules.value : rules).then(result => {
if (immediate) {
commitResult(result);
return;
}
// Initial silent validation.
flags.valid.value = result.valid;
flags.invalid.value = !result.valid;
});
});
const validateField = async (newVal: any): Promise => {
flags.pending.value = true;
const result = await validate(newVal, isRef(rules) ? rules.value : rules, {
name: fieldName,
values: form?.valueRecords ?? {}
});
commitResult(result);
return result;
};