in ui/src/app/data-explorer/components/chart-view/designer-panel/data-settings/data-explorer-widget-data-settings.component.ts [305:337]
deepCopy(obj) {
let copy;
if (null == obj || 'object' !== typeof obj) {
return obj;
}
if (obj instanceof Date) {
copy = new Date();
copy.setTime(obj.getTime());
return copy;
}
if (obj instanceof Array) {
copy = [];
for (let i = 0, len = obj.length; i < len; i++) {
copy[i] = this.deepCopy(obj[i]);
}
return copy;
}
if (obj instanceof Object) {
copy = {};
for (const attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = this.deepCopy(obj[attr]);
}
}
return copy;
}
throw new Error('Unable to copy.');
}