I am dealing with 2 objects:
person{
name : string
gender : string
}
woman{
name : string
}
The challenge I face is that I have an object "person" filled with values, and I need to copy those values into a new object "woman" without including the "gender" property. I attempted using jQuery.extend(), but it ended up adding "gender" to "woman".
Any suggestions on how I can achieve this?
Additional context:
In my application, I have various classes representing data with additional properties that are not meant to be saved. In this instance, I require a way to cleanse these objects of excess properties. Each class has an Interface containing only the necessary properties for saving.
So, I do the following:
var objInterface = <IWoman>{};
Then, with an empty object, I proceed to copy person.name into objInterface.name. This allows me to serialize objInterface with the required data only.
Given that I have multiple classes, I need a dynamic solution for achieving this.