I have an object MainObject, but I would like to exclude and map some of the keys before returning it to the user. However, I do not know all of the keys since I use the ...{} operator to let the user add some custom data into the object.
My code looks something like this:
var UserData = {Id: 123, Name: "Hello World"}
var Data = {Main: "Data", Secret: "Data1", Math: 22, ...UserData}
// Resulting Object Keys [Main, Secret, Math, Id, Name]
// Wanted Object {Main, Math/2, Id, Name}
var result = ?
What I would like to do is to exclude the Secret property and devide the Math property by 2, while keeping the Data object intact.