Its possible to tell if the whole structure has been validated without errors?
See original GitHub issueIssue Description
A function like allTheFieldOfTheNestedStructureAreTrue
I need to know if there is at least an error or not, to integrate spected
with Formik
The formik hoc validate hook expect an empty object if the form has no errors, so I think to do something like
{
validate: values => {
const res = spected(validationSpecs, values)
return isValid(res) ? ({}) : res
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
Validation Error Explanations for Genomes - NCBI - NIH
This page has explanations for individual errors that are commonly found during processing of prokaryotic and eukaryotic genomes, along with ...
Read more >Validation errors explained - Filing candidate reports - FEC
Explanations for error messages returned when using the validator for electronic filings with the Federal Election Commission.
Read more >What is Data Validation? How It Works and Why It's Important
If data isn't accurate from the start, your results definitely won't be accurate either. That's why it's necessary to verify and validate data...
Read more >Unparsable structured data report - Search Console Help
This report lists structured data found on your site that could not be parsed because of a serious syntax error. The intended type...
Read more >Understanding schema errors | HESA
What is a schema error? The schema describes the structure of the XML document (number of elements, whether an element can be empty,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey, what about something like this:
In this way you have no performance hit because you don’t have to traverse the object again. I don’t know if a solution like this should be provided by spected itself, I can’t think of an elegant way to integrate it in the current API other than providing another function, which sounds like unnecessary complexity.
(demo: http://jsbin.com/coqodotuyo/edit?js,console,output)
I’ve sketched out a possible
isValid
function, here: http://jsbin.com/seworut/edit?js,outputFor @daniele-rapagnani : I don’t like to integrate the current idea either, but I still think it should be in the library, as its a common case, and I bet the most of the libraries out there will need it.
Cool trick BTW!