import debug from "debug" ; const pkg = import ( "../package.json" ) ; export function withDuration ( fn , args , log ) { const startedAt = Date . now ( ) ; const result = fn ( ... args ) ; const endedAt = Date . now ( ) ; log ( `duration: ${ endedAt - startedAt }ms` ) ; return result ; } export function buildDebugger ( module ) { const name = "code-complexity" ; return name ? debug ( `${ name }:${ module }` ) : debug ( name ) ; } export async function getPackageJson ( ) { const { description , name , version } = pkg as any ; return { description , name , version } ; }