/**
 * The proxy design pattern, allowing us to customize behavior of the delegate
 * object.
 * This creates a property-by-property copy of the functions of the object, so
 * it can be mutated without affecting other users of the original object. See
 * https://en.wikipedia.org/wiki/Proxy_pattern
 */ export function createProxy < T > ( delegate ) { const proxy = Object . create ( null ) ; for ( const [ key , value ] of Object . entries ( delegate ) ) { if ( typeof value === 'function' ) { proxy [ key ] = ( ... args ) => value . apply ( delegate , args ) ; } } return proxy ; }