serverless-local
Version:
A serverless framework plugin for running your serverless stack locally.
15 lines (14 loc) • 436 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stopwatch = void 0;
const NS_PER_SEC = 1e9;
const MS_PER_NS = 1e-6;
const getDiffInMs = (diff) => ((diff[0] * NS_PER_SEC + diff[1]) * MS_PER_NS).toFixed(2);
function stopwatch() {
const start = process.hrtime();
return () => {
const end = process.hrtime(start);
return getDiffInMs(end);
};
}
exports.stopwatch = stopwatch;