|
@@ -18,6 +18,20 @@ var cloneValue = (source: any, destinationObject: any) => {
|
|
|
return null;
|
|
|
};
|
|
|
|
|
|
+function getAllPropertyNames(obj: any): string[] {
|
|
|
+ const props: string[] = [];
|
|
|
+
|
|
|
+ do {
|
|
|
+ Object.getOwnPropertyNames(obj).forEach(function(prop) {
|
|
|
+ if (props.indexOf(prop) === -1) {
|
|
|
+ props.push(prop);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } while (obj = Object.getPrototypeOf(obj));
|
|
|
+
|
|
|
+ return props;
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Class containing a set of static utilities functions for deep copy.
|
|
|
*/
|
|
@@ -30,7 +44,7 @@ export class DeepCopier {
|
|
|
* @param mustCopyList defines a list of properties to copy (even if they start with _)
|
|
|
*/
|
|
|
public static DeepCopy(source: any, destination: any, doNotCopyList?: string[], mustCopyList?: string[]): void {
|
|
|
- for (var prop in source) {
|
|
|
+ for (var prop in getAllPropertyNames(source)) {
|
|
|
|
|
|
if (prop[0] === "_" && (!mustCopyList || mustCopyList.indexOf(prop) === -1)) {
|
|
|
continue;
|