zod-error
Version:
Utilities to format and customize Zod error messages
26 lines (25 loc) • 817 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPathString = void 0;
const __1 = require("..");
function getPathString(path, options) {
if ((options === null || options === void 0 ? void 0 : options.enabled) === undefined) {
return (0, __1.getObjectNotation)(path, { enabled: true, type: 'objectNotation' });
}
if (options.enabled === false) {
return '';
}
switch (options.type) {
case 'zodPathArray': {
return (0, __1.getZodPathArray)(path);
}
case 'breadcrumbs': {
return (0, __1.getBreadcrumbs)(path, options);
}
case 'objectNotation':
default: {
return (0, __1.getObjectNotation)(path, options);
}
}
}
exports.getPathString = getPathString;