safe-object
How many times have you seen Uncaught TypeError: Cannot read property 'something' of undefined
?!
Well no more! safe-object
to the rescue. Here is how to use it:
var so = ;var obj =user:name: 'Jilles'demo: true// causes an errorif objuserdetailsageconsole;// works, but uglyif objuser && objuserdetails && objuserdetailsageconsole;// just skips the statementifconsole;