Hello Everyone,

It is a lot of times that we see `x is not a property of undefined` and to
solve this we have to resort to &&, something like -> data &&
data.childData && data.childData.innerDataArray &&
data.childData.innerDataArray.length
> 0 whiich is quiet verbose.

I suggest, we should add a utility method like Object.path, which takes an
array of strings and returns the value from a given nested object. Also,
this can take a second argument which will be a default value if not found.

This is inspired by path and pathOr as implemented in
http://ramdajs.com/docs/#path

Regards
~Vikash
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to