Hey Vesa, thank you for the suggestion. I appreciate your contribution.
As for your concern on legibility I would take that more as a preference matter, I personally don't see that as a very hard thing to read but I understand your point.
I think the option you gave it's nice if you want things to explicitly fail so you'd be aware of possible typos. In a context in which you don't know what to expect for the structure of the homoSapiens object for instance I'd prefer to be safe and set default values for each object being destructured, instead of receiving errors like Cannot read property 'x' of undefined.
And yeah, if you can use lodash then go for it ;)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey Vesa, thank you for the suggestion. I appreciate your contribution.
As for your concern on legibility I would take that more as a preference matter, I personally don't see that as a very hard thing to read but I understand your point.
I think the option you gave it's nice if you want things to explicitly fail so you'd be aware of possible typos. In a context in which you don't know what to expect for the structure of the
homoSapiens
object for instance I'd prefer to be safe and set default values for each object being destructured, instead of receiving errors likeCannot read property 'x' of undefined
.And yeah, if you can use lodash then go for it ;)