As a novice in typescript, I am seeking guidance on the most efficient method to accomplish this task using typescript:
I have a map object that serves as a field mapping tool for combining two objects: source and target.
The map object remains unalterable, with the format of "${source}.field1"
always being a string.
source = { "field1" : 10, "field3" : 30}
target = { "field2" : 20, "field4" : 40}
map = {
"JuncField1":"${source}.field1",
"JuncField2":"${target}.field2"
}
The primary objective is to generate a new object, based on the aforementioned mapping. What approach would be the most effective?
{ "JuncField1" : 10, "JuncField2" : 20}