Using typescript, I need to convert some strings like "Math.floor" and "console.log" to the functions Math.floor and console.log, in order to be able to use those functions when passed as a string parameter.
For example
applyFunction ("Math.floor", 4.2); // => Math.floor(4.2) => 4
applyFunction ("console.log", "Hi"); // => console.log("Hi") => Hi
And so on.
I tried adding them as keys and values in an object and scanning the object whenever needed. But since I don't have the time to continuously search for and add all existing Typescript functions, I'm looking for a more comprehensive approach.