mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 02:00:43 +00:00
18 lines
522 B
JavaScript
18 lines
522 B
JavaScript
|
|
// Replacement for timely dependency
|
|
export 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;
|
|
}
|
|
|
|
export function timestampsEqual(timestampA, timestampB) {
|
|
const stringifiedTimestampA = timestampA ? timestampA.toISOString() : '';
|
|
const stringifiedTimestampB = timestampB ? timestampB.toISOString() : '';
|
|
return stringifiedTimestampA === stringifiedTimestampB;
|
|
}
|