UNPKG

zod-error

Version:

Utilities to format and customize Zod error messages

19 lines (18 loc) 811 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getComponentLabels = void 0; const get_label_1 = require("../get-label"); /** * Gets component labels. * Defaults to 'Code: ', 'Message: ' and 'Path: '. * @export * @param {ErrorMessageOptions} [options] * @return {*} {Labels} */ function getComponentLabels(options) { const code = (0, get_label_1.getLabel)(options === null || options === void 0 ? void 0 : options.code, 'Code: '); const message = (0, get_label_1.getLabel)(options === null || options === void 0 ? void 0 : options.message, 'Message: '); const path = (0, get_label_1.getLabel)(options === null || options === void 0 ? void 0 : options.path, 'Path: '); return { code, message, path }; } exports.getComponentLabels = getComponentLabels;