I have a huge string config in a file and i want to refactor it to have intelisense.
Note there are also variables in it, so using a function would be the best option.
The result of the return function should be exactly what's inside the config string.
const existingConfig = `
var configOptions = {
enableProp: true,
style: "plain",
onReady: function() {
return true
}
}
`;
I tried something like:
const newConfig = (val) => {
return {
enableProp: true,
style: val,
onReady: function() {
return true
}
};
};
const res = JSON.stringify(newConfig());
Any ideas?