UNPKG

@hokuto/jam-node

Version:

JAM Node TS, guardians and utils

21 lines (20 loc) 596 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getLogTimer = exports.getTimer = void 0; const log_js_1 = require("./log.js"); function getTimer(start = Date.now()) { return () => { const end = Date.now(); return { start, end }; }; } exports.getTimer = getTimer; function getLogTimer(start = Date.now()) { return (...msg) => { const end = Date.now(); const diff = ((end - start) / 1000).toFixed(2); (0, log_js_1.log)(...msg, diff); return { start, end }; }; } exports.getLogTimer = getLogTimer;