-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add field to easily check error in onChangeStatus #226
Comments
We could expose the two internal functions (typeguards) Code: https://github.com/josdejong/svelte-jsoneditor/blob/main/src/lib/typeguards.ts#L72-L86 |
That also works for me. |
👍 |
The just published |
|
These two functions are typeguards, they only check the type. Depending on your exact needs you can do something like: function getContentErrorsType(contentErrors: ContentErrors) : 'parse' | 'validation' | 'none' {
return isContentParseError(contentErrors)
? 'parse'
: isContentValidationErrors(contentErrors) && contentErrors.validationErrors.length > 0
? 'validation'
: 'none'
} |
Thinking about it, I think the editor should not return an empty |
Yea that would be the optimal solution. |
👍 I'll implement that |
Published now in |
Sure ill test it. |
Works as expected, thank you! |
Thanks for the feedback and for helping make the library a bit better 😄 |
My pleasure, now i just need to figure out how to deal with Date objects in it. |
You can configure your own JSON parser with the |
Right now if i need to check if the JSON is valid i have to write a long ass sentence:
I would like to have a field to easily check for error and its type:
Thank you.
The text was updated successfully, but these errors were encountered: