6. Monitoring and Stats
1const slowFn = (x) => new Promise(res => setTimeout(() => res(x * 2), 100));2const profiled = FunctionWrapper.stats(slowFn);4profiled(2).then(() => {5 console.log(profiled.stats); // { calls: 1, avgTime: '100.00ms' }6});