The Coco CoffeeScript dialog, http://github.com/satyr/coco , supports the auto-suspension of the array and object @ and @@ :
robot@brain@data@contacts.foo = 1
compiles - provided, hairy -
var _ref, _ref2; ((_ref = (_ref2 = robot.brain || (robot.brain = {})).data || (_ref2.data = {})).contacts || (_ref.contacts = {})).foo = 1;
which ensures that every step of the path robot.brain , brain.data , data.contacts really exists.
Of course, you might just need a conditional assignment operator (which, according to the answers above, also exists in CoffeeScript):
robot.brain.data.contacts ?= {}
which compiles to
var _ref; (_ref = robot.brain.data).contacts == null && (_ref.contacts = {});
AKX Mar 05 2018-12-12T00: 00Z
source share