UNPKG

@hokuto/jam-node

Version:

JAM Node TS, guardians and utils

16 lines (15 loc) 400 B
import { log } from "./log.js"; export function getTimer(start = Date.now()) { return () => { const end = Date.now(); return { start, end }; }; } export function getLogTimer(start = Date.now()) { return (...msg) => { const end = Date.now(); const diff = ((end - start) / 1000).toFixed(2); log(...msg, diff); return { start, end }; }; }