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. […]

A simple(r) approach for class-based OOP in JavaScript.

by Valeriu Paloş on June 18, 2011

Like others before me, I found JavaScript’s prototype-based OOP support – while very powerful – quite cumbersome in some situations where I needed a certain structure or hierarchy of objects, situations in which one quickly comes to the conclusion that the best answer would be the concept of a Class. However, while I am well […]

Command-line option parser in JavaScript.

by Valeriu Paloş on May 20, 2011

Here’s a small but very effective command-line option parser written in JavaScript (uses NodeJs). You can get the up-to-date source code at http://gist.github.com/982499. I wrote this because I needed it for a project and I did not think it was worth it to install some npm package just for this. The comment should explain most […]