import { clone , isFunction , keys } from "lodash" ; function wrap ( method ) { return function cloneMethodIO ( this ) { return clone ( method . apply ( this , clone ( arguments ) ) ) ; } ; } export default function cloneMethodsIO ( constructor ) { keys ( constructor . prototype ) . forEach ( ( key ) => { const method = constructor . prototype [ key ] ; if ( isFunction ( method ) ) { constructor . prototype [ key ] = wrap ( method ) ; } } ) ; }