zod-error
Version:
Utilities to format and customize Zod error messages
15 lines (14 loc) • 456 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getZodPathArray = void 0;
/**
* Gets a string representation of a Zod Issue path.
* @export
* @param {z.ZodIssue['path']} path
* @return {*} {string}
*/
function getZodPathArray(path) {
const elements = path.map((p) => (typeof p === 'string' ? `"${p}"` : p)).join(', ');
return ['[', ...elements, ']'].join('');
}
exports.getZodPathArray = getZodPathArray;