UNPKG

lib-comfoair

Version:

Library to communicate with Zehnder ComfoAirQ ventilation unit through the ComfoControl gateway

20 lines (19 loc) 577 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tryCatch = tryCatch; /** * Executes a function and returns its result. If an error occurs, returns the fallback value. * * @template T - The type of the return value. * @param {() => T} fn - The function to execute. * @param {T} fallback - The value to return if an error occurs. * @returns {T} - The result of the function or the fallback value if an error occurs. */ function tryCatch(fn, fallback) { try { return fn(); } catch { return fallback; } }