I'm using Zod to validate the input of my application forms and when a validation error happens I receive an array of errors with a message
property and a path
property.
I need to transform the received path
property to a string
object path so I can use it to create a ValidationError
for React Final Form.
Given path
:
["user", "name"]
["company", 0, "name"]
Expected string
object path:
"user.name"
"company[0].name"
Surprisingly I didn't find any code on Stack Overflow, Google Search or NPM that implements this :)