What is the simplest and most generic function wrapper in javascript? I have a lot of variables and objects I need to put a function wrapper around. I'm currently using:
x = {a:function () {return aValue; }, b:function () {return bValue; }, c:'cString' };
I have many such variables and property function wrappers and would like to do this with less coding.
Is there something of the form:
x = {a:wrap(aValue), b:wrap(bValue), c:'cString'}
... or similar (or even a loop through all properties) that would accomplish putting a function wrapper around these so that I can use a get function later to evaluate the property values?
My get function looks like this:
function get(e) {return (typeof e === 'function') ? e () : e; }
Thanks