mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 10:11:03 +00:00
12 lines
259 B
JavaScript
12 lines
259 B
JavaScript
// Replacement for timely dependency
|
|
|
|
export default function timer(fn) {
|
|
const timedFn = (...args) => {
|
|
const start = new Date();
|
|
const result = fn.apply(fn, args);
|
|
timedFn.time = new Date() - start;
|
|
return result;
|
|
};
|
|
return timedFn;
|
|
}
|