What is "path" argument?
I just ran into this library, while looking for a library to do data sanitization for one of my apps. It looks very promising. I just have one question though. I noticed that each "as" function has a second "path" argument. What exactly is this argument? Or, what do I pass in to it? The docs in the README do not really go over the arguments.
Thanks.
Hey Patrick. Great question. The path argument is used for error reporting. The sanitizers call the nested ones recursively providing the current path so that in the end you can get an error saying expected string at "object.key[1]".
If you are wondering what to pass I would recommend going with "" - empty string. Before you do that though have a look at the cast function. You can use it to sanitize your values: e.g. cast(myValue, asString). Then you won't need to worry about the path argument.
Hope this helps