@pst-on-npm/homebridge-enocean
Version:
Integrate EnOcean® devices into Homebridge.
29 lines • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Util = void 0;
class Util {
static isNullOrEmpty(value) {
return value === null || value === undefined || value.trim().length === 0;
}
static toHexString(value, digits = 2) {
return value.toString(16).padStart(digits, '0').toUpperCase();
}
static printCallerInfo() {
const error = new Error();
const stack = error.stack?.split('\n');
if (stack && stack.length > 3) {
console.log('Caller Information:', stack[3]);
}
}
static getTimeAsFourDigitString = () => {
const now = new Date(); // Get the current date and time
const hours = now.getHours(); // Get hours (0-23)
const minutes = now.getMinutes(); // Get minutes (0-59)
// Format the hours and minutes to always be two digits
const hoursString = hours.toString().padStart(2, '0');
const minutesString = minutes.toString().padStart(2, '0');
return `${hoursString}${minutesString}`; // Combine as a 4-digit string
};
}
exports.Util = Util;
//# sourceMappingURL=util.js.map