param arr returns export function unique ( arr ) { return [ ... new Set ( arr ) ] ; } export function deepCopy ( obj ) { if ( ! obj ) return obj ; let out ; if ( Array . isArray ( obj ) ) { out = [ ] ; for ( const x of obj ) { out . push ( deepCopy ( x ) ) ; } return out ; } else if ( typeof obj === "object" && obj !== null ) { out = { } ; for ( const key in obj ) { if ( obj . hasOwnProperty ( key ) ) { out [ key ] = deepCopy ( obj [ key ] ) ; } } return out ; } else { return obj ; } }