Lets say i have function node that implements various api functions and I want to dynamically call those functions based on a msg property. In the browser one would call the windows[fn] but that is not available in nodejs, eval is possible, but generally not recommended. Is there better way (other than doing if/else if)?
function start(id){...}
function stop(id){...}
let fn = msg.payload.fn // start
let id = msg.payload.id
eval(`${fn}(${id})`);