Closed c-harding closed 5 years ago
Sure. Originally I left it in to allow us to omit context, which allowed for cleaner code.
Sure. Originally I left it in to allow us to omit context, which allowed for cleaner code.
That can be done by just calling the function, e.g.
const render = new Function(arg1, arg2, "...");
render(a, b);
The function
functionFromString
seems to just be the Function constructor with the arguments in a different order. It then returns a subclass of Function, with a methodrun
which is just a rearrangement of the argument order ofapply
inherited from Function.I would propose removing the
EvalFunction
class, as it does nothing that can’t be done withFunction.prototype.apply
,Function.prototype.call
and the function itself.I would also propose removing
functionFromString
, it is justnew Function
with a different argument order.https://github.com/scottkellum/CJSS/blob/367dad1d442b7df2adf74b705b7934a7018b0f67/src/functionFromString.js#L4