/**
 * Create a deep copy of the provided value.
 */ export function deepClone < T extends { } > ( value ) { let result ; if ( value === null || value === undefined || typeof value === "boolean" || typeof value === "number" || typeof value === "string" ) { result = value ; } else if ( value instanceof Array ) { result = [ ] ; for ( let index in value ) { ( < unknown [ ] > result ) [ index ] = deepClone ( value [ index ] ) ; } } else { result = { } ; for ( let propertyName in value ) { if ( value . hasOwnProperty ( propertyName ) ) { ( < { [ key ] : unknown ; } > result ) [ propertyName ] = deepClone ( value [ propertyName ] ) ; } } } return < T > result ; }