AppliedMathematicsANU / plexus-form

A dynamic form component for react using JSON-Schema.
MIT License
134 stars 31 forks source link

Allow errorClass to survive undefined #25

Closed bebraw closed 9 years ago

bebraw commented 9 years ago

Just noticed errorClass generator can fail if props.errors is undefined. It's another question why that can happen in the first place of course.

odf commented 9 years ago

I tend to play fast and loose with passing null and undefined values around. I usually do a variable == null test to catch both cases, which is admittedly a somewhat cryptic idiom, or !variable if I don't expect strings or numbers to be passed in. In this particular case I believe that the || errors === null after the !errors test is redundant.

bebraw commented 9 years ago

On Friday, 27 March 2015, Olaf Delgado-Friedrichs notifications@github.com wrote:

I tend to play fast and loose with passing null and undefined values around. I usually do a variable == null test to catch both cases, which is admittedly a somewhat cryptic idiom, or !variable if I don't expect strings or numbers to be passed in. In this particular case I believe that the || errors === null after the !errors test is redundant.

Yeah, that's true. I will change the PR.

— Reply to this email directly or view it on GitHub https://github.com/AppliedMathematicsANU/plexus-form/pull/25#issuecomment-86774216 .

bebraw commented 9 years ago

I removed the extra check.

odf commented 9 years ago

Sorry for the long wait! That shouldn't have taken me 5 days.

bebraw commented 9 years ago

No problems. :)