UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

26 lines (21 loc) 568 B
/*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ import { convertHrTime } from "./chunk-5EZFB54B.mjs"; // src/timeSpan.ts function timeSpan() { const start = process.hrtime.bigint(); const end = (type) => convertHrTime(process.hrtime.bigint() - start)[type]; const result = () => end("milliseconds"); result.toRounded = () => Math.round(end("milliseconds")); result.toSeconds = () => end("seconds"); result.toNanoseconds = () => end("nanoseconds"); return result; } export { timeSpan };