A JavaScript version of Clojure's 'doto macro