Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /homepages/42/d436282994/htdocs/wp.vpalos.com/wp-content/plugins/wp-markdown/markdownify/markdownify.php on line 299
vpalos.com | snippets

vpalos.com // milk, cookies, segfaults…

Universal getter for plain JS objects.

by Valeriu Paloş on April 15, 2013

Many times in JavaScript we have to reach deep into objects to access fields that could possibly not be there at all; for example let’s assume I have a JS object called options into which I’ve just read an entire JSON configuration file. Trying to access a field like options.application.cache.enable directly will potentially fail (e.g. […]