I have this simple switch block:
function modifyServiceContractView(schema) {
...
}
function modifyContactView(schema) {
...
}
function addExtraInfoToSchema(defName, schema) {
switch (defName) {
case 'ServiceContractView':
return modifyServiceContractView(schema);
break;
case 'ContactView':
return modifyContactView(schema);
break;
default:
return schema;
}
}
instead of hardcoding a switch block, it would be nice to just have something like this instead:
function modifyServiceContractView(schema) {
...
}
function modifyContactView(schema) {
...
}
function addExtraInfoToSchema(defName, schema) {
return eval('modify' + defName+ '(schema)');
}
is there a better way to do this without eval()?
hopefully my question is clear.