UNPKG

@lucidcms/core

Version:

The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.

1 lines 953 B
{"version":3,"file":"tidy-zod-errors.mjs","names":[],"sources":["../../../src/utils/errors/tidy-zod-errors.ts"],"sourcesContent":["import z, { type ZodError } from \"zod\";\n\n/**\n * Removes the \"Invalid input: \" prefix that zod adds to messages.\n */\n// export const removeInvalidInputPrefix = (errorMessage: string): string => {\n// \tconst prefix = \"Invalid input: \";\n// \tif (errorMessage.startsWith(prefix)) {\n// \t\tconst withoutPrefix = errorMessage.substring(prefix.length);\n// \t\treturn withoutPrefix.charAt(0).toUpperCase() + withoutPrefix.slice(1);\n// \t}\n// \treturn errorMessage;\n// };\n\n/**\n * Formatting on top of Zod prettyError\n */\nconst tidyZodError = (error: ZodError): string => {\n\t// return removeInvalidInputPrefix(z.prettifyError(error));\n\treturn z.prettifyError(error).replace(/✖/g, \"\");\n};\n\nexport default tidyZodError;\n"],"mappings":"mBAiBA,MAAM,EAAgB,GAEd,EAAE,cAAc,CAAK,CAAC,CAAC,QAAQ,KAAM,EAAE"}