⏱️ TrackTimeWrapper.Wrapper(asyncFn, ...args)
Wrap any async function and return its execution time.
1import { TrackTimeWrapper } from 'hbh-nodes';3async function task() {4 await new Promise(res => setTimeout(res, 1200));5 return 'Done';6}8const { result, duration } =9 await TrackTimeWrapper.Wrapper(task);11console.log(result); // "Done"12console.log(duration); // "1 sec"
✨ Features
- Measures async function runtime
- Returns
{ result, duration } - Internally uses
TrackTimeWrapper.formatDuration - Ideal for benchmarking & performance logs