Files
emaui/node_modules/@mantine/form/cjs/validate/validate-field-value.cjs
2026-05-29 15:23:46 +03:00

19 lines
635 B
JavaScript

'use client';
'use strict';
var validateValues = require('./validate-values.cjs');
function validateFieldValue(path, rules, values) {
if (typeof path !== "string") {
return { hasError: false, error: null };
}
const results = validateValues.validateValues(rules, values);
const pathInError = Object.keys(results.errors).find(
(errorKey) => path.split(".").every((pathPart, i) => pathPart === errorKey.split(".")[i])
);
return { hasError: !!pathInError, error: pathInError ? results.errors[pathInError] : null };
}
exports.validateFieldValue = validateFieldValue;
//# sourceMappingURL=validate-field-value.cjs.map