UNPKG

@thisisagile/easy

Version:

Straightforward library for building domain-driven microservice architectures

24 lines (22 loc) 698 B
import { ifTrue, toList } from "./chunk-AVHYDITZ.mjs"; // src/utils/Seconds.ts var seconds = { toDuration: (s) => { const seconds2 = s % 60; const minutes = Math.floor(s / 60) % 60; const hours = Math.floor(s / 3600) % 24; const days = Math.floor(s / 86400); return { days, hours, minutes, seconds: seconds2 }; }, toText: (s) => { const { days, hours, minutes, seconds: secs } = seconds.toDuration(s); return toList(ifTrue(days, `${days}d`), ifTrue(hours, `${hours}h`), ifTrue(minutes, `${minutes}m`), ifTrue(days + hours + minutes === 0, `${secs}s`)).mapDefined((s2) => s2).join(" "); } }; export { seconds }; //# sourceMappingURL=chunk-IKUC55KC.mjs.map