This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.clone = function clone<T>(this: Array<T>, deep: boolean, parent: T = null): T[] { | |
const c = this.map(x => Object.assign(Object.create(x as Object), x)); | |
const classNameMatch = (a, b) => a.constructor && b.constructor && a.constructor.name === b.constructor.name; | |
if (deep) { | |
c.forEach(i => { | |
const keys = Object.keys(i); | |
keys.forEach(k => { | |
if (i[k] instanceof Array) { | |
// an array property, let's see if it's an array of T |