import { PerfMarksPerformanceEntry , start , end } from './marks' ; param { ( ( ) => any | Promise < any > ) } callback param { string } name returns { Promise < PerfMarksPerformanceEntry > } const profiler = async ( callback , name ) : Promise < { data ? : any ; mark : PerfMarksPerformanceEntry ; } > => { start ( name ) ; try { const data = await callback ( ) ; const mark = end ( name ) ; return ! ! data ? Object . assign ( { } , { data , mark } ) : { mark } ; } catch ( error ) { end ( name ) ; throw error ; } } ; export { profiler } ;