Better than yesterday.

Printing full blown JavaScript objects to the page

The problem

I want to be able to print JavaScript objects to the page, a la wp_localize_script, with a faithful representation of the original object not only when it comes to values, WordPress function does that wonderfully, but when it comes to functions too.
To be clear this

my grunt based setup has the following to say about the use of evalI get it: no eval.
and furthermore it forces the definition of variables outside of the function signature and the following bad code smell.

The result

Given the $data object above I want the following to be printed to the page

My solution

I’ve looked into the Zend framework solution to the problem for a guide but found the solution too convoluted to be applicable in my context and simply came up with an homebrew solution of mine: the JsObject class