UNPKG

pollsky

Version:

Chained Polling Library for Node.js: Friendly API with no external dependencies.

30 lines 773 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTimestamp = exports.Time = void 0; /** * 🔧 Helper class to store time interval and units of time. */ class Time { constructor(attributes) { this.interval = attributes.interval; this.unit = attributes.unit; } /** * Converts an object to milliseconds. */ toMilliseconds() { return this.interval * Time.TIME_UNIT_MULTIPLIER[this.unit]; } } exports.Time = Time; /** * Time unit duration multiplayer. */ Time.TIME_UNIT_MULTIPLIER = { 'milliseconds': 1, 'seconds': 1000, 'minutes': 60 * 1000 }; const getTimestamp = () => new Date().toISOString(); exports.getTimestamp = getTimestamp; //# sourceMappingURL=utils.js.map