export const processDescriptor = < T > ( parameterFn , reporterFn , descriptor , propsFilter = ( ) => true ) : PropertyDescriptor => { const original = descriptor . value ; if ( typeof original === "function" ) { descriptor . value = function ( ... args ) { try { const value = typeof parameterFn === "function" ? parameterFn . apply ( this , args ) : parameterFn ; reporterFn ( value ) ; } catch ( e ) { console . error ( `[ERROR] Failed to apply decorator: ${ e }` ) ; } return original . apply ( this , args ) ; } ; } for ( const prop of Object . keys ( original ) ) { if ( Object . prototype . hasOwnProperty . call ( original , prop ) && propsFilter ( prop ) ) { descriptor . value [ prop ] = original [ prop ] ; } } return descriptor ; } ;