Table of contents
metaFunction
metaFunctions are critical part for most of metaES use cases. See an example:
metaesEval(function (x) {
return x * x;
}, console.log);
The result is a function; a meta-circular function. Once called, it calls metaES to run previously stringified and parsed sources:
let fn;
metaesEval(
function (x) {
return x * x;
},
(result) => (fn = result)
);
fn(2); // 4;
Bear it in mind again - this funciton will be stringified and parsed, so closures will not work. You'll have to construct closure by hand if necessary by passing extra fields to environment.
To sum up, you can think of metaFunction
as a wrapper for metaesEval
which accept arguments in a function call form.