export function shallowClone(obj : Object) { if (typeof obj !== 'object') return obj; let clone = Object.create(obj.constructor.prototype); Object.assign(clone, obj); return clone; } export function clone(obj) { return JSON.parse(JSON.stringify(obj)); }