export function deepClone ( target ) { function _clone ( t ) { const type = is ( t ) ; if ( [ 'Null' , 'Number' , 'String' , 'Boolean' , 'Undefined' ] . indexOf ( type ) >= 0 ) { return t ; } else if ( type === 'Array' ) { const arr = [ ] ; t . forEach ( ( item ) => { arr . push ( _clone ( item ) ) ; } ) ; return arr ; } else if ( type === 'Object' ) { const obj = { } ; const keys = Object . keys ( t ) ; keys . forEach ( ( key ) => { obj [ key ] = _clone ( t [ key ] ) ; } ) ; return obj ; } } return _clone ( target ) ; } function is ( data ) { return Object . prototype . toString . call ( data ) . replace ( /[\]|\[]{1,1}/ig , '' ) . split ( ' ' ) [ 1 ] ; }