import * as constants from './constants' ; import * as types from './types' ; import * as Router from 'router' ; export const isInternal = ( fn ) => { if ( fn . name === 'handle' && fn . toString ( ) === constants . ROUTER_HANDLE_FN ) { return true ; } if ( fn . name === 'router' && fn . toString ( ) === constants . ROUTE_ROUTER_FN ) { return true ; } return false ; } ; export const getRoute = ( req ) => req . baseUrl + ( req . route ?. path ?? '' ) || '/' ; export const renameHttpSpan = ( span ? , method ? , route ? ) => { if ( typeof method === 'string' && typeof route === 'string' && span ?. name ?. startsWith ( 'HTTP ' ) ) { span . updateName ( `${ method . toUpperCase ( ) } ${ route }` ) ; } } ; export const once = ( fn ) => { let run = true ; return ( ) => { if ( run ) { run = false ; fn ( ) ; } } ; } ;