I have some data in a class that is imported to be used when a variable name is the same as the imported class name. I don't know the best way to first check the value if its the same as the imported class name.
Right now my code looks like:
import { TEST, TEST2 } from '../shared/panel';
selectPanel(panel) {
let test;
if(panel === 'TEST'){
test = TEST;
}
else if(panel === 'TEST2'){
test = TEST2;
}
else{
test = '';
}
}
Is there any shorter way or better way to do this? Cause when there are lots of condition it become messy.